> Device/File Name : /dev/raw/raw1
Device/File integrity check failed
n Device/File Name : /dev/raw/raw11
Device/File integrity check succeeded
Cluster registry integrity check succeeded
oracle@bo2dbp:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
> Device/File Name : /dev/raw/raw1
Device/File needs to be synchronized with the other device
Device/File Name : /dev/raw/raw11
Device/File integrity check succeeded
Cluster registry integrity check succeeded
#尽管此时ocr文件被破坏,但整个集群依旧处于Online状态,此处不列出,读者可自行验证
#接下来修复ocr
b、校验所在的裸设备处于可用状态
oracle@bo2dbp:~> sudo -s rcraw status | grep raw1
root''''''s password:
/dev/raw/raw1: bound to major 8, minor 33
/dev/raw/raw11: bound to major 8, minor 113
c、校验裸设备的权限
oracle@bo2dbp:~> ls -hltr /dev/raw/raw1
crw-rw---- 1 oracle dba 162, 1 2013-02-05 16:00 /dev/raw/raw1
oracle@bo2dbp:~> ssh bo2dbs ls -hltr /dev/raw/raw1
crw-rw---- 1 oracle dba 162, 1 2013-02-05 10:28 /dev/raw/raw1
d、重新初始化裸设备
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw1 bs=1024k count=200
dd: writing `/dev/raw/raw1': No space left on device
200+0 records in
199+0 records out
209698816 bytes (210 MB) copied, 4.84775 seconds, 43.3 MB/s
e、从镜像ocr恢复主ocr
#实际上等同于添加一个新的ocr。此时主ocr从镜像ocr复制内容。
#对于镜像ocr的损坏可以采用相同的方式如法炮制。
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -replace ocr /dev/raw/raw1
root''''s password:
oracle@bo2dbp:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
> Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw11
Device/File integrity check succeeded
Cluster registry integrity check succeeded
f、校验修复情况
oracle@bo2dbp:~> cluvfy comp ocr -n all
Verifying OCR integrity
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.
Uniqueness check for OCR device passed.
Checking the version of OCR...
OCR of correct Version "2" exists.
Checking data integrity of OCR...
Data integrity check for OCR passed.
OCR integrity check passed.
Verification of OCR integrity was successful.
2、从逻辑备份(导出的文件)中恢复OCR
a、首先查看一下ocr的位置
oracle@bo2dbp:~> more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw1
ocrconfig_loc=/dev/raw/raw1
ocrmirrorconfig_loc=/dev/raw/raw11
local_only=false
b、停止两个节点上的crs
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/crsctl stop crs
root''''''s password:
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
oracle@bo2dbp:~> ps -ef | grep d.bin | grep -v grep
oracle@bo2dbs:~> sudo -s /u01/oracle/crs/bin/crsctl stop crs
root''''s password:
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
# Author : Robinson
oracle@bo2dbs:~> ps -ef | grep d.bin | grep -v grep
c、尝试破坏ocr
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw1 bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.1811 seconds, 57.9 MB/s
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw11 bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.167224 seconds, 62.7 MB/s
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
oracle@bo2dbp:~> ps -ef | grep d.bin | grep -v grep
oracle@bo2dbp:~> ./crs_stat.sh #这个查看已经无法同crs通信
Resource name Target State
-------------- ------ -----
error connecting to CRSD at [(ADDRESS=(PROTOCOL=ipc)(KEY=ora_crsqs))] clsccon 184
oracle@bo2dbp:~> crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
d、从导出的备份文件中恢复ocr
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -import /u02/crs_bak/ocr_bak/exp/bo2dbp/ocr_bak.dmp
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
oracle@bo2dbp:~> ps -ef | grep d.bin | grep -v grep
oracle 27209 23220 0 10:32 ? 00:00:00 /u01/oracle/crs/bin/evmd.bin
root 27307 23392 0 10:32 ? 00:00:01 /u01/oracle/crs/bin/crsd.bin reboot
oracle 27613 27153 0 10:32 ? 00:00:00 /u01/oracle/crs/bin/ocssd.bin
#尝试启动第2个几点的crs
oracle@bo2dbs:~> sudo -s /u01/oracle/crs/bin/crsctl start crs
root''''''s password:
Attempting to start CRS stack
The CRS stack will be started shortly
e、在第二个节点上执行ocrcheck,此时显示ocrcheck成功
oracle@bo2dbs:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
> Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw11
Device/File integrity check succeeded
Cluster registry integrity check succeeded
oracle@bo2dbs:~> cluvfy comp ocr -n all #使用cluvfy工具校验
Verifying OCR integrity
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.
Uniqueness check for OCR device passed.
Checking the version of OCR...
OCR of correct Version "2" exists.
Checking data integrity of OCR...
Data integrity check for OCR passed.
OCR integrity check passed.
Verification of OCR integrity was successful.
3、从物理备份中恢复OCR
a、查看ocr的备份信息
oracle@bo2dbp:~> ocrconfig -showbackup
bo2dbp 2013/02/25 06:23:15 /u01/oracle/crs/cdata/crs
bo2dbp 2013/02/25 02:23:13 /u01/oracle/crs/cdata/crs
bo2dbp 2013/02/24 22:23:13 /u01/oracle/crs/cdata/crs
bo2dbp 2013/02/24 02:23:09 /u01/oracle/crs/cdata/crs
bo2dbp 2013/02/22 18:23:04 /u01/oracle/crs/cdata/crs
oracle@bo2dbp:~> ls -hltr /u01/oracle/crs/cdata/crs #此时ocr的备份位于节点1
total 40M
-rw-r--r-- 1 root root 6.7M 2013-02-22 18:23 week.ocr
-rw-r--r-- 1 root root 6.7M 2013-02-24 02:23 day.ocr
-rw-r--r-- 1 root root 6.7M 2013-02-24 22:23 backup02.ocr
-rw-r--r-- 1 root root 6.7M 2013-02-25 02:23 backup01.ocr
-rw-r--r-- 1 root root 6.7M 2013-02-25 02:23 day_.ocr
-rw-r--r-- 1 root root 6.7M 2013-02-25 06:23 backup00.ocr
b、尝试损坏ocr文件
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw1 bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.279904 seconds, 37.5 MB/s
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw11 bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.145885 seconds, 71.9 MB/s
#此时何ocr相关的操作都处于失败状态
oracle@bo2dbp:~> ocrcheck
Segmentation fault (core dumped)
oracle@bo2dbp:~> ocrconfig -showbackup
Segmentation fault (core dumped)
oracle@bo2dbp:~> crs_stat -t
Segmentation fault (core dumped)
#ASM实例和RAC实例依旧处于online
oracle@bo2dbp:~> ps -ef | grep pmon
oracle 7915 1 0 10:09 ? 00:00:00 asm_pmon_+ASM1
oracle 9234 1 0 10:10 ? 00:00:00 ora_pmon_ora10g1
oracle 31704 11229 0 10:26 pts/0 00:00:00 grep pmon
c、关闭crs,集群数据库及ASM
oracle@bo2dbp:~> export ORACLE_SID=ora10g1
oracle@bo2dbp:~> sqlplus / as sysdba
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------
db_name string ora10g
#此时查看一下ocr的位置,以便于恢复时查看对应的裸设备
oracle@bo2dbp:~> more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw1
ocrconfig_loc=/dev/raw/raw1
ocrmirrorconfig_loc=/dev/raw/raw11
local_only=false
#停止crs,收到错误提示
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/crsctl stop crs
root''''s password:
Segmentation fault
oracle@bo2dbs:~> sudo -s /u01/oracle/crs/bin/crsctl stop crs
root''''''s password:
Segmentation fault
#下面的查询中crsd进程已经crash
oracle@bo2dbp:~> ps -ef | grep d.bin | grep -v grep
oracle 5844 5189 0 10:09 ? 00:00:00 /u01/oracle/crs/bin/evmd.bin
oracle 6357 5883 0 10:09 ? 00:00:04 /u01/oracle/crs/bin/ocssd.bin
#关闭集群数据库
oracle@bo2dbp:~> export ORACLE_SID=ora10g1
oracle@bo2dbp:~> sqlplus / as sysdba
SQL> shutdown immediate;
oracle@bo2dbs:~> export ORACLE_SID=ora10g2
oracle@bo2dbs:~> sqlplus / as sysdba
SQL> shutdown immediate;
d、重启节点
bo2dbp:~ # reboot
bo2dbs:~ # reboot
e、校验ocr所在的裸设备及其权限
#校验所在的裸设备处于可用状态
oracle@bo2dbp:~> sudo -s rcraw status | grep raw1
root''''s password:
/dev/raw/raw1: bound to major 8, minor 33
/dev/raw/raw11: bound to major 8, minor 113
#校验裸设备的权限
oracle@bo2dbp:~> ls -hltr /dev/raw/raw1
crw-rw---- 1 oracle dba 162, 1 2013-02-05 16:00 /dev/raw/raw1
oracle@bo2dbp:~> ssh bo2dbs ls -hltr /dev/raw/raw1
crw-rw---- 1 oracle dba 162, 1 2013-02-05 10:28 /dev/raw/raw1
#清空裸设备
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw1 bs=1024k count=200
dd: writing `/dev/raw/raw1': No space left on device
200+0 records in
199+0 records out
209698816 bytes (210 MB) copied, 4.84775 seconds, 43.3 MB/s
oracle@bo2dbp:~> dd if=/dev/zero of=/dev/raw/raw11 bs=1024k count=200
dd: writing `/dev/raw/raw11': No space left on device
200+0 records in
199+0 records out
209698816 bytes (210 MB) copied, 2.30847 seconds, 90.8 MB/s
f、从物理备份中恢复ocr
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/ocrconfig -restore /u01/oracle/crs/cdata/crs/backup00.ocr
root''''''s password:
oracle@bo2dbp:~> sudo -s /u01/oracle/crs/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
oracle@bo2dbs:~> sudo -s /u01/oracle/crs/bin/crsctl start crs
root''''s password:
Attempting to start CRS stack
The CRS stack will be started shortly
g、校验恢复结果
oracle@bo2dbp:~> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 204560
Used space (kbytes) : 6184
Available space (kbytes) : 198376
> Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw11
Device/File integrity check succeeded
Cluster registry integrity check succeeded
oracle@bo2dbp:~> cluvfy comp ocr -n all
Verifying OCR integrity
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.
Uniqueness check for OCR device passed.
Checking the version of OCR...
OCR of correct Version "2" exists.
Checking data integrity of OCR...
Data integrity check for OCR passed.
OCR integrity check passed.
Verification of OCR integrity was successful.
#校验application
oracle@bo2dbp:~> ./crs_stat.sh | grep bo2dbp
ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_ORA10G_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
ora.ora10g.ora10g1.inst ONLINE ONLINE on bo2dbp
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html