Oracle Clusterware由2部分組成,分別是Voting Disk和 OCR。Voting Disk里面記錄著節(jié)點(diǎn)成員的信息。如RAC數(shù)據(jù)庫(kù)中有哪些節(jié)點(diǎn)成員,節(jié)點(diǎn)增加或者刪除時(shí)也同樣會(huì)將信息記錄進(jìn)來(lái)。Voting Disk必須存放在共享存儲(chǔ)上,通常來(lái)說(shuō)是存放在裸設(shè)備上。為了保證Voting Disk的安全,需要配置多個(gè)Voting Disk,Oracle建議Voting Disk的個(gè)數(shù)應(yīng)該為奇數(shù)個(gè),如 1、3、5個(gè),每個(gè)Voting Disk的大小約為20MB。 OCR 記錄的是節(jié)點(diǎn)成員的配置信息,如數(shù)據(jù)庫(kù)、ASM、實(shí)例、監(jiān)聽器、VIP等CRS資源的配置信息。CRS進(jìn)程管理的信息來(lái)自O(shè)CR的內(nèi)容。OCR存儲(chǔ)的配置信息是以目錄樹的形式來(lái)記錄一系列“鍵-值”對(duì)應(yīng)信息的。OCR記錄著 CRS進(jìn)程管理資源的所有配置信息。大小約為100MB。 對(duì)Voting Disk的更改必須用root來(lái)進(jìn)行。 添加一個(gè)Voting Disk成員:crsctl add css votedisk /dev/raw/raw3' 刪除一個(gè)Voting Disk成員:crsctl delete css votedisk /dev/raw/raw3'
對(duì)OCR的增加、刪除和替代配置可以由root用戶通過ocrconfig -replace來(lái)操作: ocrconfig -replace /dev/raw/raw1
注意:增加、刪除Voting Disk及恢復(fù)Voting Disk和OCR時(shí),RAC中的所有資源都必須停止。
Voting Disk和OCR存放的信息是至關(guān)重要的,一旦他們丟失或者損壞的話,Clusterware將無(wú)法啟動(dòng),這樣整個(gè)RAC都無(wú)法啟動(dòng)。因此需要對(duì) Voting Disk和OCR進(jìn)行完備的備份。
對(duì)Voting Disk的備份操作可以通過dd命令來(lái)操作。 查看位置: #crsctl query css votedisk 備份操作: #dd if=/dev/raw/raw2 f=/home/oracle/voting_disk.bak 恢復(fù)操作: #dd if=/home/oracle/voting_disk.bak f=/dev/raw/raw2
默認(rèn)情況下,RAC會(huì)在其中一個(gè)節(jié)點(diǎn)上每4個(gè)小時(shí)都自動(dòng)備份一次OCR。并保留最近的3次備份,另外還保留最近兩天以及最近兩個(gè)周末的備份。這個(gè)可以通過命令ocrconfig -showbackup來(lái)查看。OCR默認(rèn)的備份路徑為$CRS_HOME/cdata/crs。可以通過ocrconfig -backuploc來(lái)更改OCR的備份路徑。OCR自動(dòng)備份的時(shí)間間隔無(wú)法修改。我們還可以通過ocrconfig -export 來(lái)到處OCR的內(nèi)容,也可以通過通過ocrconfig -import導(dǎo)入OCR的內(nèi)容。
可以用ocrconfig -restore 命令對(duì)OCR進(jìn)行恢復(fù)。 ./ocrconfig -restore /u01/oracle/product/10g/crs/cdata/crs/backup00.ocr
添加Voting Disk: [root@rhel1 bin]#./crsctl add css votedisk /u01/ocfs2fs/vdisk2 Cluster is not in a ready state for online disk addition [root@rhel1 bin]#./crsctl add css votedisk /u01/ocfs2fs/vdisk2-force Now formatting voting disk: /u01/ocfs2fs/vdisk2 successful addition of votedisk /u01/ocfs2fs/vdisk2. chown oracle:oinstall /u01/ocfs2fs/vdisk2 chmod 775 /u01/ocfs2fs/vdisk2 [root@rhel1 bin]# /etc/init.crs start [root@rhel1 bin]#./crsctl query css votedisk 0. 0 /u01/ocfs2fs/vdisk 1. 0 /u01/ocfs2fs/vdisk2 注意:add voting disk必須是所有服務(wù)都關(guān)閉的情況下完成。 添加OCR鏡像: [root@rhel1 bin]# touch /u01/ocfs2fs/ocr2 [root@rhel1 bin]#./ocrconfig -replace ocrmirror /u01/ocfs2fs/ocr2 [root@rhel1 bin]#./ocrcheck Status of Oracle Cluster Registry is as follows : Version : 2 Total space (kbytes) : 262120 Used space (kbytes) : 2756 Available space (kbytes) : 259364 ID : 2062708016 Device/File Name : /u01/ocfs2fs/ocr Device/File integrity check succeeded Device/File Name : /u01/ocfs2fs/ocr2 Device/File integrity check succeeded Cluster registry integrity check succeeded 注意:add ocr可以是在線完成。
刪除OCR鏡像: [root@rhel1 bin]#./ocrconfig -replace ocrmirror [root@rhel1 bin]#./ocrcheck Status of Oracle Cluster Registry is as follows : Version : 2 Total space (kbytes) : 262120 Used space (kbytes) : 2756 Available space (kbytes) : 259364 ID : 2062708016 Device/File Name : /u01/ocfs2fs/ocr Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded [root@rhel1 bin]#cat /etc/oracle/ocr.loc #Device/file /u01/ocfs2fs/ocr2 being deleted ocrconfig_loc=/u01/ocfs2fs/ocr
刪除Voting Disk: [root@rhel1 bin]#./crsctl delete css votedisk /u01/ocfs2fs/vdisk2 Cluster is not in a ready state for online disk removal [root@rhel1 bin]#./crsctl stop crs Stopping resources. This could take several minutes. Successfully stopped CRS resources. Stopping CSSD. Shutting down CSS daemon. Shutdown request successfully issued. [root@rhel1 bin]# ./crsctl delete css votedisk /u01/ocfs2fs/vdisk2 Cluster is not in a ready state for online disk removal [root@rhel1 bin]#./crsctl delete css votedisk /u01/ocfs2fs/vdisk2-force successful deletion of votedisk /u01/ocfs2fs/vdisk2. [root@rhel1 bin]#./crsctl query css votedisk 0. 0 /u01/ocfs2fs/vdisk located 1 votedisk(s).
備份、恢復(fù)Voting Disk: [root@rhel1 bin]#./crsctl check crs Failure 1 contacting CSS daemon Cannot communicate with CRS Cannot communicate with EVM [root@rhel1 bin]# dd if=/u01/ocfs2fs/vdisk f=/home/oracle/vdisk_bak //備份,ocfs2也可直接copy 20000+0 records in 20000+0 records out 10240000 bytes (10 MB) copied, 0.301106 seconds, 34.0 MB/s [root@rhel1 bin]# rm -rf /u01/ocfs2fs/vdisk [root@rhel1 bin]#dd if=/home/oracle/vdisk_bak f=/u01/ocfs2fs/vdisk //恢復(fù),ocfs2也可直接copy 20000+0 records in 20000+0 records out 10240000 bytes (10 MB) copied, 0.173678 seconds, 59.0 MB/s [root@rhel1 bin]# chown oracle:oinstall /u01/ocfs2fs/vdisk [root@rhel1 bin]# chmod 775 /u01/ocfs2fs/vdisk [root@rhel1 bin]#/etc/init.d/init.crs start Startup will be queued to init within 30 seconds. [root@rhel1 bin]#./crsctl check crs CSS appears healthy CRS appears healthy EVM appears healthy
備份、恢復(fù)OCR:
1.還原自動(dòng)備份文件: [root@rhel1 bin]# ./crsctl stop crs Stopping resources. This could take several minutes. Successfully stopped CRS resources. Stopping CSSD. Shutting down CSS daemon. Shutdown request successfully issued. [root@rhel1 bin]# cat /etc/oracle/ocr.loc #Device/file /u01/ocfs2fs/ocr2 being deleted ocrconfig_loc=/u01/ocfs2fs/ocr local_only=false [root@rhel1 bin]# mv /u01/ocfs2fs/ocr /u01/ocfs2fs/ocr_bak [root@rhel1 crs_1]# cd cdata [root@rhel1 cdata]# cd crs [root@rhel1 crs]# ll total 23144 -rwxrwxr-x 1 oracle dba 3514368 Mar 1 11:00 13968559 -rwxrwxr-x 1 oracle dba 3514368 Mar 1 07:00 33426182 -rw-r--r-- 1 root root 3182592 Mar 8 15:17 34809936 -rwxrwxr-x 1 oracle dba 3514368 Feb 27 09:38 backup00.ocr -rwxrwxr-x 1 oracle dba 3514368 Feb 8 06:02 backup01.ocr -rwxrwxr-x 1 oracle dba 2142208 Nov 8 19:25 backup02.ocr -rwxrwxr-x 1 oracle dba 2142208 Nov 8 19:25 day.ocr -rwxrwxr-x 1 oracle dba 2142208 Nov 8 19:25 week.ocr [root@rhel1 crs]# cd ../../bin [root@rhel1 bin]# ./ocrconfig -restore /u01/app/oracle/crs_1/cdata/crs/backup02.ocr PROT-16: Internal Error [root@rhel1 bin]#touch /u01/ocfs2fs/ocr [root@rhel1 bin]#./ocrconfig -restore /u01/app/oracle/crs_1/cdata/crs/backup02.ocr [root@rhel1 bin]# ./crsctl start crs Attempting to start CRS stack The CRS stack will be started shortly [root@rhel1 bin]# ./crsctl check crs CSS appears healthy CRS appears healthy EVM appears healthy
其他: ./ocrconfig -showbackup //查看自動(dòng)備份。 ./ocrconfig -backuploc <dirname> //改變自動(dòng)備份目錄
|