OCR文件用于存储Clusterware及数据库的配置信息。在安装Clusterware时,要求创建多个OCR文件。对OCR文件的管理主要包括备份、恢复、添加、删除及迁移等。
OCR文件的备份是自动进行的,在Clusterware运行的过程中,每四个小时对OCR文件进行一次备份,并保留最后的三个备份。在每天结束及每周结束时,还要各产生一个备份,并保留下来。此外,通过ocrconfig命令可以对OCR文件手工进行备份,这条命令是以root用户身份执行的。例如,下面的命令用于对OCR文件进行手工备份:
1 查看ocr
[root@dmsdb2 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3092
Available space (kbytes) : 259028
ID : 1138657338
Device/File Name : +DATA
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
2 查看备份ocr
[grid@dmsdb2 ~]$ ocrconfig -showbackup
dmsdb1 2013/09/30 14:18:36 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup00.ocr
dmsdb1 2013/09/30 10:18:35 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup01.ocr
dmsdb1 2013/09/30 06:18:35 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup02.ocr
dmsdb2 2200/01/01 06:20:36 /u01/11.2.0/grid/product/cdata/dmsdb-scan/day.ocr
dmsdb2 2200/01/01 06:20:36 /u01/11.2.0/grid/product/cdata/dmsdb-scan/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
注:可以看出在两个节点都有OCR备份,这样从服务器层次上保证了OCR的安全性。
3 ocr备份操作
[root@dmsdb2 bin]# ./ocrconfig -manualbackup
dmsdb1 2013/09/30 14:46:30 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup_20130930_144630.ocr
[root@dmsdb2 bin]# cd /u01/11.2.0/grid/product/bin/
[root@dmsdb2 bin]# ./ocrconfig -showbackup
dmsdb1 2013/09/30 14:18:36 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup00.ocr
dmsdb1 2013/09/30 10:18:35 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup01.ocr
dmsdb1 2013/09/30 06:18:35 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup02.ocr
dmsdb2 2200/01/01 06:20:36 /u01/11.2.0/grid/product/cdata/dmsdb-scan/day.ocr
dmsdb2 2200/01/01 06:20:36 /u01/11.2.0/grid/product/cdata/dmsdb-scan/week.ocr
dmsdb1 2013/09/30 14:46:30 /u01/11.2.0/grid/product/cdata/dmsdb-scan/backup_20130930_144630.ocr
注:从上面可以看出,只要在一个节点上进行即可
4 在另外ASM磁盘组添加冗余的ocr
在此情况下,使用root用户进行操作。
[root@dmsdb2 bin]# ./ocrconfig -add +TEST
[root@dmsdb2 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3092
Available space (kbytes) : 259028
ID : 1138657338
Device/File Name : +DATA
Device/File integrity check succeeded
Device/File Name : +TEST
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
5 删除多余的ocr
解决方案,在两个节点中/etc/oracle/ocr.loc配置文件中,只需注释ocrmirrorconfig_loc即可。
#Device/file getting replaced by device +TEST
ocrconfig_loc=+DATA
#ocrmirrorconfig_loc=+TEST
local_only=false
[root@dmsdb2 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3092
Available space (kbytes) : 259028
ID : 1138657338
Device/File Name : +DATA
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
注:冗余文件去除,谢谢