OCR相当于Windows的注册表。对于Windows而言,所有的软件信息,用户,配置,安全等等统统都放到注册表里边。而集群呢,同样如此,所有和集群相关的资源,配置,节点,RAC数据库统统都放在这个仓库里。如果OCR被破坏则导致集群服务启动异常,需要修复OCR。因此OCR的管理与维护对于整个集群而言,是相当重要的。本文主要描述了Oracle 10g RAC下的OCR的管理与维护。

  1. 1、环境
  2. oracle@bo2dbp:~> cat /etc/issue
  3. Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
  4. oracle@bo2dbp:~> crsctl query crs activeversion
  5. CRS active version on the cluster is [10.2.0.3.0]
  6. 2、校验OCR文件
  7. oracle@bo2dbp:~> ocrcheck
  8. Status of Oracle Cluster Registry is as follows :
  9. Version                  :          2
  10. Total space (kbytes)     :     204560
  11. Used space (kbytes)      :       6160
  12. Available space (kbytes) :     198400
  13. ID                       : 1512159503
  14. Device/File Name         : /dev/raw/raw1                <-- OCR (primary)
  15. Device/File integrity check succeeded
  16. Device/File not configured   <-- OCR Mirror (not configured)
  17. Cluster registry integrity check succeeded
  18. #如果clusterware处于关闭状态也可通过查询ocr.loc获得ocr文件所在的位置
  19. oracle@bo2dbp:~> more /etc/oracle/ocr.loc
  20. ocrconfig_loc=/dev/raw/raw1
  21. local_only=FALSE
  22. #校验OCR产生的日志文件
  23. $ORA_CRS_HOME/log/<hostname>/client/ocrcheck_<pid>.log
  24. 3、dump OCR的内容
  25. #缺省情况下,ocrdump命令导出文件被命名为OCRDUMPFILE,其文件类型为ASCII文件,如果缺省文件已存在,则收到PROT-303文件存在提示
  26. #导出ocr到缺省文件
  27. oracle@bo2dbp:~> ocrdump
  28. oracle@bo2dbp:~> ls -hltr OCRDUMPFILE
  29. -rw-r--r-- 1 oracle oinstall 44K 2013-01-07 14:13 OCRDUMPFILE
  30. oracle@bo2dbp:~> file OCRDUMPFILE
  31. OCRDUMPFILE: ASCII text
  32. #导出ocr到指定文件
  33. oracle@bo2dbp:~> ocrdump /tmp/`hostname`_ocrdump_`date +%Y%m%d:%H%M`
  34. oracle@bo2dbp:~> ls /tmp/*ocr*
  35. /tmp/bo2dbp_ocrdump_20130107:1415
  36. #导出ocr中system.css项的内容
  37. oracle@bo2dbp:~> ocrdump -stdout -keyname SYSTEM.css -xml >ocrdump.xml
  38. oracle@bo2dbp:~> more ocrdump.xml
  39. <OCRDUMP>
  40. <TIMESTAMP>01/07/2013 14:15:42</TIMESTAMP>
  41. <COMMAND>/u01/oracle/crs/bin/ocrdump.bin -stdout -keyname SYSTEM.css -xml </COMMAND>
  42. <KEY>
  43. <NAME>SYSTEM.css</NAME>
  44. <VALUE_TYPE>UNDEF</VALUE_TYPE>
  45. <VALUE><![CDATA[]]></VALUE>
  46. <USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
  47. <GROUP_PERMISSION>PROCR_READ</GROUP_PERMISSION>
  48. <OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
  49. <USER_NAME>root</USER_NAME>
  50. <GROUP_NAME>root</GROUP_NAME>
  51. ............
  52. #导出ocr中关于ocr的备份情况
  53. oracle@bo2dbp:~> ocrdump -stdout -keyname SYSTEM.OCR -xml>ocrdump_bak.xml
  54. 4、添加OCR文件
  55. #注,下面的描述中crs在所有的节点处于online状态,即对于ocr的添加,移动,代替crs无需处于offline状态
  56. oracle@bo2dbp:~> crsctl check crs
  57. CSS appears healthy
  58. CRS appears healthy
  59. EVM appears healthy
  60. oracle@bo2dbp:~> ssh bo2dbs crsctl check crs
  61. CSS appears healthy
  62. CRS appears healthy
  63. EVM appears healthy
  64. ocrconfig -replace ocrmirror <destination_file>
  65. ocrconfig -replace ocrmirror <disk>
  66. oracle@bo2dbp:~> sudo -s rcraw status
  67. root'''''s password:
  68. /dev/raw/raw1:  bound to major 8, minor 33
  69. /dev/raw/raw2:  bound to major 8, minor 49
  70. /dev/raw/raw11: bound to major 8, minor 113
  71. /dev/raw/raw21: bound to major 8, minor 129
  72. /dev/raw/raw22: bound to major 8, minor 145
  73. running
  74. oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -replace ocrmirror /dev/raw/raw11
  75. root'''s password:
  76. oracle@bo2dbp:~> ocrcheck
  77. Status of Oracle Cluster Registry is as follows :
  78. Version                  :          2
  79. Total space (kbytes)     :     204560
  80. Used space (kbytes)      :       6184
  81. Available space (kbytes) :     198376
  82. ID                       : 1512159503
  83. Device/File Name         : /dev/raw/raw1
  84. Device/File integrity check succeeded
  85. Device/File Name         : /dev/raw/raw11   #新的ocr镜像已经被添加
  86. Device/File integrity check succeeded
  87. Cluster registry integrity check succeeded
  88. #下面是连接到第二个节点查看
  89. oracle@bo2dbp:~> ssh bo2dbp ocrcheck
  90. Status of Oracle Cluster Registry is as follows :
  91. Version                  :          2
  92. Total space (kbytes)     :     204560
  93. Used space (kbytes)      :       6184
  94. Available space (kbytes) :     198376
  95. ID                       : 1512159503
  96. Device/File Name         : /dev/raw/raw1
  97. Device/File integrity check succeeded
  98. Device/File Name         : /dev/raw/raw11   #新的ocr镜像已经被添加
  99. Device/File integrity check succeeded
  100. Cluster registry integrity check succeeded
  101. #从两个节点查看ocr.loc文件记录的ocr位置是否发生变化
  102. oracle@bo2dbp:~> more /etc/oracle/ocr.loc
  103. #Device/file  getting replaced by device /dev/raw/raw11
  104. ocrconfig_loc=/dev/raw/raw1
  105. ocrmirrorconfig_loc=/dev/raw/raw11  #可以看到增加了ocrmirror位置
  106. local_only=false
  107. oracle@bo2dbp:~> ssh bo2dbs cat /etc/oracle/ocr.loc
  108. #Device/file  getting replaced by device /dev/raw/raw11
  109. ocrconfig_loc=/dev/raw/raw1
  110. ocrmirrorconfig_loc=/dev/raw/raw11
  111. #下面来尝试多添加一个ocrmirror,我们使用裸设备为raw21的做为镜像
  112. oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -replace ocrmirror /dev/raw/raw21
  113. root'''s password:
  114. oracle@bo2dbp:~> ocrcheck
  115. Status of Oracle Cluster Registry is as follows :
  116. Version                  :          2
  117. Total space (kbytes)     :     204560
  118. Used space (kbytes)      :       6184
  119. Available space (kbytes) :     198376
  120. ID                       : 1512159503
  121. Device/File Name         : /dev/raw/raw1
  122. Device/File integrity check succeeded
  123. Device/File Name         : /dev/raw/raw21  #可以看到原来的raw11已经被替代了
  124. Device/File integrity check succeeded
  125. Cluster registry integrity check succeeded
  126. #从上面的描述可知,ocr磁盘只能有两个,一个作为primary,一个作为mirror
  127. 5、重定位OCR
  128. 重定位OCR,也称之为移动OCR文件,也就是将当前的OCR或者镜像的OCR放置到新的裸设备后者OCFS上。对于整个操作可以在联机的情形下完成
  129. 不论是移动primary ocr还是mirror ocr,其依赖的ocr必须存在。也就是说必须要有两份ocr存在,否则收到PROT-16: Internal Error
  130. 使用下面的命令移动primary ocr
  131. ocrconfig -replace ocr <destination_file>
  132. ocrconfig -replace ocr <disk>
  133. 现在我们将primary ocr移动到之前的raw11上
  134. oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw11 bs=1024k count=210
  135. dd: writing `/dev/raw/raw11': No space left on device
  136. 200+0 records in
  137. 199+0 records out
  138. 209698816 bytes (210 MB) copied, 5.39183 seconds, 38.9 MB/s
  139. oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -replace ocr /dev/raw/raw11
  140. oracle@bo2dbp:~> ocrcheck
  141. Status of Oracle Cluster Registry is as follows :
  142. Version                  :          2
  143. Total space (kbytes)     :     204560
  144. Used space (kbytes)      :       6184
  145. Available space (kbytes) :     198376
  146. ID                       : 1512159503
  147. Device/File Name         : /dev/raw/raw11   #可以看到,此处之前的raw1被新的raw11代替
  148. Device/File integrity check succeeded
  149. Device/File Name         : /dev/raw/raw21
  150. Device/File integrity check succeeded
  151. Cluster registry integrity check succeeded
  152. 使用下面的命令移动mirror ocr,关于mirro ocr的移动此处不做演示
  153. ocrconfig -replace ocrmirror <destination_file>
  154. ocrconfig -replace ocrmirror <disk>
  155. 6、本地节点OCR的修复
  156. 对于任一节点的clusterware处于关闭状态或者节点主机被关闭的情形,其他节点对ocr配置的更改将使得处于被停机或关闭的clusterware
  157. 节点ocr信息与出现不一致的情形。比如在第二个节点处于关闭的情形下,对第一个节点进行了ocr的添加,移出,重定位等等操作,对于这
  158. 种情形则需要在关闭的节点进行ocr修复处理。修复仅仅在clusterware守护进程处于关闭下完成。
  159. 使用下面的命令修复ocr,repair参数仅仅作用于所在的节点
  160. ocrconfig -repair ocr device_name        #修复primary ocr,
  161. ocrconfig -repair ocrmirror device_name  #修复mirror ocr
  162. 在前面的一个示例中我们将primary 的ocr用原来的raw1变成了raw11,在这个操作期间,节点2已经意外宕机。
  163. 下面来查看节点2的ocr.loc
  164. 下面的ocr.loc中primary还是raw1,而上一个操作已经变成了raw11
  165. bo2dbs:/u01/oracle/crs/log/bo2dbs # more /etc/oracle/ocr.loc
  166. #Device/file /dev/raw/raw11 getting replaced by device /dev/raw/raw21
  167. ocrconfig_loc=/dev/raw/raw1
  168. ocrmirrorconfig_loc=/dev/raw/raw21
  169. local_only=false
  170. bo2dbs:/u01/oracle/crs/bin # ./crsctl start crs
  171. Attempting to start CRS stack
  172. The CRS stack will be started shortly
  173. #此时bo2dbs上集群无法启动
  174. bo2dbs:/u01/oracle/crs/bin # ./crsctl check crs
  175. Failure 1 contacting CSS daemon
  176. Cannot communicate with CRS
  177. Cannot communicate with EVM
  178. bo2dbs:/u01/oracle/crs/bin # ps -ef | grep d.bin | grep -v grep   #没有看到任何集群相关的进程
  179. bo2dbs:/u01/oracle/crs/bin # tail -2 /u01/oracle/crs/log/bo2dbs/alertbo2dbs.log    #查看日志文件
  180. 2013-01-07 17:13:49.153
  181. [client(12071)]CRS-1009:The OCR configuration is invalid. Details in /u01/oracle/crs/log/bo2dbs/client/css37.log.
  182. bo2dbs:/u01/oracle/crs/bin # more /u01/oracle/crs/log/bo2dbs/client/css37.log      #查看日志文件
  183. Oracle Database 10g CRS Release 10.2.0.1.0 Production Copyright 1996, 2005 Oracle.  All rights reserved.
  184. 2013-01-07 17:13:49.153: [  OCRRAW][190773584]proprioini: OCR configuration on disk 1 isn't valid
  185. 2013-01-07 17:13:49.153: [  OCRRAW][190773584]proprinit: Could not open raw device
  186. 2013-01-07 17:13:49.153: [ default][190773584]a_init:7!: Backend init unsuccessful : [26]
  187. 2013-01-07 17:13:49.153: [ CSSCLNT][190773584]clsssinit:
  188. Unable to access OCR device in OCR init.PROC-26: Error while accessing the physical storage
  189. #从上面的日志可知,在磁盘1上ocr配置无效,也就是不能打开裸设备raw1
  190. #下面我们来尝试修复
  191. bo2dbs:/u01/oracle/crs/bin # ./ocrconfig -repair ocr /dev/raw/raw11
  192. bo2dbs:/u01/oracle/crs/bin # more /etc/oracle/ocr.loc
  193. #Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw11
  194. ocrconfig_loc=/dev/raw/raw11
  195. ocrmirrorconfig_loc=/dev/raw/raw21
  196. local_only=false
  197. bo2dbs:/u01/oracle/crs/bin # ./crsctl start crs
  198. Attempting to start CRS stack
  199. The CRS stack will be started shortly
  200. bo2dbs:/u01/oracle/crs/bin # ./crsctl check crs
  201. CSS appears healthy
  202. CRS appears healthy
  203. EVM appears healthy
  204. bo2dbs:/u01/oracle/crs/bin # ps -ef | grep d.bin | grep -v grep
  205. root     14459  5067  0 17:33 ?        00:00:01 /u01/oracle/crs/bin/crsd.bin reboot
  206. oracle   14512  5065  0 17:33 ?        00:00:00 /u01/oracle/crs/bin/evmd.bin
  207. oracle   15128 14426  0 17:33 ?        00:00:01 /u01/oracle/crs/bin/ocssd.bin
  208. bo2dbs:/u01/oracle/crs/bin # ./crs_stat -t | grep bo2dbs
  209. ora....SM2.asm application    ONLINE    ONLINE    bo2dbs
  210. ora....BS.lsnr application    ONLINE    ONLINE    bo2dbs
  211. ora....BS.lsnr application    ONLINE    ONLINE    bo2dbs
  212. ora.bo2dbs.gsd application    ONLINE    ONLINE    bo2dbs
  213. ora.bo2dbs.ons application    ONLINE    ONLINE    bo2dbs
  214. ora.bo2dbs.vip application    ONLINE    ONLINE    bo2dbs
  215. ora....g2.inst application    ONLINE    ONLINE    bo2dbs
  216. # Authro : Robinson Cheng
  217. # Blog   : http://blog.csdn.net/robinson_0612
  218. 7、移除OCR
  219. #OCR可以添加,当然也可以移除OCR,比如对于ocr的镜像使用外部raid冗余方式。不过有个条件是必须至少有一个OCR处于联机状态。
  220. 通常可以按照下面的步骤来移除OCR
  221. 校验集群处于联机状态(尽可能为所有节点)
  222. 检查至少一个ocr处于联机状态
  223. 移除pirmary ocr或者ocr mirror
  224. 对于ocfs文件系统,移除ocr文件
  225. #使用下面的命令来移除ocr
  226. ocrconfig -replace ocr
  227. ocrconfig -replace ocrmirror
  228. bo2dbs:/u01/oracle/crs/bin # ps -ef | grep d.bin
  229. oracle    5745  5092  0 17:52 ?        00:00:00 /u01/oracle/crs/bin/evmd.bin
  230. root      5902  5094  0 17:52 ?        00:00:02 /u01/oracle/crs/bin/crsd.bin reboot
  231. oracle    6420  5795  0 17:52 ?        00:00:01 /u01/oracle/crs/bin/ocssd.bin
  232. root      8870 18345  0 18:01 pts/0    00:00:00 grep d.bin
  233. bo2dbs:/u01/oracle/crs/bin # ssh bo2dbp ps -ef | grep d.bin
  234. The authenticity of host 'bo2dbp (192.168.7.51)' can't be established.
  235. RSA key fingerprint is 2a:77:4f:eb:46:5b:07:4a:12:23:5c:69:b2:cd:15:ec.
  236. Are you sure you want to continue connecting (yes/no)? yes
  237. Warning: Permanently added 'bo2dbp' (RSA) to the list of known hosts.
  238. Password:
  239. oracle    5837  5122  0 17:54 ?        00:00:00 /u01/oracle/crs/bin/evmd.bin
  240. root      5907  5124  0 17:54 ?        00:00:02 /u01/oracle/crs/bin/crsd.bin reboot
  241. oracle    6672  5756  0 17:54 ?        00:00:01 /u01/oracle/crs/bin/ocssd.bin
  242. #两个ocr都处于online
  243. bo2dbs:/u01/oracle/crs/bin # ./ocrcheck
  244. Status of Oracle Cluster Registry is as follows :
  245. Version                  :          2
  246. Total space (kbytes)     :     204560
  247. Used space (kbytes)      :       6184
  248. Available space (kbytes) :     198376
  249. ID                       : 1512159503
  250. Device/File Name         : /dev/raw/raw11   #primary ocr
  251. Device/File integrity check succeeded
  252. Device/File Name         : /dev/raw/raw21   #mirror ocr
  253. Device/File integrity check succeeded
  254. Cluster registry integrity check succeeded
  255. bo2dbs:/u01/oracle/crs/bin # ./ocrconfig -replace ocr    #移除ocr
  256. bo2dbs:/u01/oracle/crs/bin # more /etc/oracle/ocr.loc
  257. #Device/file /dev/raw/raw11 being deleted
  258. ocrconfig_loc=/dev/raw/raw21
  259. local_only=false
  260. bo2dbs:/u01/oracle/crs/bin # ocrcheck
  261. -bash: ocrcheck: command not found
  262. bo2dbs:/u01/oracle/crs/bin # ./ocrcheck
  263. Status of Oracle Cluster Registry is as follows :
  264. Version                  :          2
  265. Total space (kbytes)     :     204560
  266. Used space (kbytes)      :       6184
  267. Available space (kbytes) :     198376
  268. ID                       : 1512159503
  269. Device/File Name         : /dev/raw/raw21   #可以看到原来的mirror ocr变成了primary ocr
  270. Device/File integrity check succeeded
  271. Device/File not configured
  272. Cluster registry integrity check succeeded  转:http://blog.csdn.net/leshami/article/details/8572648

Oracle RAC OCR 的管理与维护的更多相关文章

  1. Oracle RAC OCR 的备份与恢复

    Oracle Clusterware把整个集群的配置信息放在共享存储上,这些信息包括了集群节点的列表.集群数据库实例到节点的映射以及CRS应用程序资源信息.也即是存放在ocr 磁盘(或者ocfs文件) ...

  2. Oracle RAC OCR 与健忘症

    OCR就好比Windows的一个注册表,存储了所有与集群,RAC数据库相关的配置信息.而且是公用的配置,也就是说多个节点共享相同的配置信息.因此该配置应当存储于共享磁盘.本文主要基于Oracle 10 ...

  3. Oracle RAC OCR 和 VotingDisk 的备份与恢复

    一:Voting DiskVoting Disk 这个文件主要用于记录节点成员状态,在出现脑裂时,决定那个Partion获得控制权,其他的Partion必须从集群中剔除.Voting disk使用的是 ...

  4. Oracle rac架构和原理

        Oracle RAC Oracle Real Application Cluster (RAC,实时应用集群)用来在集群环境下实现多机共享数据库,以保证应用的高可用性:同时可以自动实现并行处理 ...

  5. Oracle RAC管理及维护命令详解

    Oracle Clusterware的命令集可以分为以下4种: 节点层:osnodes 网络层:oifcfg 集群层:crsctl, ocrcheck,ocrdump,ocrconfig 应用层:sr ...

  6. Oracle RAC 常用维护工具和命令

    Oracle RAC 常用维护工具和命令 分类: Oracle Basic Knowledge Oracle RAC2010-03-09 01:02 13987人阅读 评论(6) 收藏 举报 orac ...

  7. Oracle RAC学习笔记02-RAC维护工具集

    Oracle RAC学习笔记02-RAC维护工具集 RAC维护工具集 1.节点层 2.网络层 3.集群层 4.应用层 本文实验环境: 10.2.0.5 Clusterware + RAC 11.2.0 ...

  8. 转载:Oracle RAC日常基本维护命令

    本文转载自: https://blog.csdn.net/tianlesoftware/article/details/5358573 Oracle RAC日常基本维护命令 好文转载, Oracle  ...

  9. ORACLE 12c RAC的常用管理命令

    ORACLE 12c RAC的常用管理命令 一.查询 1.RAC查询 1.1.查询节点 [grid@swnode1 ~]$ su - grid [grid@swnode1 ~]$ /u01/app/1 ...

随机推荐

  1. uva 10912

    dp 记忆化搜索 #include <cstdio> #include <cstdlib> #include <cmath> #include <map> ...

  2. Unity3D脚本中文系列教程(五)

    http://dong2008hong.blog.163.com/blog/static/4696882720140302848544/?suggestedreading&wumii Unit ...

  3. 词法分析器flex的使用

    词法分析器flex的功能说起来就是一句话,将正则表达式转化为c代码. flex编译成功后会生成一个flex.exe的可执行文件.此时,我们需要一个定义了正则表达式 动作的input文件.例如test. ...

  4. zju 2972 Hurdles of 110m(简单的dp)

    题目 简单的dp,但是我还是参考了网上的思路,具体我没考虑到的地方见代码 #include<stdio.h> #include<iostream> #include<st ...

  5. Intent(二)

    以Android高级编程一书中的一个例子为例: 1, 创建一个ContactPicker项目,其中包含一个ContactPicker Activity package com.paad.contact ...

  6. hdu 1134 Game of Connections

    主要考察卡特兰数,大数乘法,除法…… 链接http://acm.hdu.edu.cn/showproblem.php?pid=1134 #include<iostream>#include ...

  7. lintcode: 把排序数组转换为高度最小的二叉搜索树

    题目: 把排序数组转换为高度最小的二叉搜索树 给一个排序数组(从小到大),将其转换为一棵高度最小的排序二叉树. 样例 给出数组 [1,2,3,4,5,6,7], 返回 4 / \ 2 6 / \ / ...

  8. HttpServletRequestWrapper的使用

    老大给了一个很实际的需求:有段程序,使用Http的方式与合作商交互,而且是明文传输数据.我方的代码已经打包放在服务器上运行了很长时间,这时合作商突然要求修改数据传输的方式,要求加密后再传输,而我方的原 ...

  9. html5--等待加载效果

    <!DOCTYPE HTML> <html lang="zh-cmn-Hans"> <head> <meta charset=" ...

  10. Telerik RadGrid Demo

    List Page Html code: <%@ Page Language="vb" AutoEventWireup="false" CodeBehin ...