环境:
cat /etc/redhat-release sqlplus -v olsnodes -n -i -s -t

OS: [root@hzcity ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.6 (Maipo) ORACLE: [oracle@hzcity ~]$ sqlplus -v SQL*Plus: Release 12.2.0.1.0 Production 集群信息 [root@hzcity ~]# olsnodes -n -i -s -t gzcity 1 gzcity-vip.inno.com Active Unpinned nycity 2 nycity-vip.inno.com Active Unpinned hzcity 3 hzcity-vip.inno.com Active Unpinned [root@hzcity ~]# srvctl config database -d cncity 数据库唯一名称: cncity 数据库名: cncity ... 启动选项: open 停止选项: immediate 数据库角色: PRIMARY 管理策略: AUTOMATIC ... 数据库实例: cncity1,cncity2,cncity3 已配置的节点: gzcity,nycity,hzcity
目标: 删除节点为 hzcity
思路:
备份-->停实例-->删除实例-->删除oracle软件-->删除GI软件--> 删除节点后验证
1 备份先行,在节点cncity上做备份
ocrconfig -manualbackup --备份
ocrconfig -manualbackup --备份
2 停节点hzcity的实例
srvctl stop instance -d cncity -n hzcity -f srvctl relocate server -n hzcity -g free
3.删除数据库
DBCA删除instance(节点1上执行) 在oracle用户下
dbca -silent -deleteInstance -nodelist hzcity -gdbname cncity -instanceName cncity3 -sysDBAUserName sys -sysDBAPassword oracle

[root@gzcity ~]# su - oracle 上一次登录:四 11月 12 16:41:17 CST 2020 [oracle@gzcity ~]$ dbca -silent -deleteInstance -nodelist hzcity -gdbname cncity -instanceName cncity3 -sysDBAUserName sys -sysDBAPassword oracle 正在删除实例 1%已完成 2%已完成 6%已完成 13%已完成 20%已完成 26%已完成 33%已完成 40%已完成 46%已完成 53%已完成 60%已完成 66%已完成 正在进行实例管理。 100%已完成 有关详细信息, 请参阅日志文件 "/oracle/app/oracle/cfgtoollogs/dbca/cncity.log"。
确认日志

[oracle@gzcity ~]$ tail -n 5 /oracle/app/oracle/cfgtoollogs/dbca/cncity.log DBCA_PROGRESS : 60% DBCA_PROGRESS : 66% [ 2020-11-12 17:58:18.066 CST ] 正在进行实例管理。 DBCA_PROGRESS : 100% [ 2020-11-12 17:58:18.978 CST ] 已成功从节点 "hzcity" 中删除实例 "cncity3"。
再次确认
srvctl status database -d cncity
srvctl config database -d cncity

[root@gzcity ~]# srvctl status database -d cncity 实例 cncity1 正在节点 gzcity 上运行 实例 cncity2 正在节点 nycity 上运行 [root@gzcity ~]# srvctl config database -d cncity 数据库唯一名称: cncity 数据库名: cncity ... 启动选项: open 停止选项: immediate 数据库角色: PRIMARY 管理策略: AUTOMATIC ... 数据库实例: cncity1,cncity2 已配置的节点: gzcity,nycity
4. 删除数据库软件
4.1数据库实例删除完成,进行下一步配置,删除数据库存软件,在删除节点hzcity 上执行,在oracle用户下
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=hzcity" -local $ORACLE_HOME/deinstall/deinstall -local

[root@hzcity ~]# su - oracle 上一次登录:四 11月 12 17:58:42 CST 2020 [oracle@hzcity ~]$ cd $ORACLE_HOME/oui/bin [oracle@hzcity bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=hzcity" -local 正在启动 Oracle Universal Installer... 检查交换空间: 必须大于 500 MB。 实际为 7383 MB 通过 The inventory pointer is located at /etc/oraInst.loc 'UpdateNodeList' 成功。 [oracle@hzcity bin]$ $ORACLE_HOME/deinstall/deinstall -local Checking for required files and bootstrapping ... Please wait ... 日志的位置 /oracle/app/oraInventory/logs/ ############ ORACLE DECONFIG TOOL START ############ ######################### DECONFIG CHECK OPERATION START ######################### ## [开始] 安装检查配置 ## 检查 Oracle 主目录位置是否存在 /oracle/app/oracle/122 选定进行卸载的 Oracle 主目录类型为:Oracle Real Application Cluster 数据库 选定进行卸载的 Oracle 基目录为:/oracle/app/oracle 检查主产品清单位置是否存在 /oracle/app/oraInventory 检查 Oracle Grid Infrastructure 主目录是否存在 /oracle/app/122/grid 以下节点属于此集群: hzcity,gzcity,nycity 正在检查以下节点上是否有足够的临时空间可用: 'hzcity' ## [结束] 安装检查配置 ## 网络配置检查配置开始 网络取消配置跟踪文件位置: /oracle/app/oraInventory/logs/netdc_check2020-11-12_06-07-55-PM.log 网络配置检查配置结束 数据库检查配置开始 数据库取消配置跟踪文件位置: /oracle/app/oraInventory/logs/databasedc_check2020-11-12_06-08-01-PM.log 指定值列表作为输入时使用逗号作为分隔符 指定在此节点上为此 Oracle 主目录本地配置的数据库名称的列表。将删除搜索到的数据库的本地配置 []: cncity 数据库检查配置结束 Oracle Configuration Manager check START OCM 检查日志文件位置: /oracle/app/oraInventory/logs//ocm_check7461.log Oracle Configuration Manager check END ######################### DECONFIG CHECK OPERATION END ######################### ####################### DECONFIG CHECK OPERATION SUMMARY ####################### Oracle Grid Infrastructure 主目录为: /oracle/app/122/grid 以下节点属于此集群: hzcity,gzcity,nycity 将执行 Oracle 主目录卸载的集群节点为:hzcity 选定进行卸载的 Oracle 主目录为:/oracle/app/oracle/122 Oracle 主目录注册到的产品清单位置为: /oracle/app/oraInventory 选项 -local 将不修改此 Oracle 主目录的任何数据库配置。 检查 CCR 的配置状态 Oracle 主目录已存在且具有 CCR 目录, 但 CCR 未配置 CCR 检查已完成 是否要继续 (是 - 是, 否 - 否)? [否]: 是 此会话的日志将写入: '/oracle/app/oraInventory/logs/deinstall_deconfig2020-11-12_06-07-52-PM.out' 此会话的任何错误消息都将写入: '/oracle/app/oraInventory/logs/deinstall_deconfig2020-11-12_06-07-52-PM.err' ######################## DECONFIG CLEAN OPERATION START ######################## 数据库取消配置跟踪文件位置: /oracle/app/oraInventory/logs/databasedc_clean2020-11-12_06-09-27-PM.log 网络配置清除配置开始 网络取消配置跟踪文件位置: /oracle/app/oraInventory/logs/netdc_clean2020-11-12_06-09-27-PM.log 网络配置清除配置结束 Oracle Configuration Manager clean START OCM 清理日志文件位置: /oracle/app/oraInventory/logs//ocm_clean7461.log Oracle Configuration Manager clean END ######################### DECONFIG CLEAN OPERATION END ######################### ####################### DECONFIG CLEAN OPERATION SUMMARY ####################### 清理 CCR 的配置 由于 CCR 未配置, 因此跳过清理 CCR 配置 CCR 清理已完成 ####################################################################### ############# ORACLE DECONFIG TOOL END ############# 使用属性文件 /tmp/deinstall2020-11-12_06-07-19PM/response/deinstall_2020-11-12_06-07-52-PM.rsp 日志的位置 /oracle/app/oraInventory/logs/ ############ ORACLE DEINSTALL TOOL START ############ ####################### DEINSTALL CHECK OPERATION SUMMARY ####################### 此会话的日志将写入: '/oracle/app/oraInventory/logs/deinstall_deconfig2020-11-12_06-07-52-PM.out' 此会话的任何错误消息都将写入: '/oracle/app/oraInventory/logs/deinstall_deconfig2020-11-12_06-07-52-PM.err' ######################## DEINSTALL CLEAN OPERATION START ######################## ## [开始] 准备卸载 ## 将 LOCAL_NODE 设置为 hzcity 将 CLUSTER_NODES 设置为 hzcity 将 CRS_HOME 设置为 false 将 oracle.installer.invPtrLoc 设置为 /tmp/deinstall2020-11-12_06-07-19PM/oraInst.loc 将 oracle.installer.local 设置为 true ## [结束] 准备卸载 ## Setting the force flag to false Setting the force flag to cleanup the Oracle Base Oracle Universal Installer 清除开始 从本地节点上的主产品清单中分离 Oracle 主目录 '/oracle/app/oracle/122' : 完成 删除本地节点上的目录 '/oracle/app/oracle/122' : 完成 将不会删除本地节点上的 Oracle 基目录 '/oracle/app/oracle'。该目录不为空。 Oracle Universal Installer 清除成功。 Oracle Universal Installer 清除结束 ## [开始] Oracle 安装清除 ## ## [结束] Oracle 安装清除 ## ######################### DEINSTALL CLEAN OPERATION END ######################### ####################### DEINSTALL CLEAN OPERATION SUMMARY ####################### 已成功地从本地节点上的主产品清单中分离 Oracle 主目录 '/oracle/app/oracle/122'。 已成功地删除本地节点上的目录 '/oracle/app/oracle/122'。 Oracle Universal Installer 清除成功。 复查节点 'hzcity' 上的 '/oracle/app/oracle' 的权限和内容。 如果没有 Oracle 主目录与 '/oracle/app/oracle' 相关联, 请手动删除 '/oracle/app/oracle' 及其内容。 Oracle 卸载工具已成功清除临时目录。 ####################################################################### ############# ORACLE DEINSTALL TOOL END #############
4.2更新inventory 在节点1, gzcity上执行,在oralce 用户下
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={gzcity,nycity}"

[root@gzcity ~]# su - oracle 上一次登录:四 11月 12 18:05:50 CST 2020 [oracle@gzcity ~]$ cd $ORACLE_HOME/oui/bin [oracle@gzcity bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={gzcity,nycity}" 正在启动 Oracle Universal Installer... 检查交换空间: 必须大于 500 MB。 实际为 5332 MB 通过 The inventory pointer is located at /etc/oraInst.loc 'UpdateNodeList' 成功。
4.3确定被删除节点hzcity 上的数据库软件已经被删除

[oracle@hzcity deinstall]$ cd $ORACLE_HOME -bash: cd: /oracle/app/oracle/122: 没有那个文件或目录
5.GI删除
5.1 下面进行GI删除,只能在root 用户下进行
Env.pm文件缺失 cp -p /oracle/app/122/grid/perl/lib/5.22.0/Env.pm /usr/lib64/perl5/vendor_perl/ /oracle/app/122/grid/perl rootcrs.pl -deconfig -force

[root@hzcity ~]# su - grid 上一次登录:四 11月 12 18:21:31 CST 2020pts/1 上 [grid@hzcity ~]$ export GRID_HOME=$ORACLE_HOME [grid@hzcity ~]$ cd $GRID_HOME/crs/install [grid@hzcity install]$ perl rootcrs.pl -deconfig -force Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . . ./../../perl/lib) at crsinstall.pm line 286. BEGIN failed--compilation aborted at crsinstall.pm line 286. Compilation failed in require at rootcrs.pl line 165. BEGIN failed--compilation aborted at rootcrs.pl line 165. [grid@hzcity install]$ exit 登出 [root@hzcity ~]# cp -p /oracle/app/122/grid/perl/lib/5.22.0/Env.pm /usr/lib64/perl5/vendor_perl/ [root@hzcity ~]# su - grid 上一次登录:四 11月 12 18:23:26 CST 2020pts/1 上 [grid@hzcity ~]$ export GRID_HOME=$ORACLE_HOME [grid@hzcity ~]$ cd $GRID_HOME/crs/install [grid@hzcity install]$ perl rootcrs.pl -deconfig -force Using configuration parameter file: ./crsconfig_params The log of current session can be found at: /oracle/app/grid/crsdata/hzcity/crsconfig/crsdeconfig_hzcity_2020-11-12_06-30-00PM.log Insufficient privileges to execute this script.Cause: The root script was not run by root user with its name being 'root' or UID being 0. Action: Make sure the root username is 'root' with UID 0 and rerun the script as the root user.[grid@hzcity install]$
再次执行

[root@hzcity ~]# export GRID_HOME=/oracle/app/122/grid/ [root@hzcity ~]# cd $GRID_HOME/crs/install [root@hzcity install]# perl rootcrs.pl -deconfig -force Using configuration parameter file: ./crsconfig_params The log of current session can be found at: /oracle/app/grid/crsdata/hzcity/crsconfig/crsdeconfig_hzcity_2020-11-12_06-32-10PM.log CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'hzcity' CRS-2673: Attempting to stop 'ora.crsd' on 'hzcity' CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on server 'hzcity' CRS-2673: Attempting to stop 'ora.DATA.dg' on 'hzcity' CRS-2673: Attempting to stop 'ora.chad' on 'hzcity' CRS-2677: Stop of 'ora.DATA.dg' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.asm' on 'hzcity' CRS-2677: Stop of 'ora.asm' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'hzcity' CRS-2677: Stop of 'ora.chad' on 'hzcity' succeeded CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'hzcity' succeeded CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'hzcity' has completed CRS-2677: Stop of 'ora.crsd' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.storage' on 'hzcity' CRS-2673: Attempting to stop 'ora.crf' on 'hzcity' CRS-2673: Attempting to stop 'ora.gpnpd' on 'hzcity' CRS-2673: Attempting to stop 'ora.mdnsd' on 'hzcity' CRS-2677: Stop of 'ora.crf' on 'hzcity' succeeded CRS-2677: Stop of 'ora.gpnpd' on 'hzcity' succeeded CRS-2677: Stop of 'ora.storage' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.asm' on 'hzcity' CRS-2677: Stop of 'ora.mdnsd' on 'hzcity' succeeded CRS-2677: Stop of 'ora.asm' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'hzcity' CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.ctssd' on 'hzcity' CRS-2673: Attempting to stop 'ora.evmd' on 'hzcity' CRS-2677: Stop of 'ora.ctssd' on 'hzcity' succeeded CRS-2677: Stop of 'ora.evmd' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.cssd' on 'hzcity' CRS-2677: Stop of 'ora.cssd' on 'hzcity' succeeded CRS-2673: Attempting to stop 'ora.gipcd' on 'hzcity' CRS-2677: Stop of 'ora.gipcd' on 'hzcity' succeeded CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'hzcity' has completed CRS-4133: Oracle High Availability Services has been stopped. 2020/11/12 18:33:07 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector. 2020/11/12 18:33:07 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector. 2020/11/12 18:33:09 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node
5.2 更新节点hzcity的inventory。 在grid 用户下
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=cncity" CRS=TRUE -silent -local $ORACLE_HOME/deinstall/deinstall -local

su - grid cd $ORACLE_HOME/oui/bin ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=cncity" CRS=TRUE -silent -local $ORACLE_HOME/deinstall/deinstall -local --删除GI软件 ####################### DEINSTALL CLEAN OPERATION SUMMARY ####################### 已成功地从本地节点上的主产品清单中分离 Oracle 主目录 '/oracle/app/122/grid'。 无法删除本地节点上的目录 '/oracle/app/122/grid'。 已成功地删除本地节点上的目录 '/oracle/app/oraInventory'。 Oracle Universal Installer 清除成功。 当会话结束时在节点 'hzcity' 上以 root 用户身份运行 'rm -r /etc/oraInst.loc'。 当会话结束时在节点 'hzcity' 上以 root 身份运行 'rm -r /opt/ORCLfmap'。 当会话结束时在节点 'hzcity' 上以 root 身份运行 'rm -r /etc/oratab'。 复查节点 'hzcity' 上的 '/oracle/app/grid' 的权限和内容。 如果没有 Oracle 主目录与 '/oracle/app/grid' 相关联, 请手动删除 '/oracle/app/grid' 及其内容。 Oracle 卸载工具已成功清除临时目录。 #######################################################################
5.3 GI在节点1 gzcity 上更新,在grid 用户下
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={gzcity,nycity}" CRS=TRUE -slient

[root@gzcity ~]# su - grid 上一次登录:四 11月 12 18:46:57 CST 2020 [grid@gzcity ~]$ cd $ORACLE_HOME/oui/bin [grid@gzcity bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={gzcity,nycity}" CRS=TRUE -slient 正在启动 Oracle Universal Installer... 检查交换空间: 必须大于 500 MB。 实际为 5290 MB 通过 The inventory pointer is located at /etc/oraInst.loc 'UpdateNodeList' 成功。
最终在节点1 上gzcity ,在root 下
crsctl delete node -n hzcity

[root@gzcity ~]# crsctl delete node -n hzcity CRS-4661: Node hzcity successfully deleted.
6. 验证在节点 gzcity 和nycity
olsnodes -s -t
cluvfy stage -post nodedel -n hzcity -verbose

[root@gzcity ~]# olsnodes -s -t gzcity Active Unpinned nycity Active Unpinned [root@gzcity ~]# cluvfy stage -post nodedel -n hzcity -verbose You must NOT be logged in as root (uid=0) when running /oracle/app/122/grid/bin/cluvfy. [root@gzcity ~]# su - grid 上一次登录:四 11月 12 19:02:02 CST 2020 [grid@gzcity ~]$ cluvfy stage -post nodedel -n hzcity -verbose 正在验证删除节点... 正在验证CRS 完整性...通过 正在验证集群件版本一致性...通过 正在验证删除节点...通过 删除节点 的后期检查成功。 CVU 操作已执行: stage -post nodedel 日期: 2020-11-12 19:03:50 CVU 主目录: /oracle/app/122/grid/ 用户: grid [grid@nycity ~]$ cluvfy stage -post nodedel -n hzcity -verbose 正在验证删除节点... 正在验证CRS 完整性...通过 正在验证集群件版本一致性...通过 正在验证删除节点...通过 删除节点 的后期检查成功。 CVU 操作已执行: stage -post nodedel 日期: 2020-11-12 19:04:28 CVU 主目录: /oracle/app/122/grid/ 用户: grid
附注,节点3 上有以下文件残留

rm -rf /etc/rc5.d/S97rhnsd rm -rf /etc/rc3.d/S97rhnsd rm -rf /etc/oracle rm -rf /etc/ora* rm -rf /oracle/app/oracle/admin rm -rf /oracle/app/122/grid/* rm -rf /oracle/app/grid/* rm -rf /usr/local/{db*,ora*}