解析OCR与Voting Disk以及其管理

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

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.  
  3. Cluster is not in a ready state for online disk addition  
  4.  
  5. [root@rhel1 bin]#./crsctl add css votedisk /u01/ocfs2fs/vdisk2-force  
  6.  
  7. Now formatting voting disk: /u01/ocfs2fs/vdisk2   
  8.  
  9. successful addition of votedisk /u01/ocfs2fs/vdisk2. chown oracle:oinstall /u01/ocfs2fs/vdisk2  
  10.  
  11. chmod 775 /u01/ocfs2fs/vdisk2  
  12.  
  13. [root@rhel1 bin]# /etc/init.crs start  
  14.  
  15. [root@rhel1 bin]#./crsctl query css votedisk  
  16.  
  17. 0. 0 /u01/ocfs2fs/vdisk  
  18.  
  19. 1. 0 /u01/ocfs2fs/vdisk2 

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

#p#

添加OCR镜像:

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

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

删除OCR镜像:

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

删除Voting Disk:

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

 #p#

备份、恢复Voting Disk:

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

备份、恢复OCR:

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

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

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

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

【编辑推荐】

  1. 解析OracleOLAP使用MView刷新Cube
  2. 因为Oracle推EF for Oracle引发的口水战
  3. 浅谈禁用以操作系统认证方式登录Oracle数据库
  4. Oracle数据导入MySQL的快捷工具:MySQL Migration Toolkit

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/230996.html<

(0)
运维的头像运维
上一篇2025-04-19 12:05
下一篇 2025-04-19 12:07

相关推荐

  • 个人主题怎么制作?

    制作个人主题是一个将个人风格、兴趣或专业领域转化为视觉化或结构化内容的过程,无论是用于个人博客、作品集、社交媒体账号还是品牌形象,核心都是围绕“个人特色”展开,以下从定位、内容规划、视觉设计、技术实现四个维度,详细拆解制作个人主题的完整流程,明确主题定位:找到个人特色的核心主题定位是所有工作的起点,需要先回答……

    2025-11-20
    0
  • 社群营销管理关键是什么?

    社群营销的核心在于通过建立有温度、有价值、有归属感的社群,实现用户留存、转化和品牌传播,其管理需贯穿“目标定位-内容运营-用户互动-数据驱动-风险控制”全流程,以下从五个维度展开详细说明:明确社群定位与目标社群管理的首要任务是精准定位,需明确社群的核心价值(如行业交流、产品使用指导、兴趣分享等)、目标用户画像……

    2025-11-20
    0
  • 香港公司网站备案需要什么材料?

    香港公司进行网站备案是一个涉及多部门协调、流程相对严谨的过程,尤其需兼顾中国内地与香港两地的监管要求,由于香港公司注册地与中国内地不同,其网站若主要服务内地用户或使用内地服务器,需根据服务器位置、网站内容性质等,选择对应的备案路径(如工信部ICP备案或公安备案),以下从备案主体资格、流程步骤、材料准备、注意事项……

    2025-11-20
    0
  • 如何企业上云推广

    企业上云已成为数字化转型的核心战略,但推广过程中需结合行业特性、企业痛点与市场需求,构建系统性、多维度的推广体系,以下从市场定位、策略设计、执行落地及效果优化四个维度,详细拆解企业上云推广的实践路径,精准定位:明确目标企业与核心价值企业上云并非“一刀切”的方案,需先锁定目标客户群体,提炼差异化价值主张,客户分层……

    2025-11-20
    0
  • PS设计搜索框的实用技巧有哪些?

    在PS中设计一个美观且功能性的搜索框需要结合创意构思、视觉设计和用户体验考量,以下从设计思路、制作步骤、细节优化及交互预览等方面详细说明,帮助打造符合需求的搜索框,设计前的规划明确使用场景:根据网站或APP的整体风格确定搜索框的调性,例如极简风适合细线条和纯色,科技感适合渐变和发光效果,电商类则可能需要突出搜索……

    2025-11-20
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注