Oracle推薦在對集群調整時,比如增加、刪除節點之前,應對OCR進行備份,可以用export備份到指定文件。如果做了replace或者restore等操作,Oracle建議使用cluvfy comp ocr -n all命令做一個全面的檢查。
在oracle用戶下執行:
[oracle@felix1 bin]$ cluvfy comp ocr -n all
Verifying OCR integrity
Checking OCR integrity...
Checking the absence of a non-clusteredconfiguration...
All nodes free of non-clustered, local-onlyconfigurations.
Uniqueness check for OCR device passed.
Checking the version of OCR...
OCR of correct Version "2" exists.
Checking data integrity of OCR...
Data integrity check for OCR passed.
OCR integrity check passed.
Verification of OCR integrity was successful.
[oracle@felix1 bin]$
(1)關閉所有節點的crs
[root@felix1 bin]# ./crsctl stop crs
Stopping resources. This could take severalminutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@felix1 bin]#
[root@felix2 bin]# ./crsctl stop crs
Stopping resources. This could take severalminutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@felix2 bin]#
(2)導出OCR內容
cd $CRS_HOME/bin
(注意需要在root用戶下執行)
[root@felix1 bin]# ./ocrconfig -export ocr_exp.exp
(3)啟動CRS
[root@felix2 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@felix1 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
(4)檢查CRS狀態
[root@felix2 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[root@felix2 bin]#
(5)破壞OCP內容
[root@felix2 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 521836
Used space (kbytes) : 3852
Available space (kbytes) : 517984
ID : 383273474
Device/File Name : /dev/raw/raw1
Device/Fileintegrity check succeeded
Device/Filenot configured
Cluster registry integrity check succeeded
[root@felix2 bin]#
[root@felix2 bin]# ddif=/dev/zero of=/dev/raw/raw1 bs=1024 count=102400
102400+0 records in
102400+0 records out
104857600 bytes (105 MB) copied, 143.294 seconds,732 kB/s
[root@felix2 bin]#
(6)檢查OCR一致性
[root@felix1 bin]# ./ocrcheck
PROT-601: Failed to initialize ocrcheck
[root@felix1 bin]#
檢查失敗
(7)使用cluvfy工具檢查一致性
[oracle@felix1 bin]$ ./cluvfy comp ocr -n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracleclusterware.
Verification cannot proceed.
[oracle@felix1 bin]$
檢查同樣失敗
(8)使用import恢復OCR內容
[root@felix1 bin]# ./ocrconfig -import/u01/oracle/ocr_exp.exp
PROT-19: Cannot proceed while clusterware isrunning. Shutdown clusterware first
[root@felix1 bin]#
需要停止cluster
[root@felix1 bin]# ./crsctl stop crs
OCR initialization failed with invalid format:PROC-22: The OCR backend has an invalid format
[root@felix1 bin]#
重啟OS:
Reboot
重啟之後:
[root@felix1 bin]# ps -ef| grep d.bin
root 3852 2532 0 08:30 pts/1 00:00:00 grep d.bin
[root@felix1 bin]# ./ocrconfig -import/u01/oracle/ocr_exp.exp
[root@felix1 bin]# ps -ef| grep d.bin
oracle 4090 4089 1 08:32 ? 00:00:00/u01/oracle/10.2.0/crs_1/bin/evmd.bin
root 4260 3061 3 08:32 ? 00:00:00/u01/oracle/10.2.0/crs_1/bin/crsd.bin reboot
root 4693 4267 0 08:32 ? 00:00:00 /u01/oracle/10.2.0/crs_1/bin/oprocd.binrun -t 1000 -m 500 -f
root 4737 2532 0 08:32 pts/1 00:00:00 grep d.bin
[root@felix1 bin]#
啟動crs然後檢查crs資源狀態:
[root@felix2 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.felix.db application ONLINE ONLINE felix1
ora....x1.inst application ONLINE ONLINE felix1
ora....x2.inst application ONLINE ONLINE felix2
ora....SM1.asm application ONLINE ONLINE felix1
ora....X1.lsnr application ONLINE ONLINE felix1
ora.felix1.gsd application ONLINE ONLINE felix1
ora.felix1.ons application ONLINE ONLINE felix1
ora.felix1.vip application ONLINE ONLINE felix1
ora....SM2.asm application ONLINE ONLINE felix2
ora....X2.lsnr application ONLINE ONLINE felix2
ora.felix2.gsd application ONLINE ONLINE felix2
ora.felix2.ons application ONLINE ONLINE felix2
ora.felix2.vip application ONLINE ONLINE felix2
[root@felix2 bin]#
資源全部是ok的。
(9)再次檢查OCR狀態
[root@felix2 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 521836
Used space (kbytes) : 3852
Available space (kbytes) : 517984
ID :1105086789
Device/File Name :/dev/raw/raw1
Device/Fileintegrity check succeeded
Device/Filenot configured
Cluster registry integrity check succeeded
[root@felix2 bin]#
(11)通過cluvfy工具檢查
[oracle@felix2 bin]$ ./cluvfy comp crs -n all
Verifying CRS integrity
Checking CRS integrity...
Checking daemon liveness...
Liveness check passed for "CRS daemon".
Checking daemon liveness...
Liveness check passed for "CSS daemon".
Checking daemon liveness...
Liveness check passed for "EVM daemon".
Checking CRS health...
CRS health check passed.
CRS integrity check passed.
Verification of CRS integrity was successful.
[oracle@felix2 bin]$
(12)檢查crs
[oracle@felix2 bin]$ ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[oracle@felix2 bin]$
【參考於大話RAC--張曉明】