19c-RAC节点删除(实验环境)

实验环境(一套19c-rac环境)

[grid@db1 ~]$ crsctl status res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       db1                      STABLE
               ONLINE  ONLINE       db2                      STABLE
ora.chad
               ONLINE  ONLINE       db1                      STABLE
               ONLINE  ONLINE       db2                      STABLE
ora.net1.network
               ONLINE  ONLINE       db1                      STABLE
               ONLINE  ONLINE       db2                      STABLE
ora.ons
               ONLINE  ONLINE       db1                      STABLE
               ONLINE  ONLINE       db2                      STABLE
ora.proxy_advm
               OFFLINE OFFLINE      db1                      STABLE
               OFFLINE OFFLINE      db2                      STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       db1                      STABLE
      2        ONLINE  ONLINE       db2                      STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       db1                      STABLE
      2        ONLINE  ONLINE       db2                      STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       db2                      STABLE
ora.OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       db1                      STABLE
      2        ONLINE  ONLINE       db2                      STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       db1                      Started,STABLE
      2        ONLINE  ONLINE       db2                      Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       db1                      STABLE
      2        ONLINE  ONLINE       db2                      STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       db2                      STABLE
ora.db1.vip
      1        ONLINE  ONLINE       db1                      STABLE
ora.db2.vip
      1        ONLINE  ONLINE       db2                      STABLE
ora.qosmserver
      1        ONLINE  ONLINE       db2                      STABLE
ora.qujz.db
      1        ONLINE  ONLINE       db1                      Open,HOME=/u01/app/o
                                                             racle/product/19.0.0
                                                             .0,STABLE
      2        ONLINE  ONLINE       db2                      Open,HOME=/u01/app/o
                                                             racle/product/19.0.0
                                                             .0,STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       db2                      STABLE
--------------------------------------------------------------------------------

节点删除分为3大阶段
1.删除实例  2.删除数据库软件  3.删除GI

一.删除实例(本次实验是把db1移除节点)

1.我们查看一下集群有几个节点构成的

[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/olsnodes -s -t
db1	Active	Unpinned
db2	Active	Unpinned

2.在做单节点变动操作前最好先对集群注册表做个备份

查看OCR有没有备份(在被删除的节点上运行)
[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/ocrconfig -showbackup

db2     2022/01/28 23:27:35     +OCR:/db-cluster/OCRBACKUP/backup00.ocr.262.1095204447     724960844

db2     2022/01/28 19:27:27     +OCR:/db-cluster/OCRBACKUP/backup01.ocr.261.1095190039     724960844

db2     2022/01/28 15:27:17     +OCR:/db-cluster/OCRBACKUP/backup02.ocr.258.1095175631     724960844

db2     2022/01/28 03:26:53     +OCR:/db-cluster/OCRBACKUP/day.ocr.259.1095132415     724960844

db1     2022/01/25 06:55:02     +OCR:/db-cluster/OCRBACKUP/week.ocr.260.1094885703     724960844
PROT-25: Manual backups for the Oracle Cluster Registry are not available ----------手动备份不可用

集群注册表做备份
[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/ocrconfig -manualbackup
db2     2022/01/29 00:32:16     +OCR:/db-cluster/OCRBACKUP/backup_20220129_003216.ocr.263.1095208337     724960844    
进行刚刚备份检查
[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/ocrconfig -showbackup

db2     2022/01/28 23:27:35     +OCR:/db-cluster/OCRBACKUP/backup00.ocr.262.1095204447     724960844

db2     2022/01/28 19:27:27     +OCR:/db-cluster/OCRBACKUP/backup01.ocr.261.1095190039     724960844

db2     2022/01/28 15:27:17     +OCR:/db-cluster/OCRBACKUP/backup02.ocr.258.1095175631     724960844

db2     2022/01/28 03:26:53     +OCR:/db-cluster/OCRBACKUP/day.ocr.259.1095132415     724960844

db1     2022/01/25 06:55:02     +OCR:/db-cluster/OCRBACKUP/week.ocr.260.1094885703     724960844

db2     2022/01/29 00:32:16     +OCR:/db-cluster/OCRBACKUP/backup_20220129_003216.ocr.263.1095208337     724960844   ---刚刚备份出的集群注册表

3.删除实例

Oracle用户删除实例(在一个保留的节点上运行)-nodeList(删除实例所在的节点)   -gdbName(表示数据库的名字)  -instanceName(表示要删除的实例名字) -sysDBAUserName(表示超级管理员)  -sysDBAPassword(管理员密码)
[oracle@db2 ~]$ dbca -silent -deleteInstance -nodeList db1 -gdbName qujz -instanceName qujz1 -sysDBAUserName sys -sysDBAPassword oracle
[WARNING] [DBT-19203] The Database Configuration Assistant will delete the Oracle instance and its associated OFA directory structure. All information about this instance will be deleted.

Prepare for db operation
40% complete
Deleting instance
48% complete
52% complete
56% complete
60% complete
64% complete
68% complete
72% complete
76% complete
80% complete
Completing instance management.
100% complete
Instance "qujz1" deleted successfully from node "db1".
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/qujz/qujz.log" for further details.
----删除成功

检查下实例是否删除成功

[oracle@db2 ~]$ srvctl config database -d qujz
Database unique name: qujz
Database name: qujz
Oracle home: /u01/app/oracle/product/19.0.0.0
Oracle user: oracle
Spfile: +DATA/QUJZ/PARAMETERFILE/spfile.273.1094873733
Password file: +DATA/QUJZ/PASSWORD/pwdqujz.256.1094872611
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: 
Disk Groups: DATA
Mount point paths: 
Services: 
Type: RAC
Start concurrency: 
Stop concurrency: 
OSDBA group: dba
OSOPER group: 
Database instances: qujz2      ----qujz1已经消失了
Configured nodes: db2          ----db1已经消失了 
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services: 
Database is administrator managed
----qujz这个实例在db1上已经消失

二.删除数据库软件

1.更新inventory(在被删除的节点上运行)

[oracle@db1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db1" -local    -------执行,更新Inventory   db1是要被删除的节点
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 6771 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

2.卸载ORACLE HOME(在被删除的节点上运行),就是删除ORACLE DATABASE软件

[oracle@db1 bin]$ $ORACLE_HOME/deinstall/deinstall -local
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/oracle/product/19.0.0.0
Oracle Home type selected for deinstall is: Oracle Real Application Cluster Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/19.0.0.0/grid
The following nodes are part of this cluster: db1,db2
Checking for sufficient temp space availability on node(s) : 'db1'

## [END] Install check configuration ##


Network Configuration check config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2022-01-29_12-48-14AM.log

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2022-01-29_12-48-14AM.log

Use comma as separator when specifying list of values as input

Specify the list of database names that are configured locally on this node for this Oracle home. Local configurations of the discovered databases will be removed []: 
Database Check Configuration END

######################### DECONFIG CHECK OPERATION END #########################


####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.0.0.0/grid
The following nodes are part of this cluster: db1,db2
The cluster node(s) on which the Oracle home deinstallation will be performed are:db1
Oracle Home selected for deinstall is: /u01/app/oracle/product/19.0.0.0
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Do you want to continue (y - yes, n - no)? [n]: y  
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-01-29_12-48-00-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-01-29_12-48-00-AM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2022-01-29_12-48-14AM.log

Network Configuration clean config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2022-01-29_12-48-14AM.log

Network Configuration clean config END


######################### DECONFIG CLEAN OPERATION END #########################


####################### DECONFIG CLEAN OPERATION SUMMARY #######################
#######################################################################


############# ORACLE DECONFIG TOOL END #############

Using properties file /tmp/deinstall2022-01-29_12-47-49AM/response/deinstall_2022-01-29_12-48-00-AM.rsp
Location of logs /u01/app/oraInventory/logs/

############ ORACLE DEINSTALL TOOL START ############





####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-01-29_12-48-00-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-01-29_12-48-00-AM.err'

######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to db1
Setting CLUSTER_NODES to db1
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2022-01-29_12-47-49AM/oraInst.loc
Setting oracle.installer.local to true

## [END] Preparing for Deinstall ##

Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START

Detach Oracle home '/u01/app/oracle/product/19.0.0.0' from the central inventory on the local node : Done

Delete directory '/u01/app/oracle/product/19.0.0.0' on the local node : Done

The Oracle Base directory '/u01/app/oracle' will not be removed on local node. The directory is not empty. User needs to manually cleanup this directory.

Oracle Universal Installer cleanup was successful.

Oracle Universal Installer clean END


## [START] Oracle install clean ##


## [END] Oracle install clean ##


######################### DEINSTALL CLEAN OPERATION END #########################


####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/oracle/product/19.0.0.0' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/19.0.0.0' on the local node.
Oracle Universal Installer cleanup was successful.

Review the permissions and contents of '/u01/app/oracle' on nodes(s) 'db1'.
If there are no Oracle home(s) associated with '/u01/app/oracle', manually delete '/u01/app/oracle' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL TOOL END #############

3.更新inventory(在被保留的节点上运行)

[oracle@db2 ~]$  cd $ORACLE_HOME/oui/bin

[oracle@db2 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db2" -local             ------------如果有多个节点填入剩下的节点

4.有些时候(被删除的节点下不会卸载干净,需要手动删除)

[oracle@db1 bin]$ cd $ORACLE_HOME           ---------$ORACLE_HOME这个目录
-bash: cd: /u01/app/oracle/product/19.0.0.0: No such file or directory       --------目录不存在,说明卸载是成功的
[oracle@db1 bin]$ cd /u01/app/oracle/product/19.0.0.0
-bash: cd: /u01/app/oracle/product/19.0.0.0: No such file or directory

三.删除GI(要删除的节点上grid用户执行)

1.查看节点状态

[grid@db1 ~]$ olsnodes -s -t
db1	Active	Unpinned      ----查看还是有2个节点组成
db2	Active	Unpinned

2.进行节点删除(root用户)

禁用和停止所有正在运行的群集资源
[root@db1 ~]# cd /u01/app/19.0.0.0/grid/crs/install/
[root@db1 install]# ./rootcrs.sh -deconfig -force
-lastnode 如果是想删除所有的节点 ,则加上选项lastnode,加上选项lastnode很危险,因为它会导致清楚OCR 和voting disks的数据)
-force表示强迫停止VIP资源
[root@db1 install]# ./rootcrs.sh -deconfig -force
Using configuration parameter file: /u01/app/19.0.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/db1/crsconfig/crsdeconfig_db1_2022-01-29_00-59-15AM.log
2022/01/29 01:00:36 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.
2022/01/29 01:02:35 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.
2022/01/29 01:02:35 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node

3.更新inventory(在要被删除的节点上)

[grid@db1 ~]$  cd $ORACLE_HOME/oui/bin
[grid@db1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db1" CRS=TRUE -silent -local
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 8020 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
 /u01/app/oraInventory/logs/UpdateNodeList2022-01-29_01-04-45AM.log
'UpdateNodeList' was successful.

4.删除Grid Infrastructure home(在要被删除的节点)

这个命令会删除$GRID_HOME下面所有的东西
[grid@db1 ]$ $ORACLE_HOME/deinstall/deinstall -local
如果不指定–local,会删除整个cluster中的所有的grid home

[grid@db1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db1" CRS=TRUE -silent -local
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 8020 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
 /u01/app/oraInventory/logs/UpdateNodeList2022-01-29_01-04-45AM.log
'UpdateNodeList' was successful.
[grid@db1 bin]$  $ORACLE_HOME/deinstall/deinstall -local
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2022-01-29_01-05-58AM/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/19.0.0.0/grid
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Standalone Server
Oracle Base selected for deinstall is: /u01/app/grid
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home 

## [END] Install check configuration ##

Traces log file: /tmp/deinstall2022-01-29_01-05-58AM/logs//crsdc_2022-01-29_01-06-15-AM.log

Network Configuration check config START

Network de-configuration trace file location: /tmp/deinstall2022-01-29_01-05-58AM/logs/netdc_check2022-01-29_01-06-15AM.log

Specify all Oracle Restart enabled listeners that are to be de-configured. Enter .(dot) to deselect all. [ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN1]:              -------直接回车
Network Configuration check config END

Asm Check Configuration START

ASM de-configuration trace file location: /tmp/deinstall2022-01-29_01-05-58AM/logs/asmcadc_check2022-01-29_01-06-15AM.log

ASM configuration was not detected in this Oracle home. Was ASM configured in this Oracle home (y|n) [n]: y   ---选择y

####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: 
Oracle Home selected for deinstall is: /u01/app/19.0.0.0/grid
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Following Oracle Restart enabled listener(s) will be de-configured: ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN1
ASM was not detected in the Oracle Home
Do you want to continue (y - yes, n - no)? [n]: y   --选择y 



----------------------删除完成

######################### DEINSTALL CLEAN OPERATION END #########################


####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/19.0.0.0/grid' from the central inventory on the local node.
Failed to delete directory '/u01/app/19.0.0.0/grid' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/19.0.0.0/grid' on local node.
Failed to delete directory '/u01/app/oraInventory' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/oraInventory' on local node.
Oracle Universal Installer cleanup completed with errors.


Run 'rm -r /etc/oraInst.loc' as root on node(s) 'db1' at the end of the session.

Run 'rm -r /opt/ORCLfmap' as root on node(s) 'db1' at the end of the session.
Run 'rm -r /etc/oratab' as root on node(s) 'db1' at the end of the session.
Review the permissions and contents of '/u01/app/grid' on nodes(s) 'db1'.
If there are no Oracle home(s) associated with '/u01/app/grid', manually delete '/u01/app/grid' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################





5.在要删除的节点上执行以下命令kill掉相关进程

ps -ef |grep ora |awk '{print $2}' |xargs kill -9
ps -ef |grep grid |awk '{print $2}' |xargs kill -9
ps -ef |grep asm |awk '{print $2}' |xargs kill -9
ps -ef |grep storage |awk '{print $2}' |xargs kill -9
ps -ef |grep ohasd |awk '{print $2}' |xargs kill -9 
ps -ef |grep grid
ps -ef |grep ora
ps -ef |grep asm

-----------------------------------------------------------
[root@db1 install]# ps -ef |grep ora |awk '{print $2}' |xargs kill -9
 
ps -ef |grep grid
ps -ef |grep ora
ps -ef |grep asm
kill: sending signal to 76043 failed: No such process
[root@db1 install]# ps -ef |grep grid |awk '{print $2}' |xargs kill -9
kill: sending signal to 76048 failed: No such process
[root@db1 install]# ps -ef |grep asm |awk '{print $2}' |xargs kill -9
kill: sending signal to 76053 failed: No such process
[root@db1 install]# ps -ef |grep storage |awk '{print $2}' |xargs kill -9
kill: sending signal to 76058 failed: No such process
[root@db1 install]# ps -ef |grep ohasd |awk '{print $2}' |xargs kill -9 
kill: sending signal to 76063 failed: No such process
[root@db1 install]# ps -ef |grep grid
root      76068  45357  0 01:17 pts/0    00:00:00 grep --color=auto grid
[root@db1 install]# ps -ef |grep ora
root      76070  45357  0 01:17 pts/0    00:00:00 grep --color=auto ora
[root@db1 install]# ps -ef |grep asm
root      76072  45357  0 01:17 pts/0    00:00:00 grep --color=auto asm

6.手工删除残留的文件(以root运行)

ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/19.0.0.0/grid/
cd $ORACLE_HOME
rm -rf *
cd $ORACLE_BASE
rm -rf *

rm -rf /etc/rc5.d/S96ohasd
rm -rf /etc/rc3.d/S96ohasd
rm -rf /rc.d/init.d/ohasd
rm -rf /etc/oracle
rm -rf /etc/ora*
rm -rf /etc/oratab
rm -rf /etc/oraInst.loc
rm -rf /opt/ORCLfmap/
rm -rf /u01/app/oracle/oraInventory
rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv
rm -rf /usr/local/bin/coraenv
rm -rf /tmp/*
rm -rf /var/tmp/.oracle
rm -rf /var/tmp
rm -rf /home/grid/*
rm -rf /home/oracle/*
rm -rf /etc/init/oracle*
rm -rf /etc/init.d/ora
rm -rf /tmp/.*

7.移除db1

在保留的任意一个节点上执行下面的步骤
从clusterware中移除节点db1
[root@db2 ~]# crsctl delete node -n db1
CRS-4661: Node db1 successfully deleted.

8.进行检查

[grid@db2 ~]$ cluvfy stage -post nodedel -n db1 -verbose

Verifying Node Removal ...
  Verifying CRS Integrity ...PASSED
  Verifying Clusterware Version Consistency ...PASSED
Verifying Node Removal ...PASSED

Post-check for node removal was successful.  ---节点删除后检查成功

CVU operation performed:      stage -post nodedel
Date:                         Jan 29, 2022 1:49:45 AM
CVU home:                     /u01/app/19.0.0.0/grid/
User:                         grid


[grid@db2 ~]$ olsnodes -s -t
db2	Active	Unpinned

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值