Oracle RAC 常用维护工具和命令(四)

2014-11-24 13:09:13 · 作者: · 浏览: 13

Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
3.2.3 ocrconfig
该命令用于维护OCR 磁盘,安装clusterware过程中,如果选择External Redundancy冗余方式,则只能输入一个OCR磁盘位置。 但是Oracle允许配置两个OCR 磁盘互为镜像,以防止OCR 磁盘的单点故障。OCR 磁盘和Votedisk磁盘不一样,OCR磁盘最多只能有两个,一个Primary OCR 和一个Mirror OCR。
[root@raw1 bin]# ./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.
-- 查看自助备份
[root@raw1 bin]# ./ocrconfig -showbackup
在缺省情况下,OCR自动备份在$CRS_HOME/CRS/CDATA/cluster_name 目录下,可以通过ocrconfig -backuploc 命令修改到新的目录
3.2.4 使用导出,导入进行备份和恢复
Oracle 推荐在对集群做调整时,比如增加,删除节点之前,应该对OCR做一个备份,可以使用export 备份到指定文件,如果做了replace或者restore 等操作,Oracle 建议使用cluvfy comp ocr -n all 命令来做一次全面的检查。该命令在clusterware 的安装软件里。
1) 首先关闭所有节点的CRS
[root@raw1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2) 用root 用户导出OCR内容
[root@raw1 bin]# ./ocrconfig -export /u01/ocr.exp
3) 重启CRS
[root@raw1 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
4) 检查CRS 状态
[root@raw1 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
5)破坏OCR内容
[root@raw1 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=1024 count=102400
102400+0 records in
102400+0 records out
6) 检查OCR一致性
[root@raw1 bin]# ./ocrcheck
PROT-601: Failed to initialize ocrcheck
7)使用cluvfy 工具检查一致性
[root@raw1 cluvfy]# ./runcluvfy.sh comp ocr -n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.
Verification cannot proceed.
8) 使用Import 恢复OCR 内容
[root@raw1 bin]# ./ocrconfig -import /u01/ocr.exp
9)再次检查OCR
[root@raw1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 147352
Used space (kbyte