欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

使用导入导出进行备份和恢复OCR(10g)

程序员文章站 2024-01-13 22:13:46
oracle推荐在对集群调整时,比如增加、删除节点之前,应对ocr进行备份,可以用export备份到指定文件。如果做了replace或者restore等操作,oracle建议使用c...

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