重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 716|回复: 0
打印 上一主题 下一主题

[Oracle] Oracle RAC自启动

[复制链接]
跳转到指定楼层
楼主
发表于 2025-6-29 21:19:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
一: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)

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2026-4-21 00:30 , Processed in 0.260402 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表