Oracle11G在OCR方面的改进,类似于初始化文件一样,既可以使用共享设备,也会在本地存放一份OCR信息。OCR镜像文件也从Oracle10G时候2个增加到5个,同时去掉原先Oracle10G时候ocrmirrorconfig_loc的概念。
对OCR的操作,主要有三个命令ocrcheck,ocrdump,ocrconfig
1.ocrcheck:
[root@oradb01 ~]# ocrcheck -h
Name:
ocrcheck - Displays health of Oracle Cluster/Local Registry.
Synopsis:
ocrcheck [-config] [-local]
-config Displays the configured locations of the Oracle Cluster Registry.
This can be used with the -local option to display the configured
location of the Oracle Local Registry
-local The operation will be performed on the Oracle Local Registry.
Notes:
A log file will be created in
$ORACLE_HOME/log//client/ocrcheck_.log.
File creation privileges in the above directory are needed
when running this tool.
[root@oradb01 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2836
Available space (kbytes) : 259284
ID : 366312876
Device/File Name : +OCRDG
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 succeeded
[root@oradb01 ~]# ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +OCRDG
[root@oradb01 ~]# ocrcheck -config -local
Oracle Local Registry configuration is :
Device/File Name : /oracle/app/grid/product/grid/cdata/oradb01.olr
[root@oradb01 ~]# ocrcheck -local
Status of Oracle Local Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2204
Available space (kbytes) : 259916
ID : 463546253
Device/File Name : /oracle/app/grid/product/grid/cdata/oradb01.olr
Device/File integrity check succeeded
Local registry integrity check succeeded
Logical corruption check succeeded
2. ocrdump
该命令将ocr上配置的资源信息列出来,默认情况下会在当前目录下生成一个OCRDUMPFILE文件
[root@oradb01 ~]# ocrdump -h
Name:
ocrdump - Dump contents of Oracle Cluster/Local Registry to a file.
Synopsis:
ocrdump [-local] [|-stdout] [-backupfile ] [-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 -local -stdout -xml
writes local registry contents to stdout in xml format
prompt> ocrdump -backupfile /oracle/CRSHOME/backup.ocr -stdout -xml
writes registry contents in the backup file 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//client/ocrdump_.log. Make sure
you have file creation privileges in the above directory before
running this tool.
Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.
3.ocrconfig
该命令用来配置OCR的集群/本地配置文件内容
[root@oradb01 ~]# ocrconfig
Name:
ocrconfig - Configuration tool for Oracle Cluster/Local Registry.
Synopsis:
ocrconfig [option]
option:
[-local] -export
- Export OCR/OLR contents to a file
[-local] -import - Import OCR/OLR contents from a file
[-local] -upgrade [ []]
- Upgrade OCR from previous version
-downgrade [-version ]
- Downgrade OCR to the specified version
[-local] -backuploc - Configure OCR/OLR backup location
[-local] -showbackup [auto|manual] - Show OCR/OLR backup information
[-local] -manualbackup - Perform OCR/OLR backup
[-local] -restore - Restore OCR/OLR from physical backup
-replace -replacement
- Replace a OCR device/file with
-add - Add a new OCR device/file
-delete - Remove a OCR device/file
-overwrite - Overwrite OCR configuration on disk
-repair -add | -delete | -replace -replacement
- Repair OCR configuration on the local node
-help - Print out this help information
Note:
* A log file will be created in
$ORACLE_HOME/log//client/ocrconfig_.log. Please ensure
you have file creation privileges in the above directory before
running this tool.
* Only -local -showbackup [manual] is supported.
* Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.
增加一个OCR文件
[root@oradb01 ~]# ocrconfig -add +DATA1DG
[root@oradb01 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2836
Available space (kbytes) : 259284
ID : 366312876
Device/File Name : +OCRDG
Device/File integrity check succeeded
Device/File Name : +DATA1DG
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@oradb01 ~]# cat /etc/oracle/ocr.loc
#Device/file getting replaced by device +DATA1DG
ocrconfig_loc=+OCRDG
ocrmirrorconfig_loc=+DATA1DG
local_only=false
[root@oradb01 ~]# ocrconfig -add +recdg
[root@oradb01 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2836
Available space (kbytes) : 259284
ID : 366312876
Device/File Name : +OCRDG
Device/File integrity check succeeded
Device/File Name : +DATA1DG
Device/File integrity check succeeded
Device/File Name : +recdg
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@oradb01 ~]# cat /etc/oracle/ocr.loc
#Device/file getting replaced by device +recdg
ocrconfig_loc=+OCRDG
ocrmirrorconfig_loc=+DATA1DG
ocrconfig_loc3=+recdg
local_only=false
一个OCR文件只能放在一个DG中,如果需要使用多个OCR文件,那么应该建多个DG。
如果是裸设备,就没这个限制了。
删除OCR文件
[root@oradb01 ~]# ocrconfig -delete +recdg
[root@oradb01 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2836
Available space (kbytes) : 259284
ID : 366312876
Device/File Name : +OCRDG
Device/File integrity check succeeded
Device/File Name : +DATA1DG
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@oradb01 ~]# cat /etc/oracle/ocr.loc
#Device/file +recdg being deleted
ocrconfig_loc=+OCRDG
ocrmirrorconfig_loc=+DATA1DG
local_only=false
也可以删除默认的OCR文件
[root@oradb01 ~]# ocrconfig -delete +OCRDG
[root@oradb01 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2836
Available space (kbytes) : 259284
ID : 366312876
Device/File Name : +DATA1DG
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 succeeded
[root@oradb01 ~]# cat /etc/oracle/ocr.loc
#Device/file +OCRDG getting replaced by device +DATA1DG
ocrconfig_loc=+DATA1DG
local_only=false
假如OCR所在在DG并没有在CRS的asm_diskgroups参数中,CRS软件还是会自动将该DG做MOUNT操作。