ORACLE 11G RAC--維護叢集的OCR命令介紹

oracle_db發表於2012-08-16
ORACLE CLUSTERWARE把整個叢集的配置資訊放在共享儲存上,這個儲存就是OCR DISK.在叢集中只能有一個節點對OCR DISK進行讀寫,所有節點都會在記憶體中保留一份OCR的拷貝。OCR如何維護?

1.OCRDUMP,以ASCII的方式列印OCR的內容,產生的檔案只用於閱讀,不用於備份恢復OCR.
選項說明:
stdout把內容列印到輸出螢幕上
Filename內容輸出到檔案中
keyname只列印某個鍵及其子鍵的內容
xml以XML格式列印輸出

[oracle@rac1 bin]$ pwd
/u01/app/11.2.0/11ggrid/bin
[oracle@rac1 bin]$ ./ocrdump -stdout -keyname  SYSTEM.css -xml | more


08/16/2012 18:50:25
./ocrdump.bin -stdout -keyname SYSTEM.css -xml


SYSTEM.css
UNDEF

PROCR_ALL_ACCESS
PROCR_CREATE_SUB_KEY
PROCR_CREATE_SUB_KEY
root
root

執行這個命令的時候會生成一個日誌檔案,這個日誌檔案可用來檢視命令執行失敗的原因。
[root@rac1 client]# more ocrdump_25560.log
Oracle Database 11g Clusterware Release 11.2.0.1.0 - Production Copyright 1996, 2009 Oracle. All rights reserved.
2012-08-16 00:00:45.016: [ OCRDUMP][3086886592]ocrdump starts...
2012-08-16 00:00:45.143: [ OCRDUMP][3086886592]Exiting [status=success]...
[root@rac1 client]# pwd
/u01/app/11.2.0/11ggrid/log/rac1/client
[root@rac1 client]#
2.OCRCHECK,用來檢查OCR內容的一致性。執行它不需要引數
[root@rac1 bin]# pwd
/u01/app/11.2.0/11ggrid/bin
[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2592
         Available space (kbytes) :     259528
         ID                       : 2013995871
         Device/File Name         :       +CRS
                                    Device/File integrity check succeeded【這說明OCR內容是一致的】

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

[root@rac1 bin]#
執行這個命令也會產生一個日誌檔案
[root@rac1 bin]# pwd
/u01/app/11.2.0/11ggrid/bin
[root@rac1 bin]# cd /u01/app/11.2.0/11ggrid/log/rac1/client/
[root@rac1 client]# ls -ltr ocrcheck_*.log
-rw-r--r-- 1 root root 379 Aug  9 01:25 ocrcheck_6982.log
-rw-r--r-- 1 root root 379 Aug 16 00:03 ocrcheck_25681.log
-rw-r--r-- 1 root root 379 Aug 16 19:03 ocrcheck_16786.log
[root@rac1 client]# more ocrcheck_25681.log
Oracle Database 11g Clusterware Release 11.2.0.1.0 - Production Copyright 1996, 2009 Oracle. All rights reserved.
2012-08-16 00:03:19.633: [OCRCHECK][3086935744]ocrcheck starts...
2012-08-16 00:03:20.963: [OCRCHECK][3086935744]protchcheck: OCR status : total = [262120], used = [2592], avail = [259528]

2012-08-16 00:03:28.921: [OCRCHECK][3086935744]Exiting [status=success]...
[root@rac1 client]#
3.ocrconfig這個命令用來維護ocr磁碟,ocr磁碟最多隻能有兩個,一個為主一個為映象。
用法說明
[root@rac1 bin]# ./ocrconfig -help
Name:
        ocrconfig - Configuration tool for Oracle Cluster/Local Registry.

Synopsis:
        ocrconfig [option]
        option:
                [-local] -export
                                                    - Export OCR/OLR contents to a file
                [-local] -import          - Import OCR/OLR contents from a file
                [-local] -upgrade [ []]
                                                    - Upgrade OCR from previous version
                -downgrade [-version ]
                                                    - Downgrade OCR to the specified version
                [-local] -backuploc        - Configure OCR/OLR backup location
                [-local] -showbackup [auto|manual]  - Show OCR/OLR backup information
                [-local] -manualbackup              - Perform. OCR/OLR backup
                [-local] -restore         - Restore OCR/OLR from physical backup
                -replace -replacement
                                                    - Replace a OCR device/file with
                -add                      - Add a new OCR device/file
                -delete                   - Remove a OCR device/file
                -overwrite                          - Overwrite OCR configuration on disk
                -repair -add | -delete | -replace -replacement
                                                    - Repair OCR configuration on the local node
                -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.
        * Only -local -showbackup [manual] is supported.
        * Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.

[root@rac1 bin]#
檢視自動備份
[oracle@rac1 bin]$ pwd
/u01/app/11.2.0/11ggrid/bin
[oracle@rac1 bin]$ ./ocrconfig -showbackup

rac2     2012/08/16 15:36:35     /u01/app/11.2.0/11ggrid/cdata/rac-cluster/backup00.ocr

rac2     2012/08/16 11:36:34     /u01/app/11.2.0/11ggrid/cdata/rac-cluster/backup01.ocr

rac2     2012/08/16 07:36:34     /u01/app/11.2.0/11ggrid/cdata/rac-cluster/backup02.ocr

rac1     2012/08/15 00:28:16     /u01/app/11.2.0/11ggrid/cdata/rac-cluster/day.ocr

rac1     2012/08/08 00:27:44     /u01/app/11.2.0/11ggrid/cdata/rac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
[oracle@rac1 bin]$
4.使用匯入匯出執行備份與恢復
在對叢集做調整時,如增,刪節點前要先對OCR備份,以下操作風險大,‘虐’過。。。。

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

相關文章