ORACLE RAC重建OCR

dayong2015發表於2014-05-11
from:http://blog.sina.com.cn/s/blog_5d3da3280100nhvq.html
OCR 對RAC 來說是非常重要的。 OCR記錄節點成員的配置資訊,如database、ASM、instance、listener、VIP等CRS資源的配置資訊。在日常維護中需要對它進行備份。當然OCR 也會自動備份。 當OCR 出現問題時,有備份的話就使用備份來恢復。 當沒有備份的話就只能重建了。
重建OCR操作如下:
1.停止所有節點的CRS
 [root@rac02 bin]# pwd
/u01/app/oracle/db_1/bin
[root@rac02 bin]# ./crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac01 ~]# cd /u01/app/oracle/db_1/bin
[root@rac01 bin]# ./crsctl stop crs
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2.備份每個節點的Clusterware Home
[oracle@rac01 ~]$ echo $CRS_HOME
/u01/app/oracle/crs
[root@rac01 oracle]# cp -R crs crs.bak
[root@rac01 oracle]# ls
admin  crs  crs.bak  db_1  oraInventory

[root@rac02 oracle]# ls
admin  crs  db_1  oraInventory
[root@rac02 oracle]# cp -R crs crs.bak
[root@rac02 oracle]# ls
admin  crs  crs.bak  db_1  oraInventory
3.在所有節點執行/install/rootdelete.sh 命令
 [root@rac01 install]# pwd
/u01/app/oracle/crs/install
[root@rac01 install]# ./rootdelete.sh
Shutting down Oracle Cluster Ready Services (CRS):
Stopping CSSD.
Unable to communicate with the CSS daemon.
Shutdown has begun. The daemons should exit soon.
Checking to see if Oracle CRS stack is down...
Oracle CRS stack is not running.
Oracle CRS stack is down now.
Removing script for Oracle Cluster Ready services
Updating ocr file for downgrade
Cleaning up SCR settings in '/etc/oracle/scls_scr'
[root@rac02 install]# ./rootdelete.sh
4.在執行安裝的節點執行/install/rootdeinstall.sh命令

因為我是在rac01節點上執行安裝的,所以也在該節點執行該命令,只需要在該節點執行就可以了。

[root@rac01 install]# pwd
/u01/app/oracle/crs/install
[root@rac01 install]# ./rootdeinstall.sh

Removing contents from OCR device
2560+0 records in
2560+0 records out
10485760 bytes (10 MB) copied, 0.0216142 seconds, 485 MB/s

 5.檢查CRS程式,如果沒有返回值,繼續下一步

[root@rac01 install]# ps -e | grep -i 'ocs[s]d'
13665 pts/2    00:00:00 ocssd.bin
[root@rac01 install]# ps -e | grep -i 'cr[s]d.bin'
[root@rac01 install]# ps -e | grep -i 'ev[m]d.bin'

 6.在安裝節點(第4步中的節點)執行/root.sh命令

 [root@rac01 crs]# pwd
/u01/app/oracle/crs
[root@rac01 crs]# ./root.sh
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured

Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac01 rac01-priv rac01
node 2: rac02 rac02-priv rac02
clscfg: Arguments check out successfully.

NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within 30 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        rac01
CSS is inactive on these nodes.
        rac02
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.

7.在剩下的節點執行/root.sh命令

[root@rac02 ~]# /u01/app/oracle/crs/root.shWARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured

Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac01 rac01-priv rac01
node 2: rac02 rac02-priv rac02
clscfg: Arguments check out successfully.

NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within 30 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        rac01
        rac02
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps

在 (0) 節點上建立 VIP 應用程式資源.
在 (0) 節點上建立 GSD 應用程式資源.
在 (0) 節點上建立 ONS 應用程式資源.
啟動 (2) 節點上的 VIP 應用程式資源 ...
啟動 (2) 節點上的 GSD 應用程式資源...
啟動 (2) 節點上的 ONS 應用程式資源...


Done.

批註:如果出現若下錯誤
Running vipca(silent) for configuring nodeapps
Error 0(Native: listNetInterfaces:[3]
  [Error 0(Native: listNetInterfaces:[3])]
這裡報錯了。 root.sh 在最後一個節點執行時會呼叫vipca命令。這裡因為網路介面沒有配置好。所以執行失敗了。我們配置一下介面,在Xmanager裡,用root使用者,手工執行vipca命令即可。
[root@rac01 bin]# ./oifcfg getif  -- 沒有返回介面資訊
[root@rac01 bin]# ./oifcfg iflist
[root@rac01 bin]# ./oifcfg setif -global eth0/192.168.10.0:public -- 注意IP 最後是0
[root@rac01 bin]# ./oifcfg setif -global eth1/10.0.0.0:cluster_interconnect   
--此處為cluster_interconnect,不是private
[root@rac01 bin]# ./oifcfg getif     --驗證
eth0  192.168.10.0  global  public
eth1  10.0.0.0  global  cluster_interconnect
配置玩後,隨便在一個節點用root使用者執行一下vipca命令就可以了。 這個是有視窗的。 需要X 支援。所有用X manager。 其他工具也可以。 能執行就可以了。 執行完後nodeapps的VIP,ONS,GSD就建立完成了。
[root@rac01 bin]# ./crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac01
ora....01.lsnr application    ONLINE    ONLINE    rac01
ora.rac01.gsd  application    ONLINE    ONLINE    rac01
ora.rac01.ons  application    ONLINE    ONLINE    rac01
ora.rac01.vip  application    ONLINE    ONLINE    rac01
ora....SM2.asm application    ONLINE    ONLINE    rac02
ora....02.lsnr application    ONLINE    ONLINE    rac02
ora.rac02.gsd  application    ONLINE    ONLINE    rac02
ora.rac02.ons  application    ONLINE    ONLINE    rac02
ora.rac02.vip  application    ONLINE    ONLINE    rac02
[root@rac01 bin]# pwd
/u01/app/oracle/crs/bin

重建結束;


 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29634949/viewspace-1158549/,如需轉載,請註明出處,否則將追究法律責任。

相關文章