Oracle10g OCR及Voting Disk的備份

season0891發表於2011-07-05
站內相關文章|Related Articles





在Oracle10g RAC環境中,OCR及Voting Disk對於叢集來說都是非常重要的。

那麼如何對兩者進行備份並且能夠在故障時進行恢復就顯得極為重要。
OCR的資料Oracle會自動執行備份,透過ocrconfig -showbackup命令可以檢視這些備份:
bash-2.05$ ocrconfig -showbackup

db490-9    2008/03/01 19:26:29    /opt/oracle/product/10.2.0/crs10g/cdata/crs
db490-9    2008/03/01 15:26:29    /opt/oracle/product/10.2.0/crs10g/cdata/crs
db490-9    2008/03/01 11:26:29    /opt/oracle/product/10.2.0/crs10g/cdata/crs
db490-9    2008/02/29 03:26:26    /opt/oracle/product/10.2.0/crs10g/cdata/crs
db490-9    2008/02/22 03:26:13    /opt/oracle/product/10.2.0/crs10g/cdata/crs
bash-2.05$ hostname
db480-5

注意這個備份只會儲存在一個節點上,並非所有節點都會記錄這個備份。
在備份節點的相應目錄下我們可以找到這些備份:
$ cd /opt/oracle/product/10.2.0/crs10g/cdata/crs
$ ls -al
total 66420
drwxrwxr-x  2 oracle  dba          512 Mar  1 19:26 .
drwxrwxr-x  4 oracle  dba          512 Nov 23 16:39 ..
-rw-r--r--  1 root    root    4845568 Mar  1 19:26 backup00.ocr
-rw-r--r--  1 root    root    4845568 Mar  1 15:26 backup01.ocr
-rw-r--r--  1 root    root    4845568 Mar  1 11:26 backup02.ocr
-rw-r--r--  1 root    root    4845568 Feb 29 03:26 day.ocr
-rw-r--r--  1 root    root    4845568 Mar  1 03:26 day_.ocr
-rw-r--r--  1 root    root    4845568 Feb 22 03:26 week.ocr
-rw-r--r--  1 root    root    4845568 Feb 29 03:26 week_.ocr

當出現故障時,可以透過ocrconfig命令來執行恢復,透過幫助可以看到詳細的用法:
$ ocrconfig -help
Name:
        ocrconfig - Configuration tool for Oracle Cluster Registry.

Synopsis:
        ocrconfig [option]
        option:
                -export [-s online]
                                                    - Export cluster register contents to a file
                -import                   - Import cluster registry contents from a file
                -upgrade [ []]
                                                    - Upgrade cluster registry from previous version
                -downgrade [-version ]
                                                    - Downgrade cluster registry to the specified version
                -backuploc                 - Configure periodic backup location
                -showbackup                        - Show backup information
                -restore                 - Restore from physical backup
                -replace ocr|ocrmirror [] - Add/replace/remove a OCR device/file
                -overwrite                          - Overwrite OCR configuration on disk
                -repair ocr|ocrmirror     - Repair local OCR configuration
                -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.
如果不出意外,恢復過程將會很簡單,透過 ocrconfig -restore 就可以回覆這裡的物理備份。

對於voting disk可以透過dd來進行備份。
首先透過 crsctl query css votedisk 命令可以找到voting disk的儲存地:
bash-2.05$ crsctl query css votedisk
0.    0    /dev/rdsk/voting

located 1 votedisk(s).

然後透過dd備份:
bash-2.05$ dd if=/dev/rdsk/voting f=voting.bak
211456+0 records in
211456+0 records out
bash-2.05$ ls -al
total 211588
drwxr-xr-x  2 oracle  dba          512 Mar  1 21:13 .
drwxr-xr-x  11 oracle  dba          512 Jan 25 17:59 ..
-rw-r--r--  1 oracle  dba      108265472 Mar  1 21:14 voting.bak
     
當需要恢復時,透過dd進行恢復即可。這個voting disk記錄了什麼內容呢?
透過strings可以將其中的字串取出來看一個印象:
bash-2.05$ strings voting.bak |sort -u
CLSf
Vote
cLssTock
clSs0pEr
clsSkilL
db480-5
db490-9
z{|}

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-701364/,如需轉載,請註明出處,否則將追究法律責任。

相關文章