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]# dd if=/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--张晓明】