解析OCR与VotingDisk以及其管理

Voting DiskOCR是Oracle Clusterware的2部分。Voting Disk里面记录着节点成员的信息。如RAC数据库中有哪些节点成员,节点增加或者删除时也同样会将信息记录进来。Voting Disk必须存放在共享存储上,通常来说是存放在裸设备上。为了保证Voting Disk的安全,需要配置多个Voting Disk,Oracle建议Voting Disk的个数应该为奇数个,如 1、3、5个,每个Voting Disk的大小约为20MB。

创新互联公司专业为企业提供谷城网站建设、谷城做网站、谷城网站设计、谷城网站制作等企业网站建设、网页设计与制作、谷城企业网站模板建站服务,10年谷城做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

OCR 记录的是节点成员的配置信息,如数据库、ASM、实例、监听器、VIP等CRS资源的配置信息。CRS进程管理的信息来自OCR的内容。OCR存储的配置信息是以目录树的形式来记录一系列“键-值”对应信息的。OCR记录着 CRS进程管理资源的所有配置信息。大小约为100MB。

对Voting Disk的更改必须用root来进行。

添加一个Voting Disk成员:crsctl add css votedisk /dev/raw/raw3'

删除一个Voting Disk成员:crsctl delete css votedisk /dev/raw/raw3'

对OCR的增加、删除和替代配置可以由root用户通过ocrconfig -replace来操作:

ocrconfig -replace /dev/raw/raw1

注意:增加、删除Voting Disk及恢复Voting Disk和OCR时,RAC中的所有资源都必须停止。

Voting Disk和OCR存放的信息是至关重要的,一旦他们丢失或者损坏的话,Clusterware将无法启动,这样整个RAC都无法启动。因此需要对Voting Disk和OCR进行完备的备份。

对Voting Disk的备份操作可以通过dd命令来操作。

查看位置:

#crsctl query css votedisk

备份操作:

#dd if=/dev/raw/raw2 f=/home/oracle/voting_disk.bak

恢复操作:

#dd if=/home/oracle/voting_disk.bak f=/dev/raw/raw2

默认情况下,RAC会在其中一个节点上每4个小时都自动备份一次OCR。并保留最近的3次备份,另外还保留最近两天以及最近两个周末的备份。这个可以通过命令ocrconfig -showbackup来查看。OCR默认的备份路径为$CRS_HOME/cdata/crs。可以通过ocrconfig -backuploc来更改OCR的备份路径。OCR自动备份的时间间隔无法修改。我们还可以通过ocrconfig -export 来到处OCR的内容,也可以通过通过ocrconfig -import导入OCR的内容。

可以用ocrconfig -restore 命令对OCR进行恢复。

./ocrconfig -restore /u01/oracle/product/10g/crs/cdata/crs/backup00.ocr

添加Voting Disk:

 
 
 
  1. [root@rhel1 bin]#./crsctl add css votedisk /u01/ocfs2fs/vdisk2
  2. Cluster is not in a ready state for online disk addition
  3. [root@rhel1 bin]#./crsctl add css votedisk /u01/ocfs2fs/vdisk2-force
  4. Now formatting voting disk: /u01/ocfs2fs/vdisk2 
  5. successful addition of votedisk /u01/ocfs2fs/vdisk2. chown oracle:oinstall /u01/ocfs2fs/vdisk2
  6. chmod 775 /u01/ocfs2fs/vdisk2
  7. [root@rhel1 bin]# /etc/init.crs start
  8. [root@rhel1 bin]#./crsctl query css votedisk
  9. 0. 0 /u01/ocfs2fs/vdisk
  10. 1. 0 /u01/ocfs2fs/vdisk2

注意:add voting disk必须是所有服务都关闭的情况下完成。

#p#

添加OCR镜像:

 
 
 
  1. [root@rhel1 bin]# touch /u01/ocfs2fs/ocr2
  2. [root@rhel1 bin]#./ocrconfig -replace ocrmirror /u01/ocfs2fs/ocr2 
  3. [root@rhel1 bin]#./ocrcheck 
  4. Status of Oracle Cluster Registry is as follows : 
  5. Version : 2
  6. Total space (kbytes) : 262120 
  7. Used space (kbytes) : 2756 
  8. Available space (kbytes) : 259364 
  9. ID : 2062708016 
  10. Device/File Name : /u01/ocfs2fs/ocr 
  11. Device/File integrity check succeeded 
  12. Device/File Name : /u01/ocfs2fs/ocr2 
  13. Device/File integrity check succeeded 
  14. Cluster registry integrity check succeeded 

注意:add ocr可以是在线完成。

删除OCR镜像:

 
 
 
  1. [root@rhel1 bin]#./ocrconfig -replace ocrmirror 
  2. [root@rhel1 bin]#./ocrcheck 
  3. Status of Oracle Cluster Registry is as follows : 
  4. Version : 2 
  5. Total space (kbytes) : 262120 
  6. Used space (kbytes) : 2756 
  7. Available space (kbytes) : 259364 
  8. ID : 2062708016 
  9. Device/File Name : /u01/ocfs2fs/ocr 
  10. Device/File integrity check succeeded 
  11. Device/File not configured 
  12. Cluster registry integrity check succeeded 
  13. [root@rhel1 bin]#cat /etc/oracle/ocr.loc 
  14. #Device/file /u01/ocfs2fs/ocr2 being deleted 
  15. ocrconfig_loc=/u01/ocfs2fs/ocr

删除Voting Disk:

 
 
 
  1. [root@rhel1 bin]#./crsctl delete css votedisk /u01/ocfs2fs/vdisk2 
  2. Cluster is not in a ready state for online disk removal 
  3. [root@rhel1 bin]#./crsctl stop crs 
  4. Stopping resources. This could take several minutes. 
  5. Successfully stopped CRS resources. 
  6. Stopping CSSD. 
  7. Shutting down CSS daemon. 
  8. Shutdown request successfully issued. 
  9. [root@rhel1 bin]# ./crsctl delete css votedisk /u01/ocfs2fs/vdisk2
  10. Cluster is not in a ready state for online disk removal 
  11. [root@rhel1 bin]#./crsctl delete css votedisk /u01/ocfs2fs/vdisk2-force
  12. successful deletion of votedisk /u01/ocfs2fs/vdisk2.
  13. [root@rhel1 bin]#./crsctl query css votedisk 
  14. 0. 0 /u01/ocfs2fs/vdisk 
  15. located 1 votedisk(s).

 #p#

备份、恢复Voting Disk:

 
 
 
  1. [root@rhel1 bin]#./crsctl check crs
  2. Failure 1 contacting CSS daemon
  3. Cannot communicate with CRS
  4. Cannot communicate with EVM
  5. [root@rhel1 bin]# dd if=/u01/ocfs2fs/vdisk f=/home/oracle/vdisk_bak //备份,ocfs2也可直接copy
  6. 20000+0 records in 
  7. 20000+0 records out 
  8. 10240000 bytes (10 MB) copied, 0.301106 seconds, 34.0 MB/s
  9. [root@rhel1 bin]# rm -rf /u01/ocfs2fs/vdisk
  10. [root@rhel1 bin]#dd if=/home/oracle/vdisk_bak f=/u01/ocfs2fs/vdisk //恢复,ocfs2也可直接copy
  11. 20000+0 records in
  12. 20000+0 records out
  13. 10240000 bytes (10 MB) copied, 0.173678 seconds, 59.0 MB/s
  14. [root@rhel1 bin]# chown oracle:oinstall /u01/ocfs2fs/vdisk
  15. [root@rhel1 bin]# chmod 775 /u01/ocfs2fs/vdisk 
  16. [root@rhel1 bin]#/etc/init.d/init.crs start 
  17. Startup will be queued to init within 30 seconds. 
  18. [root@rhel1 bin]#./crsctl check crs 
  19. CSS appears healthy 
  20. CRS appears healthy 
  21. EVM appears healthy

备份、恢复OCR:

 
 
 
  1. [root@rhel1 bin]# ./crsctl stop crs 
  2. Stopping resources. This could take several minutes. 
  3. Successfully stopped CRS resources. 
  4. Stopping CSSD. 
  5. Shutting down CSS daemon. 
  6. Shutdown request successfully issued. 
  7. [root@rhel1 bin]# cat /etc/oracle/ocr.loc 
  8. #Device/file /u01/ocfs2fs/ocr2 being deleted 
  9. ocrconfig_loc=/u01/ocfs2fs/ocr 
  10. local_only=false 
  11. [root@rhel1 bin]# mv /u01/ocfs2fs/ocr /u01/ocfs2fs/ocr_bak 
  12. [root@rhel1 crs_1]# cd cdata 
  13. [root@rhel1 cdata]# cd crs 
  14. [root@rhel1 crs]# ll 
  15. total 23144 
  16. -rwxrwxr-x 1 oracle dba 3514368 Mar 1 11:00 13968559 
  17. -rwxrwxr-x 1 oracle dba 3514368 Mar 1 07:00 33426182 
  18. -rw-r--r-- 1 root root 3182592 Mar 8 15:17 34809936 
  19. -rwxrwxr-x 1 oracle dba 3514368 Feb 27 09:38 backup00.ocr 
  20. -rwxrwxr-x 1 oracle dba 3514368 Feb 8 06:02 backup01.ocr 
  21. -rwxrwxr-x 1 oracle dba 2142208 Nov 8 19:25 backup02.ocr 
  22. -rwxrwxr-x 1 oracle dba 2142208 Nov 8 19:25 day.ocr 
  23. -rwxrwxr-x 1 oracle dba 2142208 Nov 8 19:25 week.ocr 
  24. [root@rhel1 crs]# cd ../../bin 
  25. [root@rhel1 bin]# ./ocrconfig -restore /u01/app/oracle/crs_1/cdata/crs/backup02.ocr 
  26. PROT-16: Internal Error 
  27. [root@rhel1 bin]#touch /u01/ocfs2fs/ocr 
  28. [root@rhel1 bin]#./ocrconfig -restore /u01/app/oracle/crs_1/cdata/crs/backup02.ocr 
  29. [root@rhel1 bin]# ./crsctl start crs 
  30. Attempting to start CRS stack 
  31. The CRS stack will be started shortly 
  32. [root@rhel1 bin]# ./crsctl check crs 
  33. CSS appears healthy 
  34. CRS appears healthy 
  35. EVM appears healthy

查看和改变自动备份目录的命令如下:

./ocrconfig -showbackup //查看自动备份。

./ocrconfig -backuploc //改变自动备份目录。

网站栏目:解析OCR与VotingDisk以及其管理
转载注明:http://www.hantingmc.com/qtweb/news2/10552.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联