对OCR中的内容进行dump和查看
Oracle的OCR(Oracle Cluster Registry)称作Oracle集群注册表,OCR提供了集群软件与其他应用程序进程之间共享信息的途径。OCR记录了集群软件所管理资源的信息,以键值对的树状结构进行存储。Oracle提供了ocrdump工具用来获取OCR的内容,通过了解其结构和内容有助于对OCR进行深入的了解。
1.ocrdump工具自带的帮助信息
# ocrdump -help
Name:
ocrdump - Dump contents of Oracle Cluster Registry to a file.
Synopsis:
ocrdump [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]
Description:
Default filename is OCRDUMPFILE. Examples are:
prompt> ocrdump
writes cluster registry contents to OCRDUMPFILE in the current directory
prompt> ocrdump MYFILE
writes cluster registry contents to MYFILE in the current directory
prompt> ocrdump -stdout -keyname SYSTEM
writes the subtree of SYSTEM in the cluster registry to stdout
prompt> ocrdump -stdout -xml
writes cluster registry contents to stdout in xml format
Notes:
The header information will be retrieved based on best effort basis.
A log file will be created in
$ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
you have file creation privileges in the above directory before
running this tool.
通过这个帮助提示文档可以对用法有一个比较全面的了解。
2.使用ocrdump生成OCR的转储文件
注意,由于Oracle 10.2.0.1的Bug所限,在使用该工具之前需要将Oracle集群软件升级到10.2.0.4(当然,如果OCR的备份文件是存放在OCR兼容的存储设备上,将不会触发Bug,因此也不用对其进行升级)。有关该Bug的更多描述请参见《【OCR】无法转储OCR备份文件内容——PROT-302: Failed to initialize ocrdump》(http://space.itpub.net/519536/viewspace-677936)。
1)确定Oracle集群软件为10.2.0.4
# /oracle/app/crs/bin/crsctl query crs softwareversion
CRS software version on node is
2)获取OCR的备份目录信息
# ocrconfig -showbackup
rac2 2010/11/10 04:33:24 /oracle/app/crs/cdata/crs
rac2 2010/11/10 01:08:28 /oracle/app/crs/cdata/crs
rac2 2010/11/09 21:43:20 /oracle/app/crs/cdata/crs
rac2 2010/11/09 21:43:20 /oracle/app/crs/cdata/crs
rac1 2010/11/06 00:57:14 /oracle/app/crs/cdata/crs
3)获取OCR备份目录中的OCR备份文件
# cd /oracle/app/crs/cdata/crs
# ls -ltr
total 23560
-rw-r--r-- 1 root root 4812800 Nov9 21:43 backup02.ocr
-rw-r--r-- 1 root root 4812800 Nov9 21:43 day.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 01:08 backup01.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 01:08 day_.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 04:33 backup00.ocr
4)转储OCR备份文件
# /oracle/app/crs/bin/ocrdump -backupfile backup00.ocr
# ls -ltr
total 23800
-rw-r--r-- 1 root root 4812800 Nov9 21:43 backup02.ocr
-rw-r--r-- 1 root root 4812800 Nov9 21:43 day.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 01:08 backup01.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 01:08 day_.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 04:33 backup00.ocr
-rw-r--r-- 1 root root241447 Nov 10 08:15 OCRDUMPFILE
亦可以使用“-xml”选项以XML格式进行输出
# /oracle/app/crs/bin/ocrdump -xml -backupfile backup00.ocr xml_backup00
# ls -ltr
total 24188
-rw-r--r-- 1 root root 4812800 Nov9 21:43 backup02.ocr
-rw-r--r-- 1 root root 4812800 Nov9 21:43 day.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 01:08 backup01.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 01:08 day_.ocr
-rw-r--r-- 1 root root 4812800 Nov 10 04:33 backup00.ocr
-rw-r--r-- 1 root root241447 Nov 10 08:15 OCRDUMPFILE
-rw-r--r-- 1 root root392832 Nov 10 08:24 xml_backup00
如果未指定输出的文件名,系统默认的转储名字是“OCRDUMPFILE”。
5)分别查看两种形式的转储文件内容
# vi OCRDUMPFILE
11/10/2010 08:15:52
backup00.ocr
/oracle/app/crs/bin/ocrdump.bin -backupfile backup00.ocr
UNDEF :
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : root, GROUP_NAME : root}
UNDEF :
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : root, GROUP_NAME : root}
UNDEF :
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_CREATE_SUB_KEY, OTHER_PERMISSION : PROCR_READ, USER_NAME : oracle, GROUP_NAME : oinstall}
……省略剩余输出……
# vi xml_backup00
<OCRDUMP>
<TIMESTAMP>11/10/2010 08:24:49</TIMESTAMP>
<DEVICE>backup00.ocr</DEVICE>
<COMMAND>/oracle/app/crs/bin/ocrdump.bin -xml -backupfile backup00.ocr xml_backup00 </COMMAND>
<KEY>
<NAME>SYSTEM</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><!]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
<GROUP_PERMISSION>PROCR_READ</GROUP_PERMISSION>
<OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
<USER_NAME>root</USER_NAME>
<GROUP_NAME>root</GROUP_NAME>
<KEY>
<NAME>SYSTEM.css</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><!]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
<GROUP_PERMISSION>PROCR_READ</GROUP_PERMISSION>
<OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
<USER_NAME>root</USER_NAME>
<GROUP_NAME>root</GROUP_NAME>
<KEY>
<NAME>SYSTEM.css.interfaces</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><!]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
<GROUP_PERMISSION>PROCR_CREATE_SUB_KEY</GROUP_PERMISSION>
<OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
<USER_NAME>oracle</USER_NAME>
<GROUP_NAME>oinstall</GROUP_NAME>
……省略剩余输出……
3.OCR的树形结构
全面查看OCR的内容后可以总结出如下的树形结构。
root
├─SYSTEM
│├─css
│├─language
│├─version
│├─ORA_CRS_HOME
│├─local_only
│├─evm
│├─crs
│└─OCR
├─DATABASE
│├─NODEAPPS
│├─LOG
│├─ASM
│├─DATABASES
││├─SERVICE
││└─INSTANCE
│└─ONS
└─CRS
简单对上述三类键值的功能做下述简要描述:
1)SYSTEM键包含了与Oracle Clusterware主要进程CSSD、CRSD和EVMD的相关数据;
2)DATABASE键包含了在Oracle Clusterware注册的RAC数据库相关的数据;
3)OCR键记录了与资源概要文件相关的信息,维护其他注册到Oracle Clusterware的应用程序的可用性。
4.小结
OCR作为Oracle RAC集群环境中的重要资源,建议对其内容进行深入的理解。
页:
[1]