1. 程式人生 > 實用技巧 >RAC 刪除節點

RAC 刪除節點

環境:

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 Oracle 主目錄: /oracle/app/oracle/122 Oracle 使用者: oracle Spfile: +DATA/CNCITY/PARAMETERFILE/spfile.309.1056147859 口令檔案: +DATA/CNCITY/PASSWORD/pwdcncity.282.1056147407 域: inno.com 啟動選項: open 停止選項: immediate 資料庫角色: PRIMARY 管理策略: AUTOMATIC 伺服器池: 磁碟組: DATA 裝載點路徑: 服務: city 型別: RAC 啟動並行: 停止並行: OSDBA 組: dba OSOPER 組: dba 資料庫例項: cncity1,cncity2,cncity3
已配置的節點: gzcity,nycity,hzcity
CSS 關鍵型: no CPU 計數:
0 記憶體目標: 0 最大記憶體: 0 資料庫服務的預設網路編號: 資料庫是管理員管理的

目標:  刪除節點為 hzcity

思路:

 刪除例項-->刪除oracle軟體-->刪除GI軟體--> 刪除節點後驗證

備份先行,在節點cncity上做備份

ocrconfig -manualbackup   --備份
ocrconfig -manualbackup   --備份

停節點hzcity的例項

srvctl stop instance -d cncity -n hzcity -f
srvctl relocate server 
-n hzcity -g free

DBCA刪除instance(節點1上執行)

[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"

再次確認

[root@gzcity ~]# srvctl status database -d cncity
例項 cncity1 正在節點 gzcity 上執行
例項 cncity2 正在節點 nycity 上執行
[root@gzcity ~]# srvctl config database -d cncity
資料庫唯一名稱: cncity
資料庫名: cncity
Oracle 主目錄: /oracle/app/oracle/122
Oracle 使用者: oracle
Spfile: +DATA/CNCITY/PARAMETERFILE/spfile.309.1056147859
口令檔案: +DATA/CNCITY/PASSWORD/pwdcncity.282.1056147407
域: inno.com
啟動選項: open
停止選項: immediate
資料庫角色: PRIMARY
管理策略: AUTOMATIC
伺服器池: 
磁碟組: DATA
裝載點路徑: 
服務: city
型別: RAC
啟動並行: 
停止並行: 
OSDBA 組: dba
OSOPER 組: dba
資料庫例項: cncity1,cncity2
已配置的節點: gzcity,nycity
CSS 關鍵型: no
CPU 計數: 0
記憶體目標: 0
最大記憶體: 0
資料庫服務的預設網路編號: 
資料庫是管理員管理的

資料庫例項刪除完成,進行下一步配置,刪除資料庫存軟體,在刪除節點hzcity 上執行,

[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 #############

更新inventory 在保留節點上執行

[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' 成功。

確定被刪除節點hzcity 上的資料庫軟體已經被刪除

[oracle@hzcity deinstall]$ cd $ORACLE_HOME
-bash: cd: /oracle/app/oracle/122: 沒有那個檔案或目錄

下面進行GI刪除,只能在root 使用者下進行

[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

更新節點hzcity的inventory

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 解除安裝工具已成功清除臨時目錄。
#######################################################################

在節點1 gzcity 上更新

[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@gzcity ~]# crsctl delete node -n hzcity
CRS-4661: Node hzcity successfully deleted.

驗證在節點1 gzcity

[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

驗證在節點2 nycity

[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