CRS常用维护命令.docx
- 文档编号:4902343
- 上传时间:2022-12-11
- 格式:DOCX
- 页数:20
- 大小:23.22KB
CRS常用维护命令.docx
《CRS常用维护命令.docx》由会员分享,可在线阅读,更多相关《CRS常用维护命令.docx(20页珍藏版)》请在冰豆网上搜索。
CRS常用维护命令
CRS常用命令
常用的crs命令如下:
$ORA_CRS_HOME/bin/crs_stat–t
此命令主要用来检查crs资源状态
例如
[oracle@postdb2/]$$ORA_CRS_HOME/bin/crs_stat–t
NameTypeTargetStateHost
------------------------------------------------------------
ora....CL1.srvapplicationONLINEONLINEpostdb1
ora....CL2.srvapplicationONLINEONLINEpostdb2
ora....TEST.csapplicationONLINEONLINEpostdb1
ora....L1.instapplicationONLINEONLINEpostdb1
ora....L2.instapplicationONLINEONLINEpostdb2
ora.ORCL.dbapplicationONLINEONLINEpostdb1
ora....SM1.asmapplicationONLINEONLINEpostdb1
ora....C1.lsnrapplicationONLINEONLINEpostdb1
ora.postdb1.gsdapplicationONLINEONLINEpostdb1
ora.postdb1.onsapplicationONLINEONLINEpostdb1
ora.postdb1.vipapplicationONLINEONLINEpostdb1
ora....SM2.asmapplicationONLINEONLINEpostdb2
ora....C2.lsnrapplicationONLINEONLINEpostdb2
ora.postdb2.gsdapplicationONLINEONLINEpostdb2
ora.postdb2.onsapplicationONLINEONLINEpostdb2
ora.postdb2.vipapplicationONLINEONLINEpostdb2
[oracle@postdb2/]$
$ORA_CRS_HOME/bin/crs_start–all
此命令用来启动所有的集群服务,但是启动的前提是资源状态State不能是UNKNOWN。
$ORA_CRS_HOME/bin/crs_start集群服务名(集群服务名可以通过$ORA_CRS_HOME/bin/crs_stat得到)
$ORA_CRS_HOME/bin/crs_stop–all
$ORA_CRS_HOME/bin/crs_stop集群服务名(集群服务名可以通过$ORA_CRS_HOME/bin/crs_stat得到)
上面的一组crs命令是用来启动关闭crs服务的,下面通过一个真实的环境,具体讲解这些命令的使用。
举例如下:
OracleRAC在安装完毕后,重启RAC,一些服务不能启动,手动启动也没用。
下面是系统自动启动以后的情况;
[oracle@postdb1~]$crs_stat–t
NameTypeTargetStateHost
------------------------------------------------------------
ora....CL1.srvapplicationONLINEUNKNOWNpostdb1
ora....CL2.srvapplicationONLINEUNKNOWNpostdb2
ora....TEST.csapplicationONLINEUNKNOWNpostdb2
ora....L1.instapplicationONLINEOFFLINE
ora....L2.instapplicationONLINEOFFLINE
ora.ORCL.dbapplicationONLINEUNKNOWNpostdb1
ora....SM1.asmapplicationONLINEUNKNOWNpostdb1
ora....C1.lsnrapplicationONLINEUNKNOWNpostdb1
ora.postdb1.gsdapplicationONLINEUNKNOWNpostdb1
ora.postdb1.onsapplicationONLINEUNKNOWNpostdb1
ora.postdb1.vipapplicationONLINEONLINEpostdb1
ora....SM2.asmapplicationONLINEUNKNOWNpostdb2
ora....C2.lsnrapplicationONLINEUNKNOWNpostdb2
ora.postdb2.gsdapplicationONLINEUNKNOWNpostdb2
ora.postdb2.onsapplicationONLINEUNKNOWNpostdb2
ora.postdb2.vipapplicationONLINEONLINEpostdb2
[oracle@postdb1~]$
可以看到,只有vip是能自动启动的!
其它资源都处于UNKNOWN状态下。
手工用srvctl启动试试!
$srvctlstartnodeapps-nrac1
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.gsd'hasplacementerror.
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.vip'hasplacementerror.
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.ons'hasplacementerror.
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.LISTENER_RAC1.lsnr'hasplacementerror.
测试crs:
$crsctlcheckcrs
CSSappearshealthy
CRSappearshealthy
EVMappearshealthy
[oracle@rac1bin]$crsctlstartresources
Startingresources.
SuccessfullystartedCRSresources
[oracle@rac1bin]$pwd
/oracle/app/oracle/oracle/product/10.2.0/crs/bin
[oracle@rac1bin]$gsdctlstop
[oracle@rac1bin]$gsdctlstatus
[oracle@rac1bin]$./gsdctlstatus
[oracle@rac1bin]$gsdctlstart
[oracle@rac1bin]$srvctlstartnodeapps-nrac1
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.gsd'hasplacementerror.
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.vip'hasplacementerror.
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.ons'hasplacementerror.
CRS-1028:
Dependencyanalysisfailedbecauseof:
CRS-0223:
Resource'ora.rac1.LISTENER_RAC1.lsnr'hasplacementerror.
[oracle@rac1~]$crs_stat-t
NameTypeTargetStateHost
------------------------------------------------------------
ora....CL1.srvapplicationONLINEUNKNOWNrac1
ora....CL2.srvapplicationONLINEUNKNOWNrac2
ora....TEST.csapplicationONLINEUNKNOWNrac2
ora....L1.instapplicationONLINEOFFLINE
ora....L2.instapplicationONLINEOFFLINE
ora.ORCL.dbapplicationONLINEUNKNOWNrac1
ora....SM1.asmapplicationONLINEUNKNOWNrac1
ora....C1.lsnrapplicationONLINEUNKNOWNrac1
ora.rac1.gsdapplicationONLINEUNKNOWNrac1
ora.rac1.onsapplicationONLINEUNKNOWNrac1
ora.rac1.vipapplicationONLINEONLINErac1
ora....SM2.asmapplicationONLINEUNKNOWNrac2
ora....C2.lsnrapplicationONLINEUNKNOWNrac2
ora.rac2.gsdapplicationONLINEUNKNOWNrac2
ora.rac2.onsapplicationONLINEUNKNOWNrac2
ora.rac2.vipapplicationONLINEONLINErac2
可以看到,仍然是启动后的原始状态。
从上面的显示可以知道,每个资源的State显示为UNKNOWN,应该是由于两个节点时间不同步,进而造成crs在启动的时候无法认到系统已经注册的资源造成的。
解决方法:
首先,保证两个节点时间保持同步,ORACLE10gRAC两个节点之间有10几秒的时间误差,不会对应用造成影响。
但是过分大的时间误差可能导致某个节点down机,或者节点不断重启。
然后执行如下操作:
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stop–all
Attemptingtostop`ora.rac1.vip`onmember`rac1`
Attemptingtostop`ora.rac2.vip`onmember`rac2`
Stopof`ora.rac2.vip`onmember`rac2`succeeded.
Stopof`ora.rac1.vip`onmember`rac1`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stat-t
NameTypeTargetStateHost
------------------------------------------------------------
ora....CL1.srvapplicationONLINEUNKNOWNrac1
ora....CL2.srvapplicationONLINEUNKNOWNrac2
ora....TEST.csapplicationONLINEUNKNOWNrac2
ora....L1.instapplicationOFFLINEOFFLINE
ora....L2.instapplicationOFFLINEOFFLINE
ora.ORCL.dbapplicationOFFLINEUNKNOWNrac1
ora....SM1.asmapplicationOFFLINEUNKNOWNrac1
ora....C1.lsnrapplicationOFFLINEUNKNOWNrac1
ora.rac1.gsdapplicationONLINEUNKNOWNrac1
ora.rac1.onsapplicationONLINEUNKNOWNrac1
ora.rac1.vipapplicationOFFLINEOFFLINE
ora....SM2.asmapplicationOFFLINEUNKNOWNrac2
ora....C2.lsnrapplicationOFFLINEUNKNOWNrac2
ora.rac2.gsdapplicationONLINEUNKNOWNrac2
ora.rac2.onsapplicationONLINEUNKNOWNrac2
ora.rac2.vipapplicationOFFLINEOFFLINE
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stat(此命令可以查看各个资源的完整服务名称)
NAME=ora.ORCL.ORATEST.ORCL1.srv
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.ORCL.ORATEST.ORCL2.srv
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.ORCL.ORATEST.cs
TYPE=application
TARGET=ONLINE
STATE=UNKNOWNonrac2
NAME=ora.ORCL.ORCL1.inst
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.ORCL.ORCL2.inst
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.ORCL.db
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=OFFLINE
STATE=UNKNOWNonrac1
NAME=ora.rac1.LISTENER_RAC1.lsnr
TYPE=application
TARGET=OFFLINE
STATE=UNKNOWNonrac1
NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=UNKNOWNonrac1
NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=UNKNOWNonrac1
NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=UNKNOWNonrac1
NAME=ora.rac2.ASM2.asm
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.rac2.LISTENER_RAC2.lsnr
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=UNKNOWNonrac2
NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=UNKNOWNonrac2
NAME=ora.rac2.vip
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
$ORA_CRS_HOME/bin/crs_stop–all只能停掉State为ONLINE的服务,状态为UNKNOWN的资源不能通过这个命令关闭,因此可以通过$ORA_CRS_HOME/bin/crs_stop服务名的方式单独停止那些状态为UNKNOWN的资源。
下面是通过$ORA_CRS_HOME/bin/crs_stop命令依次停止资源状态State为UNKNOWN的服务。
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.ORCL.ORATEST.cs
Attemptingtostop`ora.ORCL.ORATEST.cs`onmember`rac2`
Stopof`ora.ORCL.ORATEST.cs`onmember`rac2`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac1.ASM1.asm
Attemptingtostop`ora.rac1.ASM1.asm`onmember`rac1`
Stopof`ora.rac1.ASM1.asm`onmember`rac1`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac1.LISTENER_RAC1.lsnr
Attemptingtostop`ora.rac1.LISTENER_RAC1.lsnr`onmember`rac1`
Stopof`ora.rac1.LISTENER_RAC1.lsnr`onmember`rac1`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac1.ons
Attemptingtostop`ora.rac1.ons`onmember`rac1`
Stopof`ora.rac1.ons`onmember`rac1`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac1.vip
Attemptingtostop`ora.rac1.vip`onmember`rac1`
Stopof`ora.rac1.vip`onmember`rac1`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac2.gsd
Attemptingtostop`ora.rac2.gsd`onmember`rac2`
Stopof`ora.rac2.gsd`onmember`rac2`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac2.ons
Attemptingtostop`ora.rac2.ons`onmember`rac2`
Stopof`ora.rac2.ons`onmember`rac2`succeeded.
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stopora.rac1.gsd
Attemptingtostop`ora.rac1.gsd`onmember`rac1`
Stopof`ora.rac1.gsd`onmember`rac1`succeeded.
………….
把所有状态为UNKNOWN的资源全部停止以后,再次查看资源状态:
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_stat-t
NameTypeTargetStateHost
------------------------------------------------------------
ora....CL1.srvapplicationOFFLINEOFFLINE
ora....CL2.srvapplicationOFFLINEOFFLINE
ora....TEST.csapplicationOFFLINEOFFLINE
ora....L1.instapplicationOFFLINEOFFLINE
ora....L2.instapplicationOFFLINEOFFLINE
ora.ORCL.dbapplicationOFFLINEOFFLINE
ora....SM1.asmapplicationOFFLINEOFFLINE
ora....C1.lsnrapplicationOFFLINEOFFLINE
ora.rac1.gsdapplicationOFFLINEOFFLINE
ora.rac1.onsapplicationOFFLINEOFFLINE
ora.rac1.vipapplicationOFFLINEOFFLINE
ora....SM2.asmapplicationOFFLINEOFFLINE
ora....C2.lsnrapplicationOFFLINEOFFLINE
ora.rac2.gsdapplicationOFFLINEOFFLINE
ora.rac2.onsapplicationOFFLINEOFFLINE
ora.rac2.vipapplicationOFFLINEOFFLINE
此时可以重启所有crs资源了
[oracle@rac1~]$$ORA_CRS_HOME/bin/crs_start–all(注意,这里是在oracle用户下操作)
Attemptingtostart`ora.rac1.vip`onmember`rac1`
Attemptingtostart`ora.rac2.v
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- CRS 常用 维护 命令
![提示](https://static.bdocx.com/images/bang_tan.gif)