Oracle 10g RAC OCR 和 VotingDisk 的备份与恢复(二)

2014-11-24 12:11:01 · 作者: · 浏览: 3
- Overwrite OCR configuration on disk
-repair ocr|ocrmirror - Repair local OCR configuration
-help - Print out this help information
Note:
A log file will be created in
$ORACLE_HOME/log//client/ocrconfig_.log. Please ensure
you have file creation privileges in the above directory before
running this tool.


1. 用导出导入备份恢复OCR

1) 首先关闭所有节点的CRS
[root@raw1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

2) 用root 用户导出OCR内容
[root@raw1 bin]# ./ocrconfig -export /u01/ocr.exp

3) 重启CRS
[root@raw1 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

4) 检查CRS 状态
[root@raw1 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

5)破坏OCR内容
[root@raw1 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=1024 count=102400
102400+0 records in
102400+0 records out

6) 检查OCR一致性
[root@raw1 bin]# ./ocrcheck
PROT-601: Failed to initialize ocrcheck

7)使用cluvfy 工具检查一致性
[root@raw1 cluvfy]# ./runcluvfy.sh comp ocr -n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.
Verification cannot proceed.

8) 使用Import 恢复OCR 内容
[root@raw1 bin]# ./ocrconfig -import /u01/ocr.exp

注意: 使用restore选项只能导入OCR自动产生的物理备份,
import选项只能导入通过export选项导出的的逻辑备份。

9)再次检查OCR
[root@raw1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 147352
Used space (kbytes) : 4364
Available space (kbytes) : 142988
ID : 610419116
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded

10) 使用cluvfy工具检查
[root@raw1 cluvfy]# ./runcluvfy.sh comp ocr -n all


2. 自动备份恢复OCR

(1)关闭运行在集群数据库的所有节点上的CRS服务程序
/etc/init.d/init.crs stop
在Oracle 11gR2 中已经没有了init.crs 命令了。 只能通过
#crsctl stop crs
命令来关闭CRS.

(2). 通过ocrconfig 的showbackup选项查看最近的备份

[root@racnode1 ~]# ocrconfig -showbackup
racnode1 2010/11/22 13:30:27 /u01/app/11.2.0/grid/cdata/racnode-cluster/backup00.ocr
racnode1 2010/11/22 09:30:27 /u01/app/11.2.0/grid/cdata/racnode-cluster/backup01.ocr
racnode1 2010/11/22 05:30:26 /u01/app/11.2.0/grid/cdata/racnode-cluster/backup02.ocr
racnode1 2010/11/21 05:30:23 /u01/app/11.2.0/grid/cdata/racnode-cluster/day.ocr
racnode1 2010/11/11 03:35:10 /u01/app/11.2.0/grid/cdata/racnode-cluster/week.ocr

(3)通过ocrconfig的restore或import选项导入OCR数据
ocrconfig -restore filename_location
如:
ocrconfig -restore /u01/app/11.2.0/grid/cdata/racnode-cluster/backup00.ocr

注意: 使用restore选项只能导入OCR自动产生的物理备份,
import选项只能导入通过export选项导出的的逻辑备份。

(4) 检查CRS
[root@raw1 bin]# ./ocrcheck

使用cluvfy工具检查
[root@raw1 cluvfy]# ./runcluvfy.sh comp ocr -n all


(5)在所有节点上重新启动CRS
/etc/init.d/init