Oracle RAC ocr进行备份和恢复的一次错误操作(没关闭所有节点)

        在看张晓明大师的《大话RAC》OCR命令部分的时候,由于自己眼拙,不细心的缘故,所有两个节点中,我只关闭了其中一个,就进行export,还有dd裸设备,所以备份恢复出现了错误!!深刻教训,后来成功恢复了,所以记录之。此记录不是规范的OCR备份恢复操作,规范的请详见张大师的《大话RAC》著作。

redhat 5.5 +oracle 10.2.0.1.0 

错误如下提示:

[root@rac1 ~]# /oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all

验证 OCR 完整性 

ERROR: 
等同用户在所有节点上都不可用。
验证无法继续。

在所有节点上验证 OCR 完整性 失败。


      ORACLE推荐在对集群作调整时,比如增加、删除节点之前,应该对OCR做一个备份,可以使用export备份到指定文件。如果做了replace或restore等操作,Oracle建议使用“cluvfy comp ocr -n all"命令做一次全面的检查。

       (1)首先关闭所有节点的CRS

          ......

         .......

                                                                                                                                                                                                                       -----引自张晓明 《大话RAC》


        原因:由于只关闭一节点进行导出备份,两个节点不同步致错。

错误重现:

1、停止节点1的CRS资源

[root@rac1 ~]# /oracle/product/crs/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

2、导出OCR内容

[root@rac1 ~]# /oracle/product/crs/bin/ocrconfig -export /oracle/ocr.exp
[root@rac1 ~]# /oracle/product/crs/bin/crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly

一定要root用户

3、启动节点1的CRS资源

[root@rac1 ~]# /oracle/product/crs/bin/crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly

4、检查CRS状态

[root@rac1 ~]# /oracle/product/crs/bin/crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

(耐心稍等片刻 CRS进程才会起来)

5、破坏OCR内容

[root@rac1 ~]# 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, 10.2297 seconds, 10.3 MB/s

6、检查OCR一致性

[root@rac1 ~]# /oracle/product/crs/bin/ocrcheck
PROT-601: Failed to initialize ocrcheck

显示失败

7、使用cluvfy工具检查一致性

[root@rac1 ~]# /oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all
验证 OCR 完整性 
无法从 Oracle 集群件中检索节点列表。
验证无法继续。

8、使用import恢复OCR内容

[root@rac1 ~]# /oracle/product/crs/bin/ocrconfig -import /oracle/ocr.exp

9、再次检查OCR

[root@rac1 ~]# /oracle/product/crs/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     497928
         Used space (kbytes)      :       3800
         Available space (kbytes) :     494128
         ID                       : 1324903426
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded


                                    Device/File not configured


         Cluster registry integrity check succeeded

检查通过

10、用cluvfy工具检查

[root@rac1 ~]# /oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all
验证 OCR 完整性 
ERROR: 
等同用户在所有节点上都不可用。
验证无法继续。
在所有节点上验证 OCR 完整性 失败。

问题出现,原因如上,因为节点2的CRS服务正在启动,所以导出恢复一定要停止所有节点。

解决办法:

1、检查节点1、节点2的CRS资源

[root@rac1 bin]# /oracle/product/crs/bin/crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

[root@rac2 ~]# /oracle/product/crs/bin/crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
2、停止1、2正在运行的CRS资源

[root@rac2 ~]# /oracle/product/crs/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

3、用dd命令清除掉存放OCR信息的裸设备

[root@rac2 ~]#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, 9.76807 seconds, 10.7 MB/s

4、检查OCR内容

[root@rac2 ~]# /oracle/product/crs/bin/ocrcheck
PROT-601: Failed to initialize ocrcheck

初始化失败

3、先停止CRS资源,然后用import命令执行导入操作

由于上步已停止CRS,所以直接import

[root@rac1 bin]# /oracle/product/crs/bin/ocrconfig -import /oracle/ocr.exp

如果不停止资源就import的话就出现如下错误

[root@rac1 bin]# /oracle/product/crs/bin/ocrconfig -import /oracle/ocr.exp
PROT-19: Cannot proceed while clusterware is running. Shutdown clusterware first
4、检查1、2节点的ocr内容

[root@rac1 bin]# /oracle/product/crs/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     497928
         Used space (kbytes)      :       3800
         Available space (kbytes) :     494128
         ID                       :  774037276
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded
                                    Device/File not configured
         Cluster registry integrity check succeeded

[root@rac2 ~]# /oracle/product/crs/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     497928
         Used space (kbytes)      :       3800
         Available space (kbytes) :     494128
         ID                       : 1472647163
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded


                                    Device/File not configured


         Cluster registry integrity check succeeded

5、节点2下的oracle用户运行cluvfy工具检查

[root@rac2 ~]# su - oracle

[oracle@rac2 cluvfy]$ /oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all

验证 OCR 完整性 
正在检查 OCR 完整性...
正在检查是否缺少非集群配置...
所有节点都没有非集群的, 仅限本地的配置。
OCR 设备的唯一性检查已通过。
正在检查 OCR 的版本...
正确版本 "2" 的 OCR 存在。
正在检查 OCR 数据完整性...
OCR 数据完整性检查已通过。

OCR 完整性检查已通过。
OCR 完整性 的验证成功。

6、切回节点一启动CRS资源,并检查资源状态

[root@rac1 ~]# /oracle/product/crs/bin/crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly
[root@rac1 ~]# /oracle/product/crs/bin/crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

7、在节点1重复第五步

[root@rac1 ~]# su - oracle

[oracle@rac1 cluvfy]$ /oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all

验证 OCR 完整性 
正在检查 OCR 完整性...
正在检查是否缺少非集群配置...
所有节点都没有非集群的, 仅限本地的配置。
OCR 设备的唯一性检查已通过。
正在检查 OCR 的版本...
正确版本 "2" 的 OCR 存在。
正在检查 OCR 数据完整性...
OCR 数据完整性检查已通过。

OCR 完整性检查已通过。
OCR 完整性 的验证成功。

8、启动节点2的CRS资源,并检查状态

[root@rac2 ~]# /oracle/product/crs/bin/crsctl start crs

Attempting to start CRS stack 
The CRS stack will be started shortly

[root@rac2 ~]# /oracle/product/crs/bin/crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
Attempting to start CRS stack 
The CRS stack will be started shortly

个人观点总结:

至此,OCR内容成功恢复,主要是做了replace和restore操作,就要停止所有节点来使用cluvfy工具进行全面检查才能使所有节点进行信息同步,才能成功启动CRS资源。(两个节点一关一闭执行dd raw操作也可能会有错,所以看书得仔细点了!!)

疑问一:节点一第一次在CRS资源启动的时候执行import不报错,而再第二次之后再在CRS资源启动的时候执行import就会出错,

此时Oracle会提示PROT-19: Cannot proceed while clusterware is running. Shutdown clusterware first,有时不必过分纠结原理,根据提示灵活应变即可。

疑问二:如出现以下错误 (背景:使用绝对路径方式停止CRS报错,真是莫名其妙,不知道这两种命令方式有何区别,幸好试了另一种就能停止掉CRS资源,真是坑得一逼)

[root@rac1 ~]# /oracle/product/crs/bin/crsctl stop crs
OCR initialization failed with invalid format: PROC-22: The OCR backend has an invalid format

1、先用工具检查

[oracle@rac1 ~]$ /oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all

2、进入到ORACLE_HOME下 在该目录下使用命令停止

[root@rac1 oracle]# su - oracle
[oracle@rac1 ~]$ su
口令:
[root@rac1 oracle]# pwd
/home/oracle
[root@rac1 oracle]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

----------------------------------------------------------------------------------------------

版权所有,如需转载,请注明出处,否则追加法律责任!

blog:http://blog.csdn.net/waycomecome

mail:waycomecome@gmail.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值