使用导出,导入进行备份和恢复
Oracle推荐在对集群做调整时,比如增加,删除节点之前,应该对OCR做一个备份,可以使用export备份到指定文件,如果做了replace或者restore等操作,Oracle建议使用cluvfy comp ocr -n all命令来做一次全面的检查。该命令在clusterware的安装软件里。
1) 首先关闭所有节点的CRS
[root@rac1 bin]#./crsctl stop crs
2) 用root用户导出OCR内容
[root@rac1 bin]# ./ocrconfig -export /u01/ocr.exp
[root@rac2 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
You have new mail in /var/spool/mail/root
[root@rac2 ~]# pwd
/root
[root@rac2 ~]# ocrconfig -export /opt/oracle/otk/home/oracle/product/10.2.0/crs/cdata/crs/ocr.exp
3) 重启CRS
[root@rac1 bin]# ./crsctl start crs
4) 检查CRS状态
[root@rac1 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
5)破坏OCR内容
[root@rac1 bin]# dd if=/dev/zero of=/dev/raw/rac1 bs=1024 count=102400
102400+0 records in
102400+0 records out
6) 检查OCR一致性
[root@rac1 bin]# ./ocrcheck
PROT-601: Failed to initialize ocrcheck
7)使用cluvfy工具检查一致性
[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.
Verification cannot proceed.
8) 使用Import恢复OCR内容
[root@rac1 bin]# ./ocrconfig -import /opt/oracle/otk/home/oracle/product/10.2.0/crs/cdata/crs/ocr.exp
9)再次检查OCR
[root@rac1 bin]# ./ocrcheck
10) 使用cluvfy工具检查
[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all