日期:2014-05-16 浏览次数:20494 次
Oracle RAC 备份和恢复OCR
voting disks备份恢复参考:http://blog.csdn.net/laoshangxyc/article/details/8670425
1.OCR有两种备份方式,一种是自动备份,一种是手动备份。
自动备份:
Oracle Clusterware automatically creates OCR backups every 4 hours. At any one time, Oracle Clusterware always retains the latest 3 backup copies of the OCR that are 4 hours old, 1 day old, and 1 week old.
----Oracle集群每4个小时自动备份一次。在任一时刻,Oracle集群总会保存3份备份文件。他们分别是最近4小时,最近1天和最近1周的备份文件。
可以用下面的方式查看自动备份的文件
ocrconfig -showbackup
手动备份控制文件:
可以用下面的方式export OCR的内容到一个文件,backup_file_name是备份的文件的名字
ocrconfig -export backup_file_name
提示:你需要用root用户执行此命令
示例:
--备份 [root@node1 bin]# ./ocrconfig -export /home/oracle/backup/ocrbackup1.bak --查看备份文件 [oracle@node1 backup]$ ll total 104632 -rw-r--r-- 1 root root 86056 Mar 18 20:18 ocrbackup1.bak
2.OCR有两种恢复方式,一种是从自动备份中恢复,一种是手动备份中恢复。
从自动备份中恢复:
用下面的方式恢复OCR
ocrconfig -restore file_name
提示:用root用户执行,file_name为你想要从哪个备份文件中恢复的备份文件名1.两个节点关闭CRS
[root@node1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@node2 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2.恢复OCR
①模拟破坏OCR所在裸设备数据,本例采用的非冗余。
[root@node1 bin]# dd if=/dev/urandom of=/dev/raw/raw1 dd: writing to `/dev/raw/raw1': No space left on device 208865+0 records in 208864+0 records out 106938368 bytes (107 MB) copied, 123.665 seconds, 865 kB/s
--破坏后crs无法启动。
②恢复OCR
[root@node1 bin]# ./ocrconfig -restore /home/oracle/oracle/product/10.2.0/crs_1/cdata/crs/backup00.ocr
③验证OCR完整性
[oracle@node1 crs]$ cluvfy comp ocr -n all
Verifying OCR integrity
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.
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.
----恢复后能启动
从手动备份中恢复:
用下面的方法从手动备份中恢复,file_name为备份的文件名
ocrconfig -import file_name
示例:
[root@node1 bin]# ./ocrconfig -import /home/oracle/backup/ocrbackup1.bak
[oracle@node1 crs]$ cluvfy comp ocr -n all
Verifying OCR int