如果OCR位于外部冗余模式的DG上,建议再保存一份OCR在其他的DG,确保OCR的安全性。OCR最多可以保存在5个DG中,每个DG中的OCR数量由DG的冗余模式有关。
Run as root:
ocrconfig -add +new_disk_group
将裸设备或文件系统上的原OCR删除
Run As Root:
ocrconfig -delete old_storage_location
For Example:
ocrconfig -add +new_disk_group
ocrconfig -delete /dev/raw/raw2
ocrconfig -delete /dev/raw/raw1
创建至少280MB的文件,文件权限是 640,属主是root:oinstall
Run As Root:
ocrconfig -add new_file_location
ocrconfig -delete unused_storage_location
For Example:
ocrconfig -add /dev/sdd1
ocrconfig -add /dev/sde1
ocrconfig -add /dev/sdf1
ocrconfig -delete +unused_disk_group
For裸设备上,创建至少280MB的裸设备,权限是640,属主是root:oinstall
For 共享文件系统 Or NFS,创建空文件,权限是640,属主是root:oinstall
As Root Run:
ocrconfig -add +asm_disk_group | file_name
Run AS Root
如果有多于1份的OCR,执行如下命令进行替换:
ocrconfig -replace current_OCR_location -replacement new_OCR_location
如果只有1份OCR,执行如下命令进行替换
ocrconfig -add +new_storage_disk_group
ocrconfig -delete +current_disk_group
替换期间的故障节点重新加入集群前,需要执行如下命令
ocrconfig -repair -replace current_OCR_location -replacement new_OCR_location
如果OCR改变期间-如增加,删除,替换OCR,集群内有节点异常,当节点重新加入集群前,需要对该节点的OCR配置信息进行修复。
Run As Root:
ocrconfig -repair -add file_name | -delete file_name | -replace current_file_name -replacement new_file_name
修复OCR的命令只能在CLUSTER WARE停止的时候执行,OCR LOCATION必须与其他节点一致并且存在。
For Example:
1份或多份OCR异常,无法修复,还有至少1份OCR正常,CRS 正常启动需要配置的所有OCR正常,此时需要在配置中删除损坏的OCR。
ocrconfig –repair -delete file_name
1.1.2.4 删除OCR
确保至少有1份OCR online .
Run As Root :
ocrconfig -delete +ASM_disk_group | file_name
CRS自动备份OVR,备份频率是每4小时备份1次,保留策略是保留最近3份备份,并保留最进1天/最近1周的备份,自动备份策略无法修改缺省的备份位置在Grid_home/cdata/cluster_name
ocrconfig –manualbackup
ocrconfig –showbackup
ocrdump -backupfilebackup_file_name
ocrconfig –backuploc
For Example:
ocrconfig -backuploc $Grid_home/cdata/cluster3
在所有节点上停止CRS,run as root:
crsctl stop crs
OR
crsctl stop crs –f
在任一节点,以exclusive模式启动CRS,run as root:
Crsctl start crs–excl
确认crsd是否在运行,如果在运行,将其停止,run as root:
Crsctl stat res –t–init
Crsctl stop resora.crsd –init
确认ASM资源已经online,DG 已经MOUNT,run as root:
Ocrconfig –restorebackup_file_name
检查OCR的状态,并停止CRS,run as root:
Crsctl stop crs -f
在所有节点上启动CRS
Crsctl start crs
验证集群内所有节点OCR的一致性
Cluvfy comp ocr –n all –verbose
在所有节点上停止CRS,run as root:
crsctl stop crs
OR
crsctl stop crs –f
确认相关裸设备存在或者文件系统上的文件已经创建,run as root:
Ocrconfig –restorebackup_file_name
在所有节点上启动CRS
Crsctl start crs
验证集群内所有节点OCR的一致性
Cluvfy comp ocr –n all –verbose
使用ocrdump,可以将OCR的内容写入指定文件中,以供检查。
ocrdump[file_name | -stdout] [-local] [-backupfile backup_file_name
[-keynamekey_name] [-xml] [-noheader]]
Options |
Description |
file_name |
The name of a file to which you want OCRDUMP to write output. By default, OCRDUMP writes output to a predefined output file named OCRDUMPFILE. The file_name option redirects OCRDUMP output to a file that you specify. |
-stdout |
Use this option to redirect the OCRDUMP output to the text terminal that initiated the program. If you do not redirect the output, OCRDUMP writes output to a predefined output file named OCRDUMPFILE. |
-local |
Use this option to dump the contents of OLR. |
-backupfile |
Use this option to view the contents of an OCR backup file. Use the -local option with this option to view the contents of an OLR backup file. |
backup_file_name |
The name of the backup file with the content you want to view. You can query the backups using theocrconfig -showbackup command. |
-keyname key_name |
The name of an Oracle Cluster Registry key whose subtree is to be dumped. |
-xml |
Use this option to write the output in XML format. |
-noheader |
Does not print the time at which you ran the command and when the Oracle Cluster Registry configuration occurred. |
For Example:
ocrdump MYFILE
将OCR的内容写入当前目录下的MYFILE文件
ocrdump -stdout -keyname SYSTEM
显示OCR中关键字system下的内容
OLR位于集群内每个节点上,位置在Grid_home/cdata/host_name.olr。存储当前节点的独有资源信息。管理OLR的命令与管理OCR一样,只需加入参数 –local
For example:
ocrcheck -local
ocrdump -local -stdout
ocrconfig –local –manualbackup
OLR只在安装或者升级之后自动备份,缺省备份位置在Grid_home/cdata/host_name.建议在迁移OCR之后,手工做OLR的备份。
1.1.7 OCR/OLR状态查询
Ocrcheck
Ocrcheck显示所有OCR的LOCATION以及状态
Status of Oracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 752 Available space (kbytes) : 261368 ID : 2098980155 Device/File Name : +ocrdg1 Device/File integrity check succeeded Device/File Name : +ocrdg2 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
Ocrcheck –config
只显示使用的OCR
$ ocrcheck -config Oracle Cluster Registry configuration is : Device/File Name : Grid_home/oracle/has_work/data.ocr Device/File Name : Grid_home/oracle/has_work/mirror.ocr
Ocrcheck –local
查询OLR的状态