OCR相當(dāng)于Windows的注冊(cè)表。對(duì)于Windows而言,所有的軟件信息,用戶,配置,安全等等統(tǒng)統(tǒng)都放到注冊(cè)表里邊。而集群呢,同樣如此,
OCR相當(dāng)于Windows的注冊(cè)表。對(duì)于Windows而言,所有的軟件信息,用戶,配置,安全等等統(tǒng)統(tǒng)都放到注冊(cè)表里邊。而集群呢,同樣如此,所有和集群相關(guān)的資源,,配置,節(jié)點(diǎn),RAC數(shù)據(jù)庫統(tǒng)統(tǒng)都放在這個(gè)倉庫里。如果OCR被破壞則導(dǎo)致集群服務(wù)啟動(dòng)異常,需要修復(fù)OCR。因此OCR的管理與維護(hù)對(duì)于整個(gè)集群而言,是相當(dāng)重要的。本文主要描述了Oracle 10g RAC下的OCR的管理與維護(hù)。
OCR 相關(guān)參考:
Oracle RAC OCR 與健忘癥
Oracle RAC OCR 的備份與恢復(fù)
1、環(huán)境
oracle@bo2dbp:~> cat /etc/issue
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
oracle@bo2dbp:~> crsctl query crs activeversion
CRS active version on the cluster is [10.2.0.3.0]
2、校驗(yàn)OCR文件
oracle@bo2dbp:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6160
Available space (kbytes) : 198400
ID : 1512159503
Device/File Name : /dev/raw/raw1 <-- OCR (primary)
Device/File integrity check succeeded
Device/File not configured <-- OCR Mirror (not configured)
Cluster registry integrity check succeeded
#如果clusterware處于關(guān)閉狀態(tài)也可通過查詢ocr.loc獲得ocr文件所在的位置
oracle@bo2dbp:~> more /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/raw1
local_only=FALSE
#校驗(yàn)OCR產(chǎn)生的日志文件
$ORA_CRS_HOME/log/
3、dump OCR的內(nèi)容
#缺省情況下,ocrdump命令導(dǎo)出文件被命名為OCRDUMPFILE,其文件類型為ASCII文件,如果缺省文件已存在,則收到PROT-303文件存在提示
#導(dǎo)出ocr到缺省文件
oracle@bo2dbp:~> ocrdump
oracle@bo2dbp:~> ls -hltr OCRDUMPFILE
-rw-r--r-- 1 oracle oinstall 44K 2013-01-07 14:13 OCRDUMPFILE
oracle@bo2dbp:~> file OCRDUMPFILE
OCRDUMPFILE: ASCII text
#導(dǎo)出ocr到指定文件
oracle@bo2dbp:~> ocrdump /tmp/`hostname`_ocrdump_`date +%Y%m%d:%H%M`
oracle@bo2dbp:~> ls /tmp/*ocr*
/tmp/bo2dbp_ocrdump_20130107:1415
#導(dǎo)出ocr中system.css項(xiàng)的內(nèi)容
oracle@bo2dbp:~> ocrdump -stdout -keyname SYSTEM.css -xml >ocrdump.xml
oracle@bo2dbp:~> more ocrdump.xml
PROCR_ALL_ACCESS
root
............
#導(dǎo)出ocr中關(guān)于ocr的備份情況
oracle@bo2dbp:~> ocrdump -stdout -keyname SYSTEM.OCR -xml>ocrdump_bak.xml
4、添加OCR文件
#注,下面的描述中crs在所有的節(jié)點(diǎn)處于online狀態(tài),即對(duì)于ocr的添加,移動(dòng),代替crs無需處于offline狀態(tài)
oracle@bo2dbp:~> crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
oracle@bo2dbp:~> ssh bo2dbs crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
ocrconfig -replace ocrmirror
ocrconfig -replace ocrmirror
oracle@bo2dbp:~> sudo -s rcraw status
root'''s password:
/dev/raw/raw1: bound to major 8, minor 33
/dev/raw/raw2: bound to major 8, minor 49
/dev/raw/raw11: bound to major 8, minor 113
/dev/raw/raw21: bound to major 8, minor 129
/dev/raw/raw22: bound to major 8, minor 145
running
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -replace ocrmirror /dev/raw/raw11
root'''s password:
oracle@bo2dbp:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
ID : 1512159503
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw11 #新的ocr鏡像已經(jīng)被添加
Device/File integrity check succeeded
Cluster registry integrity check succeeded
#下面是連接到第二個(gè)節(jié)點(diǎn)查看
oracle@bo2dbp:~> ssh bo2dbp ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
ID : 1512159503
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw11 #新的ocr鏡像已經(jīng)被添加
Device/File integrity check succeeded
Cluster registry integrity check succeeded
#從兩個(gè)節(jié)點(diǎn)查看ocr.loc文件記錄的ocr位置是否發(fā)生變化
oracle@bo2dbp:~> more /etc/oracle/ocr.loc
#Device/file getting replaced by device /dev/raw/raw11
ocrconfig_loc=/dev/raw/raw1
ocrmirrorconfig_loc=/dev/raw/raw11 #可以看到增加了ocrmirror位置
local_only=false
oracle@bo2dbp:~> ssh bo2dbs cat /etc/oracle/ocr.loc
#Device/file getting replaced by device /dev/raw/raw11
ocrconfig_loc=/dev/raw/raw1
ocrmirrorconfig_loc=/dev/raw/raw11
#下面來嘗試多添加一個(gè)ocrmirror,我們使用裸設(shè)備為raw21的做為鏡像
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -replace ocrmirror /dev/raw/raw21
root'''s password:
oracle@bo2dbp:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
ID : 1512159503
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw21 #可以看到原來的raw11已經(jīng)被替代了
Device/File integrity check succeeded
Cluster registry integrity check succeeded
#從上面的描述可知,ocr磁盤只能有兩個(gè),一個(gè)作為primary,一個(gè)作為mirror
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com