码迷,mamicode.com
首页 > 其他好文 > 详细

ocr的备份与恢复

时间:2014-09-02 21:13:25      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:style   blog   os   io   使用   ar   for   文件   2014   

查看ocr的存放位置

[oracle@rac1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
	 Version                  :          2
	 Total space (kbytes)     :     262120
	 Used space (kbytes)      :       5432
	 Available space (kbytes) :     256688
	 ID                       :  982267297
	 Device/File Name         : /oradata/crs_data/ocr.dat
                                    Device/File integrity check succeeded

                                    Device/File not configured

	 Cluster registry integrity check succeeded
ocr每4个小时自动备份一次,我的自动备份位置: /oracle/app/oracle/product/10.2.0/crs/cdata/crs
可以通过命令ocrconfig查看备份
[oracle@rac1 ~]$ ocrconfig -showbackup
rac2     2014/08/25 14:31:15     /oracle/app/oracle/product/10.2.0/crs/cdata/crs
rac2     2014/08/25 10:31:15     /oracle/app/oracle/product/10.2.0/crs/cdata/crs
rac2     2014/08/22 17:46:32     /oracle/app/oracle/product/10.2.0/crs/cdata/crs
rac2     2014/08/25 10:31:15     /oracle/app/oracle/product/10.2.0/crs/cdata/crs
rac2     2014/08/22 17:46:32     /oracle/app/oracle/product/10.2.0/crs/cdata/crs

当前有5组自动备份,oracle最多也会保留5组,backup00.ocr为最近一次备份,day_.ocr为一天之内的备份,week_.ocr为一周之内的备份,当备份恢复ocr时,最好使用最近一组的

模拟ocr损坏,删除掉ocr,使用备份恢复

[oracle@rac1 ~]$ cd /oradata/crs_data
[oracle@rac1 crs_data]$ ls
ocr.dat vote.dat
[oracle@rac1 crs_data]$ rm -f ocr*

再次查看服务,发现crs服务仍然正常,这是因为当前使用的是crs cache

[oracle@rac1 crs_data]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....b1.inst application    ONLINE    ONLINE    rac1        
ora....b2.inst application    ONLINE    ONLINE    rac2        
ora.asmdb.db   application    ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        
ora.rawdb.db   application    ONLINE    ONLINE    rac1        
ora....b1.inst application    ONLINE    ONLINE    rac1        
ora....b2.inst application    ONLINE    ONLINE    rac2        
ora.test.db    application    ONLINE    ONLINE    rac1        
ora....t1.inst application    ONLINE    ONLINE    rac1        
ora....t2.inst application    ONLINE    ONLINE    rac2

重启crs服务,因为丢失ocr,此时使用命令已经关闭不掉服务了

[root@rac1 oracle]# crsctl stop crs
OCR initialization failed accessing OCR device: PROC-26: Error while accessing the physical storage Operating System error [No such file or directory]

重启服务器

[root@rac1 ~]# reboot

Broadcast message from root (pts/0) (Tue Aug 26 15:13:44 2014):

The system is going down for reboot NOW!
[root@rac2 ~]# reboot

Broadcast message from root (pts/0) (Tue Aug 26 15:14:20 2014):

The system is going down for reboot NOW!

启动crs,虽然提示会启动,却一直没有起来,这时候就要怀疑ocr损坏了

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

使用ocrcheck命令检查ocr,找不到ocr

[root@rac1 oracle]# ocrcheck
PROT-602: Failed to retrieve data from the cluster registry

使用find命令查找当前备份的ocr,如没有更换ocr自动备份路径,默认在主节点的$CRS_HOME/cdata/crs/下

[oracle@rac1 ~]$ find /oracle -name *.ocr*
/oracle/app/oracle/product/10.2.0/crs/cdata/crs/backup00.ocr
/oracle/app/oracle/product/10.2.0/crs/cdata/crs/day_.ocr

使用备份的ocr进行恢复,ocr可以在线恢复

ocfs的rac,需要先建一个与之前同名的ocr文件,然后再恢复

未建ocr文件,尝试恢复:

[root@rac1 crs]# ocrconfig -restore backup00.ocr
PROT-16: Internal Error

ocr文件名与之前不一样:

[root@rac1 crs]# ocrconfig -restore backup00.ocr
PROT-16: Internal Error

建一个与之前同名的ocr文件,恢复:

[root@rac1 crs]# ocrconfig -restore backup00.ocr

启动crs,查看资源状态

[root@rac1 crs]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....b1.inst application    ONLINE    ONLINE    rac1        
ora....b2.inst application    ONLINE    ONLINE    rac2        
ora.asmdb.db   application    ONLINE    ONLINE    rac2        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        
ora.rawdb.db   application    ONLINE    ONLINE    rac2        
ora....b1.inst application    ONLINE    ONLINE    rac1        
ora....b2.inst application    ONLINE    ONLINE    rac2        
ora.test.db    application    ONLINE    ONLINE    rac2        
ora....t1.inst application    ONLINE    ONLINE    rac1        
ora....t2.inst application    ONLINE    ONLINE    rac2 

 

ocr的导入导出

手工export ocr,ocr可以在线export

[root@rac1 crs_data]# ocrconfig -export /oradata/crs_data/ocr.dat.bak -s online

export的ocr备份文件,一定要import方式恢复,同样ocfs的rac需要先建立文件

$ ocrconfig -import /oradata/crs_data/ocr.dat.bak

 

ocr的备份与恢复

标签:style   blog   os   io   使用   ar   for   文件   2014   

原文地址:http://www.cnblogs.com/redoracle/p/3952248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!