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
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).
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27045652/viewspace-1096940/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【RAC】使用頻率較高的CRS維護命令總結
- 【轉】ORACLE CRS日常維護命令Oracle
- crs之上的resource管理總結(CRS_PROFILE)
- 總結:ORACLE RAC 常用命令之CRS(1)Oracle
- Oracle表空間維護總結Oracle
- SQLServer索引維護常用方法總結SQLServer索引
- 考試系統維護總結
- Oracle常用維護語句總結Oracle
- crs之上的resource管理總結
- OCR維護命令
- RAC維護命令
- VotingDisk維護命令
- RAC維護管理命令
- OGG維護命令
- Oracle RAC維護命令Oracle
- RAC日常維護命令
- ORACLE資料庫日常維護知識總結Oracle資料庫
- 經驗分享:MySQL日誌維護策略總結MySql
- 9I DATAGUARD實施和維護總結
- 收集oracle日常維護的工作命令Oracle
- 【MHA】mha日常維護命令
- rac維護基本命令
- DataGuard 日常維護命令整理
- RMAN配置與維護命令
- Linux 運維必備的 40 個命令總結Linux運維
- oracle12c之 表空間維護總結Oracle
- ORACLE 9I DATAGUARD實施和維護總結Oracle
- 9I DATAGUARD原理,實施和維護總結
- linux中oracle的日常維護命令LinuxOracle
- 資料庫常用維護命令資料庫
- rac叢集日常維護命令
- rac常用維護工具和命令
- mysql維護常用命令MySql
- ogg簡單維護命令
- hbase叢集 常用維護命令
- RAC 11.2.0.3 維護命令 (二)
- RAC 11.2.0.3 維護命令 (一)
- IBM AIX日常維護命令IBMAI