ITPub博客

首页 > 数据库 > Oracle > 10g rac日常维护

10g rac日常维护

原创 Oracle 作者:sxitsxit 时间:2015-02-01 22:22:22 0 删除 编辑

日常操作:

停止状态为unknow的资源,直接执行 crs_stop -f xx资源名

要使root用户也能使用集群资源的命令,可以在root用户的配置文件中追加$ORA_CRS_HOME/bin的路径 ,如


[root@rac1 ~]# cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/home/oracle/product/10.2.0/crs_1/bin

export PATH
unset USERNAME

[root@rac1 ~]# pwd
/root
[root@rac1 ~]#


1:创建asm磁盘的步骤


[root@rac1 rules.d]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]:
Default group to own the driver interface [dba]:
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@rac1 rules.d]#
[root@rac1 rules.d]#
[root@rac1 rules.d]# /etc/init.d/oracleasm createdisk VOL4 /dev/sdf1
Marking disk "VOL4" as an ASM disk: [  OK  ]
[root@rac1 rules.d]#
[root@rac1 rules.d]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [  OK  ]
[root@rac1 rules.d]#
[root@rac1 rules.d]# /etc/init.d/oracleasm listdisks
VOL4


可以在命令行查找创建的asm磁盘对应的逻辑分区

[root@rac2 raw]#
[root@rac2 raw]# oracleasm querydisk -d VOL4
Disk "VOL1" is a valid ASM disk on device /dev/sdf1[8,97]
[root@rac2 raw]#
[root@rac2 raw]# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes


2:核心集群层 crsctl

crsctl可以用来检查CRS进程栈、每个CRS进程的状态,管理votedisk、跟踪CRS进程等功能

以root用户直接在命令行下执行 crsctl 就可以出来很多选项


检查CRS进程栈的状态

[root@rac1 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

分别检查 CRS 的3个组件的状态
[root@rac1 ~]# crsctl check cssd
CSS appears healthy
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# crsctl check crsd
CRS appears healthy
[root@rac1 ~]#
[root@rac1 ~]# crsctl check evmd
EVM appears healthy
[root@rac1 ~]#


CRS进程栈默认随着操作系统的启动而启动,有时处于维护的目的,需要手动关闭这个功能

crsctl enable/disable crs命令实际修改的是/etc/oracle/scls_scr/rac1/root下的 crsstart 文件
[root@rac1 root]#
[root@rac1 root]# ls
crsdboot  crsstart  cssrun  noclsmon  nooprocd
[root@rac1 root]#
[root@rac1 root]#
[root@rac1 root]# more crsstart
enable
[root@rac1 root]#
[root@rac1 root]# crsctl enable crs
[root@rac1 root]#
[root@rac1 root]# ls
crsdboot  crsstart  cssrun  noclsmon  nooprocd
[root@rac1 root]# pwd
/etc/oracle/scls_scr/rac1/root
[root@rac1 root]#
[root@rac1 root]# more crsstart
enable
[root@rac1 root]#


crs资源启动或停止

[root@rac2 ~]#
[root@rac2 ~]# $CRS_HOME/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@rac2 ~]#
[root@rac2 ~]# ps -ef |grep crs
root     30591     1  0 16:00 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root     30776  6432  0 16:00 pts/1    00:00:00 grep crs
[root@rac2 ~]#

管理crs资源的命令 crsctl (都是用root权限管理)

3:votedisk日常维护


添加和删除votedisk都比较危险,必须停止数据库、停止ASM、停止CRS栈之后才能操作,而且必须使用 -force参数

votedisk盘在添加过程中,就开始跟原来的盘做镜像同步


下面演示如何删除、添加votedisk


查看当前votedisk的位置及集群状态

[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
ora.racdb.db   application    ONLINE    ONLINE    rac1       
ora....b1.inst application    ONLINE    ONLINE    rac1       
ora....b2.inst application    ONLINE    ONLINE    rac2       
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# crsctl query css votedisk
0.     0    /dev/raw/raw3
1.     0    /dev/raw/raw4
2.     0    /dev/raw/raw5


停止集群资源

[root@rac1 ~]# srvctl stop nodeapps -n rac1 //这里的gsd、ons、vip和lsnr都属于nodeapps资源
[root@rac1 ~]#
[root@rac1 ~]# srvctl stop nodeapps -n rac2
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# srvctl stop database -d racdb
[root@rac1 ~]#
[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE


停止所有节点的CRS栈 (两个节点都要执行)

[root@rac1 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 ~]#
[root@rac1 ~]# ps -ef |grep crs
root      4848     1  0 20:09 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root      5035  9485  0 20:09 pts/1    00:00:00 grep crs
[root@rac1 ~]#


删除两个votedisk盘


[root@rac1 ~]# crsctl delete css votedisk /dev/raw/raw3 //必须加 -force 参数
Cluster is not in a ready state for online disk removal
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# crsctl delete css votedisk /dev/raw/raw3 -force
successful deletion of votedisk /dev/raw/raw3.
[root@rac1 ~]#
[root@rac1 ~]# crsctl delete css votedisk /dev/raw/raw4 -force
successful deletion of votedisk /dev/raw/raw4.
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# crsctl query css votedisk
0.     0    /dev/raw/raw5

located 1 votedisk(s).
[root@rac1 ~]#


然后再重新添加一下刚刚删除的votedisk盘

[root@rac1 ~]# crsctl add css votedisk /dev/raw/raw3 //要加 -force参数
Cluster is not in a ready state for online disk addition
[root@rac1 ~]#
[root@rac1 ~]# crsctl add css votedisk /dev/raw/raw3 -force
Now formatting voting disk: /dev/raw/raw3
successful addition of votedisk /dev/raw/raw3.
[root@rac1 ~]#
[root@rac1 ~]# crsctl add css votedisk /dev/raw/raw4 -force
Now formatting voting disk: /dev/raw/raw4
successful addition of votedisk /dev/raw/raw4.
[root@rac1 ~]#

再次查询votedisk盘

[root@rac1 ~]# crsctl query css votedisk
0.     0    /dev/raw/raw3
1.     0    /dev/raw/raw4
2.     0    /dev/raw/raw5

located 3 votedisk(s).


最后启动 CRS栈 (2个节点都要执行)


[root@rac1 ~]#
[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
ora.racdb.db   application    ONLINE    ONLINE    rac2       
ora....b1.inst application    ONLINE    ONLINE    rac1       
ora....b2.inst application    ONLINE    ONLINE    rac2

votedisk 备份与恢复


先在两个节点crs完全停下来再做备份


添加多个votedisk后,这些votedisk互为镜像 ,一般votedisk的数量是奇数(3个或5个)。如果有多个votedisk ,
则必须一半以上的votedisk同时可用,clusterware才能正常工作,否则集群会立刻宕机,所有节点立即重启

如果集群开始有3个votedisk ,然后删除2个votedisk ,那么启动肯定报错 ,报错日志在

$CRS_HOME/log/node_x/  主要的日志为 alertnode_x.log

$CRS_HOME/log/node_x/cssd/ocssd.log

破坏votedisk磁盘(先停掉集群资源)

[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
ora.racdb.db   application    ONLINE    ONLINE    rac2       
ora....b1.inst application    ONLINE    ONLINE    rac1       
ora....b2.inst application    ONLINE    ONLINE    rac2       
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# crsctl query css votedisk
0.     0    /dev/raw/raw3
1.     0    /dev/raw/raw4
2.     0    /dev/raw/raw5

located 3 votedisk(s).


先停掉集群资源

[root@rac1 ~]# srvctl stop nodeapps -n rac1
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# srvctl stop nodeapps -n rac2
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# srvctl stop database -d racdb
[root@rac1 ~]#
[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE


再到两个节点上 停止CRS 栈

然后备份votedisk

dd if=/dev/raw/raw25 of=/home/oracle/votedisk28 bs=10240k
这个表示全部导出来,如果加了count的话,导出的大小为 bs* count

[root@rac1 ~]# dd if=/dev/raw3 of=/home/oracle/votedisk_raw3 bs=10240k
dd: opening `/dev/raw3': No such file or directory
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# dd if=/dev/raw/raw3 of=/home/oracle/votedisk_raw3 bs=10240k
20+1 records in
20+1 records out
[root@rac1 ~]#
[root@rac1 ~]# dd if=/dev/raw/raw4 of=/home/oracle/votedisk_raw4 bs=10240k
20+1 records in
20+1 records out
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# dd if=/dev/raw/raw5 of=/home/oracle/votedisk_raw5 bs=10240k
20+1 records in
20+1 records out
[root@rac1 ~]#


然后破坏3个votedisk中的 2个

[root@rac1 ~]# dd if=/dev/zero of=/dev/raw/raw3 bs=10240k count=20
20+0 records in
20+0 records out
[root@rac1 ~]#
[root@rac1 ~]# dd if=/dev/zero of=/dev/raw/raw4 bs=10240k count=20
20+0 records in
20+0 records out
[root@rac1 ~]#


然后分别在两个节点上再启动 crs 栈

[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly


在$CRS_HOME/log/node_name/  主要的日志为 alertnode_x.log 中提示启动不了

[oracle@rac1 ~]$  cd $ORA_CRS_HOME/
[oracle@rac1 crs_1]$ cd log
[oracle@rac1 log]$ ls
crs  rac1
[oracle@rac1 log]$ cd rac1/
[oracle@rac1 rac1]$ ls
admin  alertrac1.log  client  crsd  cssd  evmd  racg
[oracle@rac1 rac1]$ pwd
/home/oracle/product/10.2.0/crs_1/log/rac1
[oracle@rac1 rac1]$
[oracle@rac1 rac1]$ tail -f alertrac1.log
2014-11-03 23:30:35.484
[cssd(17895)]CRS-1604:CSSD voting file is offline: /dev/raw/raw3. Details in /home/oracle/product/10.2.0/crs_1/log/rac1/cssd/ocssd.log.
2014-11-03 23:30:35.492
[cssd(17895)]CRS-1604:CSSD voting file is offline: /dev/raw/raw4. Details in /home/oracle/product/10.2.0/crs_1/log/rac1/cssd/ocssd.log.
2014-11-03 23:30:35.505
[cssd(17895)]CRS-1605:CSSD voting file is online: /dev/raw/raw5. Details in /home/oracle/product/10.2.0/crs_1/log/rac1/cssd/ocssd.log


[root@rac1 ~]# tail -f /home/oracle/product/10.2.0/crs_1/log/rac1/cssd/ocssd.log
[    CSSD]2014-11-03 23:26:52.632 [3086898880] >TRACE:   clssnmDiskStateChange: state from 1 to 2 disk (2//dev/raw/raw5)
[    CSSD]2014-11-03 23:26:54.632 [35842976] >TRACE:   clssnmvDiskOpen: corrupt kill block on disk (0x00!=0x636c73536b696c4c)
[    CSSD]2014-11-03 23:26:54.632 [35842976] >TRACE:   clssnmDiskStateChange: state from 2 to 3 disk (0//dev/raw/raw3)
[    CSSD]2014-11-03 23:26:54.655 [46332832] >TRACE:   clssnmvDiskOpen: corrupt kill block on disk (0x00!=0x636c73536b696c4c)
[    CSSD]2014-11-03 23:26:54.655 [46332832] >TRACE:   clssnmDiskStateChange: state from 2 to 3 disk (1//dev/raw/raw4)
[    CSSD]2014-11-03 23:26:54.669 [68123552] >TRACE:   clssnmDiskStateChange: state from 2 to 4 disk (2//dev/raw/raw5)
[    CSSD]2014-11-03 23:26:54.691 [68123552] >TRACE:   clssnmReadDskHeartbeat: node(2) is down. rcfg(4) wrtcnt(1425) LATS(0) Disk lastSeqNo(1425)
[    CSSD]2014-11-03 23:26:54.741 [3086898880] >ERROR:   clssnmvInit: Insufficient number of voting devices available (1 of 3)
[    CSSD]2014-11-03 23:26:54.741 [3086898880] >ERROR:   clssnmInitNMInfo: Failed to initialize voting device
[    CSSD]2014-11-03 23:26:54.741 [3086898880] >ERROR:   clssscmain: clssnmNMInitialize failed

然后离线给它加一块votedisk ,再启动crs 就可以了

先删除损坏的文件

[root@rac1 ~]#  crsctl delete css votedisk /dev/raw/raw5  -force
successful deletion of votedisk /dev/raw/raw5.
[root@rac1 ~]#
[root@rac1 ~]#  crsctl delete css votedisk /dev/raw/raw4  -force
successful deletion of votedisk /dev/raw/raw4.
[root@rac1 ~]#
[root@rac1 ~]#  crsctl delete css votedisk /dev/raw/raw3  -force
only one votedisk /dev/raw/raw3 configured.
please add another disk before removing the last one.


再将备份的文件还原回去

[root@rac1 ~]# dd if=/home/oracle/votedisk_raw5  of=/dev/raw/raw5 bs=10240k
20+1 records in
20+1 records out
[root@rac1 ~]#
[root@rac1 ~]# dd if=/home/oracle/votedisk_raw4  of=/dev/raw/raw4 bs=10240k
20+1 records in
20+1 records out

再将磁盘添加进去

[root@rac1 ~]# crsctl add    css votedisk /dev/raw/raw4 -force
Now formatting voting disk: /dev/raw/raw4
successful addition of votedisk /dev/raw/raw4.
[root@rac1 ~]#
[root@rac1 ~]# crsctl add    css votedisk /dev/raw/raw5 -force
Now formatting voting disk: /dev/raw/raw5
successful addition of votedisk /dev/raw/raw5.

然后删除损坏的 第3块盘

[root@rac2 ~]# crsctl delete css votedisk /dev/raw/raw3  -force
successful deletion of votedisk /dev/raw/raw3.
[root@rac2 ~]#

再重新添加第3块盘

[root@rac1 ~]# dd if=/home/oracle/votedisk_raw3  of=/dev/raw/raw3 bs=10240k
20+1 records in
20+1 records out
[root@rac1 ~]#


两个节点上分别启动CRS栈

[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@rac1 ~]#

在日志中可以看到 crs已经开始启动


[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE


在CRS启动过程中,添加votedisk 会导致系统重启

[root@rac2 ~]# crsctl add    css votedisk /dev/raw/raw3 -force
Now formatting voting disk: /dev/raw/raw3

CRS启动过程中执行这个命令导致rac1 和 rac2 两个节点都重启了


dd if=/home/oracle/votedisk_raw5  of=/dev/raw/raw5 bs=10240k

假如这几个votedisk都坏了,用dd添加进去


10g rac环境中开始有一个votedisk,后来我又重新添加了 2个  
那么在这两个盘初始化的过程中 就开始跟 原有的第一块盘 做数据同步了

11gR2可以把ocr和votedisk都放在diskgroup里面了,这样的话就依赖于diskgroup的normal,high or external了

11g R2的ocr和voting disk放在disk group里面了,ocr和voting disk oracle都会自动备份,放在diskgroup里面
之后当把asm shundow之后crs也停止了,这个和10g是不一样的


4:OCR日常维护

OCR 全名为Oracle Clusterware Registry ,负责整个集群的配置信息,主要解决健忘问题。
oracle把整个集群的配置信息放在共享存储上,这个存储就是OCR Disk 。整个集群中,只能有一个节点对OCR Disk进行
读写操作,这个节点叫做Master Node,所有节点都会在内存中保留一份OCR的拷贝,同时有一个OCR Process从这个内存
中读取内容。 OCR内容发生改变时,由Master Node的OCR Process负责同步到其他节点的OCR Process

OCR磁盘最多有两个,一个 Primary OCR 和一个 Mirror OCR

Master Node 的CRSD进程对OCR的内容进行备份,每4小时备份一次,保存在$CRS_HOME/cdata/crs目录下


检查OCR的状态

[oracle@rac1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     208792
         Used space (kbytes)      :       3816
         Available space (kbytes) :     204976
         ID                       :  998369930
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

[oracle@rac1 ~]$


显示当前有两份OCR信息,这些信息记录到 /etc/oracle/ocr.loc中

[oracle@rac1 ~]$ cat /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/raw1
ocrmirrorconfig_loc=/dev/raw/raw2
local_only=FALSE
[oracle@rac1 ~]$


查看 OCR 自动备份

[oracle@rac1 bin]$ ocrconfig -showbackup

自动备份默认保存在 $CRS_HOME/cdata/crs目录下 ,这些自动备份的文件都是在线备份,必须使用ocrconfig -restore xx来恢复


手动备份OCR、删除OCR镜像、模拟损坏OCR的恢复过程


首先关闭所有节点的CRS (两个节点都要执行stop命令, 而start只需在一个节点执行)

[root@rac1 ~]# crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.


导出CRS内容 (必须用root用户,备份保留在当前目录下)

[root@rac2 ~]# ocrconfig -export ocrexp1104.exp
[root@rac2 ~]# pwd
/root
[root@rac2 ~]#
[root@rac2 ~]# ls -l ocr*
-rw-r--r--  1 root root 84904 Nov  4 21:25 ocrexp1104.exp
[root@rac2 ~]#
[root@rac2 ~]#


重新启动两个节点的CRS

[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

检查CRS的状态

[root@rac2 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[root@rac2 ~]#


[root@rac1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     208792
         Used space (kbytes)      :       3820
         Available space (kbytes) :     204972
         ID                       :  998369930
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

[root@rac1 ~]#

破坏 OCR 和 OCR Miror内容

[root@rac1 ~]# dd if=/dev/zero of=/dev/raw/raw1 bs=10240k   count=20
20+0 records in
20+0 records out
[root@rac1 ~]#
[root@rac1 ~]# dd if=/dev/zero of=/dev/raw/raw2 bs=10240k  count=20
20+0 records in
20+0 records out
[root@rac1 ~]#


再次检查OCR一致性 ,发现失败

[root@rac1 ~]# ocrcheck
PROT-601: Failed to initialize ocrcheck
[root@rac1 ~]#
[root@rac1 ~]# crsctl check crs
Failure 1 contacting CSS daemon
Cannot communicate with CRS
EVM appears healthy
[root@rac1 ~]#


也可以使用clusterware安装包中的cluvfy工具检查一致性

[root@rac1 cluvfy]# /home/oracle/clusterware/cluvfy/runcluvfy.sh comp ocr -n all

Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.

Verification cannot proceed.


使用import恢复 OCR 内容

[root@rac2 ~]# ocrconfig -import /root/ocrexp1104.exp
[root@rac2 ~]#

再次核对CRS状态

[root@rac2 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     208792
         Used space (kbytes)      :       3820
         Available space (kbytes) :     204972
         ID                       : 1348827580
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded


再次启动CRS

[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

启动后检查CRS状态

[root@rac1 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy

在线删除CRS镜像

[root@rac2 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     208792
         Used space (kbytes)      :       3820
         Available space (kbytes) :     204972
         ID                       : 1348827580
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

[root@rac2 ~]#
[root@rac2 ~]# ocrconfig -replace ocr  // //注意参数为ocr,不添加文件名就表示删除
[root@rac2 ~]#
[root@rac2 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     208792
         Used space (kbytes)      :       3820
         Available space (kbytes) :     204972
         ID                       : 1348827580
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

                                    Device/File not configured

         Cluster registry integrity check succeeded

[root@rac2 ~]#


在线添加OCR镜像

[root@rac2 ~]# ocrconfig -replace ocrmirror /dev/raw/raw1  //注意参数为ocrmirror
PROT-22: Storage too small
[root@rac2 ~]#

因为我的db是10.2.0.1 ,这个错误是个bug ,在10。2.0.2中修正了。 要想导入成功,有两种方法:

a:直接在线添加一个 大于当前OCR 盘容量的新磁盘,该盘最小必须大于128M

b:在关闭CRS以后,手动修改 /etc/oracle/ocr.loc文件

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24862808/viewspace-1423062/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-04-14

  • 博文量
    98
  • 访问量
    298301