Oracle Cluster Registry (OCR) 存儲叢集配置(節點、實例、監聽器、VIP 等 CRS 資源)。為高可用,支持一主一鏡像(最多兩份副本),存放於共享存儲(ASM 或 原始設備)。
[root@node3 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 208656
Used space (kbytes) : 6496
Available space (kbytes) : 202160
ID : 844916878
Device/File Name : /dev/raw/raw2
Device/File integrity check succeeded
Device/File not configured <-- 當前無鏡像
配置文件 /etc/oracle/ocr.loc 確認:
ocrconfig_loc=/dev/raw/raw2
local_only=false
[root@node3 ~]# ocrconfig -replace ocrmirror /dev/raw/raw4
[root@node3 ~]# ocrcheck
...
Device/File Name : /dev/raw/raw2
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw4
Device/File integrity check succeeded <-- 鏡像生效
Cluster registry integrity check succeeded
[root@node3 ~]# cat /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/raw2
ocrmirrorconfig_loc=/dev/raw/raw4
local_only=false
[root@node3 ~]# ocrconfig -replace ocrmirror /dev/raw/raw6
[root@node3 ~]# ocrcheck
...
Device/File Name : /dev/raw/raw2
Device/File Name : /dev/raw/raw6 <-- raw4 被 raw6 替換
...
[root@node3 ~]# cat /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/raw2
ocrmirrorconfig_loc=/dev/raw/raw6
local_only=false
注意:OCR 只能有一份鏡像,新增即替換舊鏡像。
[root@node3 ~]# ocrconfig -replace ocrmirror <-- 不帶路徑即刪除
[root@node3 ~]# ocrcheck
...
Device/File Name : /dev/raw/raw2
Device/File not configured <-- 鏡像已刪除
...
[root@node3 ~]# cat /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/raw2
local_only=false
[root@node3 ~]# ocrconfig -replace ocr <-- 刪除主文件
[root@node3 ~]# ocrcheck
...
Device/File Name : /dev/raw/raw4 <-- 原鏡像變為新主文件
Device/File not configured
Cluster registry integrity check succeeded
此特性保證了 OCR 在單點故障下的自我修復能力。
ocrcheck 並納入監控告警(關注 "Device/File integrity check succeeded")。$GRID_HOME/cdata// ),亦可手動 ocrconfig -manualbackup。ocrconfig -replace ocr +DG_OCR(需 Grid Infrastructure 環境)。