Oracle 11gR2 RAC 叢集服務啟動與關閉總結

chengxuyonghu發表於2024-06-23

關閉過程(CRS叢集關閉->關閉資料庫)

1.關閉資料庫:
用oracl使用者執行srvctl命令

語法:srvctl stop database -d dbname [-o immediate]

作用:可以一次性關閉dbname的所有例項

[oracle@rac1 ~]$ srvctl stop database -d racdb  -停止所有節點上的例項


然後檢視狀態:

[oracle@rac1 ~]$ srvctl status database -d racdb     

Instance rac1 is not running on node rac1

Instance rac2 is not running on node rac2

2.停止HAS(High Availability Services),必須以root使用者操作

[root@rac1 oracle]# cd /u01/grid/11.2.0/grid/bin

[root@rac1 bin]# ./crsctl stop has -f

[root@rac1 bin]# ./crsctl stop crs -f
本命令只能關閉當前節點的CRS服務,因此需要在RAC的所有節點上執行,啟動也一樣。has與crs等同

3.停止節點叢集服務,必須以root使用者:


[root@rac1 oracle]# cd /u01/grid/11.2.0/grid/bin

[root@rac1 bin]# ./crsctl stop cluster ----停止本節點叢集服務

[root@rac1 bin]# ./crsctl stop cluster -all ---停止所有節點服務

也可以如下控制所停節點:
[root@rac1 bin]# crsctl stop cluster -n rac1 rac2

CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded

CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
。。。。。。。。。。。省略日誌輸出。。。。。。。。。。。。。。

你如果想一條命令把所有的程序全部停止可以使用上述命令。如果不指定引數的話對當前節點有效,如果指定引數的話對相關引數節點有效。

4.檢查叢集程序狀態


[root@rac1 bin]# crsctl check cluster

詳細輸出
[root@rac1 bin]# crs_stat -t -v
只檢查本節點的叢集狀態
[root@rac1 bin]# crsctl check crs
啟動過程(CRS叢集啟動->啟動資料庫)

1.啟動 HAS
單一節點啟動


[root@rac2 ~]# crsctl start has


[root@rac2 ~]# crsctl start crs


[root@rac2 ~]# crsctl check crs


CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

所有節點啟動

[root@rac1 bin]# crsctl start cluster -n rac1 rac2
CRS-4123: Oracle High Availability Services has been started.


[root@rac1 bin]# crsctl start cluster -all
[root@rac2 ~]# crsctl check cluster


CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online


此命令會在後臺啟動所有 RAC CRS 相關程序


[root@rac2 ~]# crs_stat -t -v


CRS-0184: Cannot communicate with the CRS daemon.


因為 start has 啟動的 crs 程序比較多因此會啟動的比較慢,我的機器等待了 5 分鐘,在沒有完全啟動成功之前會報上述錯誤,需要耐心等待一段時間後執行下面命令即可檢視到所有 CRS 相關程序服務已經啟動。


[root@rac2 ~]# crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac2
ora....N2.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1
ora....N3.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1
ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE rac1
ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE rac1
ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE rac1
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE rac1
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.gsd application 0/5 0/0 OFFLINE OFFLINE
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.gsd application 0/5 0/0 OFFLINE OFFLINE
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac2
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac2
ora.scan2.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1
ora.scan3.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1


說明:


英文解釋
ora.gsd is OFFLINE by default ifthere is no 9i database in the cluster.
ora.oc4j is OFFLINE in 11.2.0.1 as DatabaseWorkload Management(DBWLM) is unavailable. these can be ignored in11gR2 RAC.
中文解釋
ora.gsd 是叢集服務中用於與 9i 資料庫進行通訊的一個程序,在當前版本中為了向後相容才儲存下來,狀態為 OFFLINE 不影響 CRS 的正常執行與效能,我們忽略即可


ora.oc4j 是在11.2.0.2 以上版本中有效的服務程序,用於 DBWLM 的資源管理,因此在11.2.0.1 以下版本並沒有使用

2.啟動資料庫:
oracle 使用者執行 srvctl 命令:
語法:srvctl start|stop|status database -d dbname [-o immediate]

作用:可以一次性啟動 dbname 的所有例項
[oracle@rac1 ~]$ srvctl start database -d racdb  -啟動所有節點上的例項
然後檢視狀態:
[oracle@rac1 ~]$ srvctl status database -d racdb

3.詳細輸出資源全名稱並檢查狀態


crsctl status resource -t
crsctl status resource


4.常用 srvctl 命令
指定 dbname 上某個例項
srvctl start|stop|status instance -d -i


5.顯示 RAC 下所有例項配置與狀態
srvctl status|config database -d


6.顯示所有節點的應用服務(VIP,GSD,listener,ONS)
srvctl start|stop|status nodeapps -n


7.ASM 程序服務管理
srvctl start|stop|status|config asm -n [-i ] [-o]
srvctl config asm -a
srvctl status asm -a


8.可以獲取所有的環境資訊:
srvctl getenv database -d [-i]


9.設定全域性環境和變數:
srvctl setenv database -d -t


10.在 OCR 中刪除已有的資料庫資訊
srvctl remove database -d


11.向 OCR 中新增一個資料庫的例項:
srvctl add instance -d -i -n
srvctl add instance -d -i -n


12.檢查監聽的狀態
srvctl status listener
srvctl config listener -a


SCAN 配置資訊
srvctl config scan
SCAN listener 狀態資訊
srvctl status scan


小結:
crsctl 命令是一個叢集級別命令,可以對所有叢集資源進行統一啟動、停止等管理操作

srvctl 命令是一個服務級別命令,可以對單一服務資源進行統一啟動、停止等管理操作

附:srvctl 命令啟動與停止的詳細幫助
[root@rac2 ~]# srvctl start -h

The SRVCTL start command starts, Oracle Clusterware enabled, non-running objects.

Usage: srvctl start database -d [-o ] [-n ]
Usage: srvctl start instance -d {-n [-i ] | -i } [-o ]
Usage: srvctl start service -d [-s "" [-n | -i ] ] [-o ]
Usage: srvctl start nodeapps [-n ] [-g] [-v]
Usage: srvctl start vip { -n | -i } [-v]
Usage: srvctl start asm [-n ] [-o ]
Usage: srvctl start listener [-l ] [-n ]
Usage: srvctl start scan [-i ] [-n ]
Usage: srvctl start scan_listener [-n ] [-i ]
Usage: srvctl start oc4j [-v]
Usage: srvctl start home -o -s -n
Usage: srvctl start filesystem -d [-n ]
Usage: srvctl start diskgroup -g [-n ""]
Usage: srvctl start gns [-l ] [-n ] [-v]
Usage: srvctl start cvu [-n ]
For detailed help on each command and object and its options use:
srvctl -h

[root@rac2 ~]# srvctl stop -h

The SRVCTL stop command stops, Oracle Clusterware enabled, starting or running objects.

Usage: srvctl stop database -d [-o ] [-f]
Usage: srvctl stop instance -d {-n | -i } [-o ] [-f]
Usage: srvctl stop service -d [-s "" [-n | -i ] ] [-f]
Usage: srvctl stop nodeapps [-n ] [-g] [-f] [-r] [-v]
Usage: srvctl stop vip { -n | -i } [-f] [-r] [-v]
Usage: srvctl stop asm [-n ] [-o ] [-f]
Usage: srvctl stop listener [-l ] [-n ] [-f]
Usage: srvctl stop scan [-i ] [-f]
Usage: srvctl stop scan_listener [-i ] [-f]
Usage: srvctl stop oc4j [-f] [-v]
Usage: srvctl stop home -o -s -n [-t ] [-f]
Usage: srvctl stop filesystem -d [-n ] [-f]
Usage: srvctl stop diskgroup -g [-n ""] [-f]
Usage: srvctl stop gns [-n ] [-f] [-v]
Usage: srvctl stop cvu [-f]
For detailed help on each command and object and its options use:
srvctl -h

























 

相關文章