Oracle RAC自啟動

chenoracle發表於2020-07-26

Oracle RAC自啟動

一:CRS自啟動

二:例項自啟動


一:CRS自啟動

預設情況下,crs是隨著系統啟動自動啟動的。

檢視版本

[root@rac01 bin]# ./crsctl query crs softwareversion
Oracle Clusterware version on node [rac01] is [11.2.0.4.0]

啟動自啟動(預設)

[root@rac01 bin]# ./crsctl enable crs
CRS-4622: Oracle High Availability Services autostart is enabled.

檢視

[root@rac01 bin]# cat /etc/oracle/scls_scr/rac01/root/ohasdstr 
enable

禁用自啟動

[root@rac01 ./crsctl disable crs
CRS-4621: Oracle High Availability Services autostart is disabled.

檢視

[root@rac01 bin]# cat /etc/oracle/scls_scr/rac01/root/ohasdstr 
disable

二:例項自啟動 

預設情況下,AUTO_START值為restore。

2.1 AUTO_START=restore

其中restore表示還原、恢復的含義,即將例項狀態恢復到crs停止前的狀態。

(1)如果crs停止前,手動通過sqlplus或srvctl停止了例項,那麼在crs重啟後,例項不會跟著自動啟動。

(2)如果crs停止前,例項處於open狀態,那麼重啟crs(或作業系統重啟),例項會跟著crs啟動而啟動。

注意: 在沒有停止例項前直接停止crs,例項是以abort方式停止的[Shutting down instance (abort)]

2.2 AUTO_START=always

將AUTO_START由restore改成always後,無論crs停止前例項是open還是close狀態,例項都會跟著crs啟動而啟動。

實驗過程如下:

2.1 AUTO_START=restore

測試AUTO_START=restore下,例項啟動情況。

檢視資料庫資訊

[root@rac01 bin]# ./crsctl start crs
[root@rac01 bin]# ./srvctl config database
cjcdb
[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is running on node rac01
Instance cjcdb2 is running on node rac02

預設AUTO_START=restore 

[root@rac01 bin]# ./crsctl stat res ora.cjcdb.db -p|grep AUTO_START
AUTO_START=restore

測試:啟動crs,例項沒有自動啟動(srvctl停庫)

[root@rac01 bin]# ./crsctl stat res ora.cjcdb.db -p|grep AUTO_START
AUTO_START=restore
[root@rac02 bin]# ./crsctl stat res ora.cjcdb.db -p|grep AUTO_START
AUTO_START=restore
[root@rac01 bin]# ./srvctl stop database -d cjcdb
###[root@rac01 bin]# ./srvctl stop instance -d cjcdb -i cjcdb1
[root@rac01 bin]# ./crsctl stop crs
[root@rac02 bin]# ./crsctl stop crs
[root@rac01 bin]# ./crsctl start crs
[root@rac02 bin]# ./crsctl start crs

檢視例項狀態

[root@rac01 bin]# ./crsctl stat res ora.cjcdb.db -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cjcdb.db
      1        OFFLINE OFFLINE                               Instance Shutdown   
      2        OFFLINE OFFLINE                               Instance Shutdown

測試:啟動crs,例項沒有自動啟動(SQLPLUS停庫)

停止例項

SQL> shutdown immediate
[root@rac01 bin]# ./crsctl stop crs
SQL> shutdown immediate
[root@rac02 bin]# ./crsctl stop crs

重啟crs

[root@rac01 bin]# ./crsctl start crs
[root@rac02 bin]# ./crsctl start crs

檢視例項狀態

[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is not running on node rac01
Instance cjcdb2 is not running on node rac02

測試:啟動crs,例項自動啟動(srvctl)

啟動例項

[root@rac01 bin]# ./srvctl start database -d cjcdb
[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is running on node rac01
Instance cjcdb2 is running on node rac02

重啟crs

[root@rac01 bin]# ./crsctl stop crs
[root@rac01 bin]# ./crsctl start crs
[root@rac02 bin]# ./crsctl stop crs
[root@rac02 bin]# ./crsctl start crs

檢視例項狀態

[root@rac01 bin]# ./crsctl stat res ora.cjcdb.db -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cjcdb.db
      1        ONLINE  ONLINE       rac01                    Open                
      2        ONLINE  ONLINE       rac02                    Open

檢視例項狀態

[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is running on node rac01
Instance cjcdb2 is running on node rac02

啟動crs,例項自動啟動(sqlplus)

###節點1###

SQL> startup

###節點2###

SQL> startup

重啟crs

[root@rac01 bin]# ./crsctl stop crs
[root@rac01 bin]# ./crsctl start crs
[root@rac02 bin]# ./crsctl stop crs
[root@rac02 bin]# ./crsctl start crs

檢視例項狀態

[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is running on node rac01
Instance cjcdb2 is running on node rac02

2.2 AUTO_START=always

例項自啟動 

[root@rac01 bin]# ./crsctl stat res ora.cjcdb.db -p|grep AUTO_START
AUTO_START=restore

修改AUTO_START=always

[root@rac01 bin]# ./crsctl modify resource ora.cjcdb.db -attr "AUTO_START=always"
[root@rac01 bin]# ./crsctl stat res ora.cjcdb.db -p|grep AUTO_START
AUTO_START=always

檢視例項狀態

[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is not running on node rac01
Instance cjcdb2 is not running on node rac02

重啟crs

[root@rac01 bin]# ./crsctl stop crs
[root@rac01 bin]# ./crsctl start crs

檢視例項狀態

[root@rac01 bin]# ./srvctl status instance -d cjcdb -i cjcdb1,cjcdb2 -f -v
Instance cjcdb1 is running on node rac01. Instance status: Open.
Instance cjcdb2 is not running on node rac02
[root@rac01 bin]# ./srvctl status database -d cjcdb
Instance cjcdb1 is running on node rac01
Instance cjcdb2 is not running on node rac02

參考:

SRVCTL : Disabled DB Instance Status Changed to Online when ASM Restarted (Doc ID 2299664.1)
Instance Does not Start After 11gR2 Grid Infrastructure Restart or Node Reboot (Doc ID 1149003.1)

歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!     

Oracle RAC自啟動

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2707024/,如需轉載,請註明出處,否則將追究法律責任。

相關文章