1.ocr磁盘简介  

       健忘问题是由于每个节点都有配置信息的拷贝,修改节点的配置信息不同步引起的。Oracle采用的解决方法就是把这个配置文件放在共享的存储上, 这个文件就是 OCR Disk.整个OCR的信息是树形结构的,主要分为3大分支.分别是SYSTEM,DATABASE和CRS,每个人分支都有许多小分支,只能由root用户修改.ocr每4个小时备份一次,只保留5个文件,当天保留3个文件,上个星期保留一个,上个月也保留一个.


OCR DISK内容包含:

1).节点信息

2).数据库实例,节点,以及其它映射关系

3).rac 资源配置信息(VIP,SERVICES)

4).数据库启动相关进程

5).CRS每三方应用程序信息


2.ocrcheck(检查ocr内容的一至性,查看ocr的状态)

[grid@rac2 ~]$ ocrcheck 

Status of Oracle Cluster Registry is as follows :

         Version :   3

         Total space (kbytes): 262120

         Used space (kbytes) :  3140

         Available space (kbytes) : 258980

         ID : 1119662722

         Device/File Name :  +OCR

                      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 bypassed due to non-privileged user

[grid@rac2 ~]$


3.ocrdump(查看ocr文件中的内容)

[root@rac1 ~]# ll  /home/grid/11.2.0/grid/cdata/scan-cluster/

total 58360

-rw------- 1 root root 7462912 Oct  8 18:44 27255153.ocr

-rw------- 1 root root 7462912 Oct 10 14:44 backup00.ocr

-rw------- 1 root root 7462912 Oct  9 17:58 backup01.ocr

-rw------- 1 root root 7462912 Oct  9 13:58 backup02.ocr

-rw------- 1 root root 7462912 Oct 10 14:45 day_.ocr

-rw------- 1 root root 7462912 Oct  9 13:58 day.ocr

-rw------- 1 root root 7462912 Oct  9 17:58 week_.ocr

-rw------- 1 root root 7421952 Sep 26 14:48 week.ocr

[root@rac1 ~]# /home/grid/11.2.0/grid/bin/ocrdump -backupfile  /home/grid/11.2.0/grid/cdata/scan-cluster/backup00.ocr

[root@rac1 ~]# ll OCRDUMPFILE    -此时当前目生成OCRDUMPFILE文件

-rw------- 1 root root 220258 Oct 10 16:32 OCRDUMPFILE

[root@rac1 ~]# more OCRDUMPFILE 

10/10/2016 16:32:25

/home/grid/11.2.0/grid/cdata/scan-cluster/backup00.ocr

/home/grid/11.2.0/grid/bin/ocrdump.bin -backupfile /home/grid/11.2.0/grid/cdata/scan-cluster/backup00.ocr 

[SYSTEM]

UNDEF : 

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : root, GROUP_NAME : root}

[root@rac1 ~]#


4.ocrconfig(维护ocr磁盘)

[root@rac1 ~]# /home/grid/11.2.0/grid/bin/ocrconfig -showbackup

rac1   2016/10/10 14:45:03   /home/grid/11.2.0/grid/cdata/scan-cluster/backup00.ocr

rac1   2016/10/09 17:58:37   /home/grid/11.2.0/grid/cdata/scan-cluster/backup01.ocr

rac1   2016/10/09 13:58:33   /home/grid/11.2.0/grid/cdata/scan-cluster/backup02.ocr

rac1   2016/10/09 13:58:33   /home/grid/11.2.0/grid/cdata/scan-cluster/day.ocr

rac1   2016/09/26 14:48:52   /home/grid/11.2.0/grid/cdata/scan-cluster/week.ocr

[root@rac1 ~]# /home/grid/11.2.0/grid/bin/ocrconfig -manualbackup   --启用手动备份

rac1     2016/10/10 17:44:03     /home/grid/11.2.0/grid/cdata/scan-cluster/backup_20161010_174403.ocr

[root@rac1 ~]# /home/grid/11.2.0/grid/bin/ocrconfig -restore /home/grid/11.2.0/grid/cdata/scan-cluster/backup_20161010_174403.ocr  --恢复ocr信息

[root@rac1 ~]#


5.手动备份ocr磁盘

[root@rac1 ~]# /home/grid/11.2.0/grid/bin/ocrconfig -export /tmp/ocr-20161010.back

[root@rac1 ~]# ll /tmp/ocr-20161010.back 

-rw------- 1 root root 125185 Oct 10 17:49 /tmp/ocr-20161010.back

[root@rac1 ~]# /home/grid/11.2.0/grid/bin/ocrconfig -import /tmp/ocr-20161010.back --导入时必须停止crs服务


6.vote disk磁盘简介  

   Voting Disk这个文件主要用于记录节点成员状态,在出现脑裂时,决定那个Partion获得控制权,其他的 Partion必须从集群中剔除。在安装RAC时也会提示指定这个位置。安装完成后可以通过crsctl query css votedisk命令来查看Voting Disk位置.oracle rac 10G可以用dd工具备份表决磁盘,oracle rac 11g的表决磁盘和ocr磁盘是在一起的,不能用dd工具备份.


1).备份表决磁盘

dd if=/dev/raw/raw3 of=/tmp/votedisk.back  bs=1024M count=10


2).恢复表决磁盘

dd if=/tmp/votedisk.back of=/dev/raw/raw3  bs=1024M count=10