首页 > 代码库 > ocr的备份与恢复
ocr的备份与恢复
查看ocr的存放位置
[oracle@rac1 ~]$ ocrcheckStatus 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 -showbackuprac2 2014/08/25 14:31:15 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/25 10:31:15 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/22 17:46:32 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/25 10:31:15 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 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]$ lsocr.dat vote.dat[oracle@rac1 crs_data]$ rm -f ocr*
再次查看服务,发现crs服务仍然正常,这是因为当前使用的是crs cache
[oracle@rac1 crs_data]$ crs_stat -tName 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 crsOCR initialization failed accessing OCR device: PROC-26: Error while accessing the physical storage Operating System error [No such file or directory]
重启服务器
[root@rac1 ~]# rebootBroadcast message from root (pts/0) (Tue Aug 26 15:13:44 2014):The system is going down for reboot NOW![root@rac2 ~]# rebootBroadcast 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 crsAttempting to start CRS stack The CRS stack will be started shortly
使用ocrcheck命令检查ocr,找不到ocr
[root@rac1 oracle]# ocrcheckPROT-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.ocrPROT-16: Internal Error
ocr文件名与之前不一样:
[root@rac1 crs]# ocrconfig -restore backup00.ocrPROT-16: Internal Error
建一个与之前同名的ocr文件,恢复:
[root@rac1 crs]# ocrconfig -restore backup00.ocr
启动crs,查看资源状态
[root@rac1 crs]# crs_stat -tName 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的备份与恢复
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。