|
|
一: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
实例1修改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)
|
|