ORACLE 11G RAC--维护集群的OCR命令介绍

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15720542/viewspace-741128/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值