RAC中的srvctl和crs命令
srvctl 命令
$ srvctl -h
Usage: srvctl [-V]
Usage: srvctl add database -d
Usage: srvctl add instance -d
Usage: srvctl add service -d
Usage: srvctl add service -d
Usage: srvctl add nodeapps -n
Usage: srvctl add asm -n
Usage: srvctl config database
Usage: srvctl config database -d
Usage: srvctl config service -d
Usage: srvctl config nodeapps -n
Usage: srvctl config asm -n
Usage: srvctl config listener -n
Usage: srvctl disable database -d
Usage: srvctl disable instance -d
Usage: srvctl disable service -d
Usage: srvctl disable asm -n
Usage: srvctl enable database -d
Usage: srvctl enable instance -d
Usage: srvctl enable service -d
Usage: srvctl enable asm -n
Usage: srvctl getenv database -d
Usage: srvctl getenv instance -d
Usage: srvctl getenv service -d
Usage: srvctl getenv nodeapps -n
Usage: srvctl modify database -d
Usage: srvctl modify instance -d
Usage: srvctl modify instance -d
Usage: srvctl modify service -d
Usage: srvctl modify service -d
Usage: srvctl modify service -d
Usage: srvctl modify asm -n
Usage: srvctl modify nodeapps -n
Usage: srvctl relocate service -d
Usage: srvctl remove database -d
Usage: srvctl remove instance -d
Usage: srvctl remove service -d
Usage: srvctl remove nodeapps -n "
Usage: srvctl remove asm -n
Usage: srvctl setenv database -d
Usage: srvctl setenv instance -d
Usage: srvctl setenv service -d
Usage: srvctl setenv nodeapps -n
Usage: srvctl start database -d
Usage: srvctl start instance -d
Usage: srvctl start service -d
Usage: srvctl start nodeapps -n
Usage: srvctl start asm -n
Usage: srvctl start listener -n
Usage: srvctl status database -d
Usage: srvctl status instance -d
Usage: srvctl status service -d
Usage: srvctl status nodeapps -n
Usage: srvctl status asm -n
Usage: srvctl stop database -d
Usage: srvctl stop instance -d
Usage: srvctl stop service -d
Usage: srvctl stop nodeapps -n
Usage: srvctl stop asm -n
Usage: srvctl stop listener -n
Usage: srvctl unsetenv database -d
Usage: srvctl unsetenv instance -d
Usage: srvctl unsetenv service -d
Usage: srvctl unsetenv nodeapps -n
$
從上我們可以看到 srvctl 這個命令工具很強大,可以操作 database, instance ,asm ,service , listener,nodeapps (gsd,vip ,ons)這些資源
1.透過srvctl命令來start/stop/check所有的例項
$srvctl start|stop|status database -d rac1
[oracle@rac1 ~]$ srvctl status database -d testrac
Instance testrac1 is running on node rac1
Instance testrac2 is running on node rac2
$srvctl start|stop|status database -d rac1
[oracle@rac1 ~]$ srvctl status database -d testrac
Instance testrac1 is running on node rac1
Instance testrac2 is running on node rac2
2.start/stop 指定的例項
$srvctl start |stop |status instance -d -i
$srvctl start |stop |status instance -d
[oracle@rac1 ~]$ srvctl status instance -d testrac -i testrac1
Instance testrac1 is running on node rac1
Instance testrac1 is running on node rac1
3.列出當前rac下所有的
$ srvctl config database -d
[oracle@rac1 ~]$ srvctl config database -d testrac
rac1 testrac1 /u01/product/database
rac2 testrac2 /u01/product/database
$ srvctl config database -d
[oracle@rac1 ~]$ srvctl config database -d testrac
rac1 testrac1 /u01/product/database
rac2 testrac2 /u01/product/database
4.start/stop/check 所有的nodeapps,比如:VIP, GSD, listener, ONS:
$ srvctl start|stop|status nodeapps -n
[oracle@rac1 ~]$ srvctl status nodeapps -n rac1
VIP is running on node: rac1
GSD is running on node: rac1
Listener is running on node: rac1
ONS daemon is running on node: rac1
$ srvctl start|stop|status nodeapps -n
[oracle@rac1 ~]$ srvctl status nodeapps -n rac1
VIP is running on node: rac1
GSD is running on node: rac1
Listener is running on node: rac1
ONS daemon is running on node: rac1
5.srvctl也可以start/stop ASM例項:
$ srvctl start|stop asm -n [-i ] [-o]
[oracle@rac1 ~]$ srvctl start asm -n rac1
$ srvctl start|stop asm -n
[oracle@rac1 ~]$ srvctl start asm -n rac1
6.獲取所有的環境資訊
$ srvctl getenv database -d [-i ]
$ srvctl getenv database -d
7.設定全域性環境變數:
$ srvctl setenv database -d -t LANG=en
$ srvctl setenv database -d
8.從OCR中刪除已有的資料庫:
$ srvctl remove database -d
$ srvctl remove database -d
9.向OCR中新增一個資料庫:
$ srvctl add database -d -o [-m ] [-p] [-A /netmask] [-r {PRIMARY | PHYSICAL_STANDBY |LOGICAL_STANDBY}] [-s ]
$ srvctl add database -d
10.向OCR中新增一個資料庫的例項:
$ srvctl add instance -d -i -n
$ srvctl add instance -d
11.向OCR中新增一個ASM例項:
$ srvctl add asm -n -i -o
12.新增一個service
$ srvctl add service -d -s -r [-a ] [-P ] [-u]
$ srvctl add asm -n
12.新增一個service
$ srvctl add service -d
例如:
srvctl add service -d msdb -s msrac -r msdb1 -a msdb2 -P preconnect
新建了一個服務名叫“msrac”,首先呼叫msdb1伺服器,若有問題則自動呼叫msdb2伺服器。
呼叫RAC中的該服務,只需要注意URL中的service_name為上面配置的“msrac”即可。
jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = racdb3-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = racdb4-vip)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = msrac)(FAILOVER_MODE =(TYPE = SELECT)(METHOD = PRECONNECT)(RETRIES = 180)(DELAY = 5))))
13.修改在其他節點上的service(修改的是配置,此時使用的例項不變)
$ srvctl modify service -d -s -i -t
14.relocate 某個節點的service到其他節點(當taf轉到avail例項上後,又想轉到pre的例項上,用relocate)
srvctl relocate service -d -s - i -t
13.修改在其他節點上的service(修改的是配置,此時使用的例項不變)
$ srvctl modify service -d
14.relocate 某個節點的service到其他節點(當taf轉到avail例項上後,又想轉到pre的例項上,用relocate)
srvctl relocate service -d
crs 命令
1.檢視狀態的命令
Usage: crs_stat [resource_name [...]] [-v] [-l] [-q] [-c cluster_member]
crs_stat [resource_name [...]] -t [-v] [-q] [-c cluster_member]
crs_stat -p [resource_name [...]] [-q]
crs_stat [-a] application -g
crs_stat [-a] application -r [-c cluster_member]
crs_stat -f [resource_name [...]] [-q] [-c cluster_member]
crs_stat -ls [resource_name [...]] [-q]
$crs_stat -t 檢視crs及所有的service的狀態
[oracle@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.testrac.db application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac1
ora....c2.inst application ONLINE ONLINE rac2
[oracle@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.testrac.db application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac1
ora....c2.inst application ONLINE ONLINE rac2
2.crsctl check crs 檢查CRS相關服務狀態
[oracle@rac1 ~]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[oracle@rac1 ~]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
3.啟動和關閉命令
$ crs_start –all --啟動所有的crs服務
$ crs_stop –all --停止所有的crs服務
$ crsctl start crs --啟動crs服務
$ crsctl stop crs --停止crs服務
$ srvctl start nodeapps -n rac1(rac2) --啟動某節點上所有的應用
$ srvctl stop nodeapps -n rac1(rac2) --停止某節點上所有的應用
$ srvctl start listener -n rac1(rac2) --啟動某個節點的listener
$ srvctl stop listener -n rac1(rac2) --停止某個節點的listener
$ srvctl start instance –d db –i rac1(rac2) --啟動某個instance
$ srvctl stop instance –d db –i rac1(rac2) --停止某個instance
$ srvctl start database –d db --啟動資料庫
$ srvctl stop database –d db --停止資料庫
$ crs_start –all --啟動所有的crs服務
$ crs_stop –all --停止所有的crs服務
$ crsctl start crs --啟動crs服務
$ crsctl stop crs --停止crs服務
$ srvctl start nodeapps -n rac1(rac2) --啟動某節點上所有的應用
$ srvctl stop nodeapps -n rac1(rac2) --停止某節點上所有的應用
$ srvctl start listener -n rac1(rac2) --啟動某個節點的listener
$ srvctl stop listener -n rac1(rac2) --停止某個節點的listener
$ srvctl start instance –d db –i rac1(rac2) --啟動某個instance
$ srvctl stop instance –d db –i rac1(rac2) --停止某個instance
$ srvctl start database –d db --啟動資料庫
$ srvctl stop database –d db --停止資料庫
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9399028/viewspace-697128/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RAC 管理(crs_stat、crsctl、srvctl)
- 【RAC】Oracle RAC12c+ srvctl操作命令變化(引數更嚴謹了)Oracle
- [20210804]oracle rac執行命令crs_stat -t -v緩慢的分析.txtOracle
- rac中 crsctl start/stop crs and crsctl start/stop cluster 區別
- Oracle Linux 6.7中 Oracle 11.2.0.4 RAC叢集CRS異常處理OracleLinux
- 11.2.0.1.0 RAC啟動使用root使用者啟動crs報錯CRS-4535
- CRS Resource Introduction In Oracle 19c RAC-20220125Oracle
- CRS-5014 CLSN00009 CRS-5017 RAC環境監聽異常,無法正常啟動和關閉
- ORACLE 19C RAC叢集安裝與PRCR-1079&CRS-5017&ORA-03113Oracle
- ORACLE CRS日誌中的ClssnmPollingThread Missed Checkins MessagesOraclethread
- vmware + 裸裝置 + crs + oracle10g RAC搭建步驟(二):安裝linuxOracleLinux
- CRS-0019 CRS-0014 LFI-00142
- SRVCTL 刪除和新增資料庫服務資料庫
- 【RAC】Oracle rac修改IP地址及埠號命令參考Oracle
- 4.5.1.2 srvctl add databaseDatabase
- 4.5.1.3 srvctl add listener
- 4.5.1.4 srvctl add ons
- 4.5.1.1 srvctl add asmASM
- Oracle:srvctl 簡介Oracle
- Linux系統中的管道命令、grep命令、sed命令和awk命令Linux
- 4.2.3 獲取SRVCTL 的幫助
- rac叢集日常維護命令
- solaris下清除crs的方法
- linux中file命令和find命令Linux
- RAC中的enq: TS等待ENQ
- 【RAC】Oracle10g rac新增刪除節點命令參考Oracle
- 4.5.1.5 srvctl 新增服務
- RAC架構中public網路卡down後發生什麼和RAC如何自愈?架構
- oracle兩節點RAC,由於gipc導致某節點crs無法啟動問題分析Oracle
- ORACLE RAC TO RAC DG搭建過程中可能遇到的問題Oracle
- CRS-4124: Oracle High Availability Services startup failed. CRS-4000OracleAI
- oracle RAC 診斷叢集狀態命令Oracle
- 【RAC】RAC更換心跳地址和RAC更換儲存主要步驟
- 4.2.2 準備執行SRVCTL
- Linux中Sleep和Wait命令的使用方式LinuxAI
- Linux中dir和dirname命令Linux
- Redis中KEYS和SCAN命令的區別和建議Redis
- 4.5 通過SRVCTL 呼叫Oracle RestartOracleREST
- Linux中rmdir和rm命令的主要區別!Linux