解决方案
1,删除节点
1.1 备份OCR
在删除节点钱,建议手动备份OCR,OLR(GRID每4个小时也会自动备份OCR),目的是如果出现某些问题,我们可以恢复到删除节点前。
$GRID_HOME = /u01/app/11.2.0/grid
查看ocr的自动备份信息
[root@rac02 rac02]# $GRID_HOME/bin/ocrconfig -showbackup
PROT-24: Auto backups for the Oracle Cluster Registry are not available
rac02 2022/08/10 14:55:07 /u01/app/11.2.0/grid/cdata/rac-cluster/backup_20220810_145507.ocr
手动备份一份OCR信息
[root@rac02 ~]# $GRID_HOME/bin/ocrconfig -manualbackup
rac02 2022/08/10 14:55:07 /u01/app/11.2.0/grid/cdata/rac-cluster/backup_20220810_145507.ocr
手动备份一份OLR信息
[root@rac02 rac-cluster]# $GRID_HOME/bin/ocrconfig -local -manualbackup
rac02 2022/08/10 14:56:13 /u01/app/11.2.0/grid/cdata/rac02/backup_20220810_145613.olr
rac02 2022/05/22 17:02:36 /u01/app/11.2.0/grid/cdata/rac02/backup_20220522_170236.olr
1.2 DBCA删除数据库实例
1.2.1 DBCA删除实例
1,在节点1以oracle用户运行dbca
在下方选项框中选择要剔除的节点
1.3 从RAC层面删除节点
1,停止listener
[grid@rac04 ~]$ srvctl disable listener -l LISTENER -n rac04
[grid@rac04 ~]$ srvctl stop listener -l LISTENER -n rac04
2,在节点rac04更新inventory
[oracle@rac04 ~]$ cd $ORACLE_HOME/oui/bin
[oracle@rac04 bin]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@rac04 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 "CLUSTER_NODES=rac04" -local
3,删除ORACLE HOME,在节点4运行Deinstall
[oracle@rac04 bin]$ $ORACLE_HOME/deinstall/deinstall -local
4,在节点1更新inventory
[oracle@rac01 bin]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@rac01 ~]$ cd $ORACLE_HOME/oui/bin
[oracle@rac01 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 "CLUSTER_NODES=rac01,rac02"
1.4 在GRID层面删除节点
1,查看节点都是unpinned状态
[grid@rac01 ~]$ olsnodes -s -t
rac01 Active Unpinned
rac02 Active Unpinned
rac03 Active Unpinned
rac04 Active Unpinned
[grid@rac01 ~]$
2,在节点3以root用户运行deconfig
[root@rac03 ~]# /u01/app/11.2.0/grid/crs/install/rootcrs.pl -deconfig -deinstall -force
[grid@rac01 ~]$ olsnodes -s -t
rac01 Active Unpinned
rac02 Active Unpinned
[grid@rac01 ~]$
3,在节点1运行,删除节点
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl delete node -n rac04
4,在节点3,4运行,更新inventory
[grid@rac03 ~]$ cd $ORACLE_HOME/oui/bin
[grid@rac03 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/11.2.0/grid "CLUSTER_NODES=RAC03" CRS=TRUE -silent -local
5,删除GRID_HOME,在节点3运行Deinstall 在提示运行脚本的地方另开窗口运行相应脚本。按照脚本提示的命令删除相应文件。
[grid@rac03 bin]$ $ORACLE_HOME/deinstall/deinstall -local
6,在保留节点运行,更新inventory
[grid@rac01 ~]$ cd $ORACLE_HOME/oui/bin
[grid@rac01 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/11.2.0/grid "CLUSTER_NODES={rac01,rac02}" CRS=TRUE -silent
[grid@rac01 bin]$ /u01/app/11.2.0/grid/OPatch/opatch lsinventory
7,CVU检查节点删除是否成功
[grid@rac01 bin]$ cluvfy stage -post nodedel -n rac03 -verbose
至此,节点删除完毕。
参考文档
How to Add Node/Instance or Remove Node/Instance with Oracle Clusterware and RAC (Doc ID 1332451.1)