ORACLE-RAC的CRS维护命令总结

转载 2016年05月31日 11:39:08


ORACLE-RAC的CRS维护命令总结


与CRS有关的命令均存放在$ORA_CRS_HOME/bin目录下,使用时请多加留意。本文将在日常CRS维护中较常用的命令予以演示,供参考。


1.启动CRS
如果CRS没有启动在使用crs_stat命令查看集群状态的时候将会收到如下的报错信息。
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.


在RAC环境下启动所有节点上的CRS。
[root@rac1 ~]# /oracle/app/crs/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly


[root@rac2 ~]# /oracle/app/crs/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly


集群从启动到全部启动完毕的总时间与系统想能和配置有关,一般需要3~10分钟的时间,请耐心等待。
注意:为保证集群环境可以正常无误的启动,一定要确保集群环境中各个节点的时钟保持一致。


与之对应的停止CRS命令为:“crsctl stop crs”。


2.查看CRS资源状态
集群资源启动完毕后,以在第一节点查看集群状态为例。
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac2
ora....DB1.srv application    ONLINE    ONLINE    rac1
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
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


3.关闭特定集群资源
1)获取集群资源名的方法
crs_stat命令会给出集群资源名的基本信息,结合适当的Shell技巧便可以得到当前环境下集群资源名信息。
RACDB1@rac1 /home/oracle$ crs_stat | grep -i name= | cut -d '=' -f2
ora.RACDB.RACDB1.inst
ora.RACDB.RACDB2.inst
ora.RACDB.db
ora.RACDB.taf.RACDB1.srv
ora.RACDB.taf.RACDB2.srv
ora.RACDB.taf.cs
ora.rac1.ASM1.asm
ora.rac1.LISTENER_RAC1.lsnr
ora.rac1.gsd
ora.rac1.ons
ora.rac1.vip
ora.rac2.ASM2.asm
ora.rac2.LISTENER_RAC2.lsnr
ora.rac2.gsd
ora.rac2.ons
ora.rac2.vip


2)以关闭ora.RACDB.RACDB1.inst资源为例
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stop ora.RACDB.RACDB1.inst
Attempting to stop `ora.RACDB.RACDB1.inst` on member `rac1`
Stop of `ora.RACDB.RACDB1.inst` on member `rac1` succeeded.


提示已成功关闭RACDB1数据库实例。
确认关闭后集群资源状态:
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    OFFLINE   OFFLINE
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac2
ora....DB1.srv application    ONLINE    OFFLINE
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
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


4.启动特定集群资源
启动ora.RACDB.RACDB1.inst资源
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_start ora.RACDB.RACDB1.inst
Attempting to start `ora.RACDB.RACDB1.inst` on member `rac1`
Start of `ora.RACDB.RACDB1.inst` on member `rac1` succeeded.


确认启动后状态:
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac2
ora....DB1.srv application    ONLINE    ONLINE    rac1
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
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


5.同时停掉所有集群资源
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stop -all
Attempting to stop `ora.RACDB.taf.RACDB1.srv` on member `rac1`
Attempting to stop `ora.rac1.gsd` on member `rac1`
Attempting to stop `ora.RACDB.taf.cs` on member `rac1`
Attempting to stop `ora.rac1.ons` on member `rac1`
Attempting to stop `ora.RACDB.taf.RACDB2.srv` on member `rac2`
Attempting to stop `ora.rac2.gsd` on member `rac2`
Attempting to stop `ora.rac2.ons` on member `rac2`
Stop of `ora.RACDB.taf.RACDB2.srv` on member `rac2` succeeded.
Stop of `ora.RACDB.taf.RACDB1.srv` on member `rac1` succeeded.
Attempting to stop `ora.RACDB.db` on member `rac2`
Stop of `ora.rac2.gsd` on member `rac2` succeeded.
Stop of `ora.rac1.gsd` on member `rac1` succeeded.
Stop of `ora.rac1.ons` on member `rac1` succeeded.
Stop of `ora.rac2.ons` on member `rac2` succeeded.
Stop of `ora.RACDB.taf.cs` on member `rac1` succeeded.
Stop of `ora.RACDB.db` on member `rac2` succeeded.
`ora.RACDB.RACDB1.inst` is already OFFLINE.
`ora.RACDB.RACDB2.inst` is already OFFLINE.
Attempting to stop `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1`
Attempting to stop `ora.rac1.ASM1.asm` on member `rac1`
Attempting to stop `ora.rac2.ASM2.asm` on member `rac2`
Attempting to stop `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
Stop of `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1` succeeded.
Attempting to stop `ora.rac1.vip` on member `rac1`
Stop of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
Attempting to stop `ora.rac2.vip` on member `rac2`
Stop of `ora.rac1.vip` on member `rac1` succeeded.
Stop of `ora.rac2.vip` on member `rac2` succeeded.
Stop of `ora.rac2.ASM2.asm` on member `rac2` succeeded.
Stop of `ora.rac1.ASM1.asm` on member `rac1` succeeded.
CRS-0216: Could not stop resource 'ora.RACDB.RACDB1.inst'.


CRS-0216: Could not stop resource 'ora.RACDB.RACDB2.inst'.


确认集群资源停止后状态
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    OFFLINE   OFFLINE
ora....B2.inst application    OFFLINE   OFFLINE
ora.RACDB.db   application    OFFLINE   OFFLINE
ora....DB1.srv application    OFFLINE   OFFLINE
ora....DB2.srv application    OFFLINE   OFFLINE
ora.....taf.cs application    OFFLINE   OFFLINE
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


6.同时启动所有集群资源
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_start -all
Attempting to start `ora.rac1.vip` on member `rac1`
Attempting to start `ora.rac1.ASM1.asm` on member `rac1`
Attempting to start `ora.rac2.vip` on member `rac2`
Attempting to start `ora.rac2.ASM2.asm` on member `rac2`
Start of `ora.rac1.vip` on member `rac1` succeeded.
Attempting to start `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1`
Start of `ora.rac2.vip` on member `rac2` succeeded.
Attempting to start `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
Start of `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1` succeeded.
Start of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
Start of `ora.rac1.ASM1.asm` on member `rac1` succeeded.
Attempting to start `ora.RACDB.RACDB1.inst` on member `rac1`
Start of `ora.rac2.ASM2.asm` on member `rac2` succeeded.
Attempting to start `ora.RACDB.RACDB2.inst` on member `rac2`
Start of `ora.RACDB.RACDB2.inst` on member `rac2` succeeded.
Start of `ora.RACDB.RACDB1.inst` on member `rac1` succeeded.
CRS-1002: Resource 'ora.rac1.ons' is already running on member 'rac1'


CRS-1002: Resource 'ora.rac2.ons' is already running on member 'rac2'


CRS-1002: Resource 'ora.RACDB.db' is already running on member 'rac1'


Attempting to start `ora.RACDB.taf.RACDB2.srv` on member `rac2`
Attempting to start `ora.RACDB.taf.cs` on member `rac1`
Attempting to start `ora.RACDB.taf.RACDB1.srv` on member `rac1`
Attempting to start `ora.rac1.gsd` on member `rac1`
Attempting to start `ora.rac2.gsd` on member `rac2`
Start of `ora.RACDB.taf.cs` on member `rac1` succeeded.
Start of `ora.RACDB.taf.RACDB2.srv` on member `rac2` succeeded.
Start of `ora.rac2.gsd` on member `rac2` succeeded.
Start of `ora.RACDB.taf.RACDB1.srv` on member `rac1` succeeded.
Start of `ora.rac1.gsd` on member `rac1` succeeded.
CRS-0223: Resource 'ora.RACDB.db' has placement error.


CRS-0223: Resource 'ora.rac1.ons' has placement error.


CRS-0223: Resource 'ora.rac2.ons' has placement error.


确认集群资源启动后状态
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac1
ora....DB1.srv application    ONLINE    ONLINE    rac1
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
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


NOTE:如果集群资源状态是UNKNOWN,使用crs_start –all命令将无法完成正常启动。


7.使用srvctl停止和启动节点应用
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/srvctl stop nodeapps -n rac1
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac1
ora....DB1.srv application    ONLINE    OFFLINE
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
ora....SM1.asm application    ONLINE    ONLINE    rac1
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    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


RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/srvctl start nodeapps -n rac1
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac1
ora....DB1.srv application    ONLINE    ONLINE    rac1
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
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


有关更多的srvctl命令的参考可以通过下面的方法获得:
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/srvctl
Usage: srvctl <command> <object> [<options>]
    command: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|asm|listener
For detailed help on each command and object and its options use:
    srvctl <command> <object> -h


使用“-h”选项可以获得更加详细的用法。


8.停止当前节点所有CRS资源
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crsctl stop resources
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.


RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    OFFLINE
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    OFFLINE
ora....DB1.srv application    ONLINE    OFFLINE
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    OFFLINE
ora....SM1.asm application    ONLINE    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    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


9.启动当前节点所有CRS资源
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crsctl start resources
Starting resources.
Successfully started CRS resources
RACDB1@rac1 /home/oracle$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1
ora....B2.inst application    ONLINE    ONLINE    rac2
ora.RACDB.db   application    ONLINE    ONLINE    rac2
ora....DB1.srv application    ONLINE    ONLINE    rac1
ora....DB2.srv application    ONLINE    ONLINE    rac2
ora.....taf.cs application    ONLINE    ONLINE    rac1
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


10.对CRS后台进程做健康检查
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy


11.检查OCR
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     104216
         Used space (kbytes)      :       4604
         Available space (kbytes) :      99612
         ID                       :  529429773
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded


                                    Device/File not configured


         Cluster registry integrity check succeeded


12.检查表决磁盘
RACDB1@rac1 /home/oracle$ /oracle/app/crs/bin/crsctl query css votedisk
 0.     0    /dev/raw/raw2


located 1 votedisk(s).

Oracle 12c RAC 中废弃的维护命令 crs_*

在Oracle 10g,11g的RAC中,我们常用crs_stat来监控RAC的运行状态。 但由于crs_stat 显示是不完整的,所以我们会对crs_stat 进行二次封装,让结果看起来更清爽一点。...

ORACLE RAC 集群命令crs_stat的显示格式太短了

ORACLE RAC 中的crs_stat -t 显示太难看了。我们DIY下

oracle rac集群 crs常用命令

oracle rac,常用的crs命令.
  • wyan117
  • wyan117
  • 2011年02月12日 13:21
  • 407

ORACLE RAC 11.2.0.4 for RHEL6.8 集群CRS异常导致集群命令无法使用

经查看集群相关日志可以确定,由于存储磁盘出现IO问题(或光线闪断、或IO延迟),导致集群CRS异常宕机。但是,比较奇怪的是,虽然CSR掉线了,ASM实例 和DB实例却好好的,还可以正常使用。查询ora...

ORACLE_CRS日常维护命令

  • 2015年04月02日 09:43
  • 39KB
  • 下载

Oracle 11g RAC 添加节点故障之--CRS资源启动故障

Oracle 11g RAC 添加节点故障之--CRS资源启动故障系统环境:操作系统:RedHat EL5.5集群软件: GI 11G数据库软件:Oracle 11.2.0.1故障原因:    由于新...
  • lqx0405
  • lqx0405
  • 2015年03月31日 11:59
  • 763

Oracle_RAC_CRS、OCR、Voting破坏重建

  • 2013年03月22日 15:32
  • 61KB
  • 下载

10 RAC CRS 2节点执行root.sh报错Waiting for the Oracle CRSD and EVMD 处理方法

1、--在安装10G clusterware 在二节点执行root.sh报错Waiting for the Oracle CRSD and EVMD to start处理方法 [root@nydb2 ...

Oracle RAC 第二节点 root.sh 报错 Timed out waiting for the CRS stack to start

在VBox 上安装11.2.0.1的RAC。 这里打算安装11.2.0.1是因为从11.2.0.2以后的版本对public 和private 网卡网段区分很严格,这个网卡必须配置在不同的网段。 而在1...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ORACLE-RAC的CRS维护命令总结
举报原因:
原因补充:

(最多只允许输入30个字)