百度搜尋,會很多文章關于如何添加删除節點的,而且這個操作也沒有什麼很多的技術含量,但是自己測試過,記錄一下,以備後續查詢,同時也希望能給需要的朋友一些幫助.
環境介紹
環境為兩個節點RAC:racnode1和racnode2
測試過程是删除racnode1
oracle版本為11.2.0.1
---- racnode1上操作 -----
首先,要禁用和停止監聽,然後查詢确認操作已經成功
[grid@racnode1 ~]$ srvctl disable listener -n racnode1
[grid@racnode1 ~]$ srvctl stop listener -n racnode1
[grid@racnode1 ~]$ crsctl status res -t
ora.LISTENER.lsnr
OFFLINE OFFLINE racnode1
ONLINE ONLINE racnode2
ora.LISTENER_2.lsnr
--------------------------------------------------------------------------------
進入到GI目錄,去删除OCR中的該資料庫的資訊(這個操作可以在任何一個運作的節點上執行)
[grid@racnode1 ~]$ cd $ORACLE_HOME/oui/bin
[grid@racnode1 bin]$ pwd
/u01/app/11.2.0/grid/oui/bin
[grid@racnode1 bin]$ ./runInstaller -updateNodelist ORACLE_HOME=/u01/app/11.2.0/grid/oui/bin "CLUSTER_NODES=racnode2" <<<<<注:這裡需要填寫希望保留下來的節點,如果有多個節點,除了需要删除的節點,其他節點都要寫上并用“,”隔開
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 2353 MB Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
/u01/app/oraInventory/ContentsXML
[grid@racnode1 bin]$ olsnodes -s -t
racnode1 Active Unpinned
racnode2 Active Unpinned
停止并删除VIP
[root@racnode1 bin]# srvctl stop vip -i racnode1-vip
[root@racnode1 bin]# crsctl status res -t
ora.racnode1.vip
1 OFFLINE OFFLINE
ora.racnode2.vip
1 ONLINE ONLINE racnode2
ora.scan1.vip
1 ONLINE ONLINE racnode1
[root@racnode1 bin]# srvctl remove vip -i racnode1-vip
Please confirm that you intend to remove the VIPs racnode1-vip (y/[n]) y
ora.LISTENER_SCAN1.lsnr
ora.hd.db
1 ONLINE ONLINE racnode1 Open
2 ONLINE ONLINE racnode2 Open
ora.oc4j
1 ONLINE ONLINE racnode1
删除節點
首先停止CRS,不然會報如下錯誤:
[root@racnode1 bin]# crsctl delete node -n racnode1
CRS-4658: The clusterware stack on node racnode1 is not completely down.
CRS-4000: Command Delete failed, or completed with errors.
[root@racnode1 bin]# crsctl stop crs
執行rootcrs.pl腳本
[root@racnode1 grid]# cd /u01/app/11.2.0/grid/crs/install/
[root@racnode1 install]# ./rootcrs.pl -deconfig -force
Successfully deconfigured Oracle clusterware stack on this node
如果沒有執行rootcrs.pl腳本
CRS is already configured on this node for crshome=0
Cannot configure two CRS instances on the same cluster.
Please deconfigure before proceeding with the configuration of new home.
------ racnode2 上操作---------
cd /u01/app/11.2.0/grid/oui/bin
runInstaller -updateNodeList ORACLE_HOME=/u01/app/11.2.0/grid CLUSTER_NODES={racnode2} CRS=TRUE
[grid@racnode2 bin]$ crsctl status res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.DG_CRS.dg
ora.DG_DATA.dg
ora.DG_FRA.dg
ONLINE INTERMEDIATE racnode2
ora.asm
ONLINE ONLINE racnode2 Started
ora.eons
ora.gsd
OFFLINE OFFLINE racnode2
ora.net1.network
ora.ons
ora.registry.acfs
Cluster Resources
1 ONLINE OFFLINE
1 ONLINE ONLINE racnode2
增加節點到叢集的方法
如果是完全空白的機器,執行以下指令會從别的節點拷貝全部的GI和DB的軟體,然後完成注冊OCR等操作。
./addNode.sh -silent "CLUSTER_NEW_NODES={racnode1} CLUSTER_NEW_PRIVATE_NODE_NAMES={racnode1-priv} CLUSTER_NEW_VIRTUAL_HOSTNAMES={racnode1-vip}"
如果這個節點上已經有GI和DB的軟體,就不需要再copy一遍了,可以通過下面的指令直接添加節點,這樣是很快的,也就是更改一下OCR,同僚啟動一下執行個體就OK了。
./addNode.sh -noCopy "CLUSTER_NEW_NODES={racnode1} CLUSTER_NEW_VIRTUAL_HOSTNAMES={racnode1-vip}"
在需要添加的節點上運作root.sh腳本,完成最後的添加
runInstaller -updateNodeList ORACLE_HOME=/u01/app/11.2.0/grid CLUSTER_NODES={racnode1,racnode2} CRS=TRUE
[root@racnode1 grid]# cd /u01/app/11.2.0/grid/crs/install/
到此,删除添加都完成了,步驟不多也比較簡單。
本文轉自 hsbxxl 51CTO部落格,原文連結:http://blog.51cto.com/hsbxxl/1060066,如需轉載請自行聯系原作者