Oracle 10g RAC 维护常用命令
一、禁止开机启动CRS&Database
默认在linux上面安装完oracle 10g RAC 后在开机时总是会自动把 cluster 、Database一起和系统起来,一般来说随系统启动与关闭可能会有风险,所以要禁止开机启动
[root@rac1 etc]# /etc/init.d/init.crs disable
如果要设置成开机启动,使用如下命令:
[root@rac1 etc]# /etc/init.d/init.crs enable
二、启动集群
1、启动CRS,需使用root用户
[root@rac1 ~]# crsctl start crs --该启动默认情况将启动所有oracle服务,包括crs,nodeapp,instance database
Attempting to start CRS stack
The CRS stack will be started shortly
2、检查CRS是否正常启动
[root@rac1 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
3、查看CRS Resource状态
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac2
ora....c1.inst application ONLINE ONLINE rac1
ora....c2.inst application ONLINE ONLINE rac2
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
4、停止除crs之外的HA Resource
[root@rac1 ~]# crs_stop -all
Attempting to stop `ora.rac1.gsd` on member `rac1`
Attempting to stop `ora.rac1.ons` on member `rac1`
Attempting to stop `ora.rac2.gsd` on member `rac2`
Attempting to stop `ora.rac.db` on member `rac2`
Attempting to stop `ora.rac2.ons` on member `rac2`
Stop of `ora.rac1.gsd` on member `rac1` succeeded.
Stop of `ora.rac1.ons` on member `rac1` succeeded.
Stop of `ora.rac2.gsd` on member `rac2` succeeded.
Stop of `ora.rac2.ons` on member `rac2` succeeded.
Stop of `ora.rac.db` on member `rac2` succeeded.
Attempting to stop `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1`
Attempting to stop `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
Stop of `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1` succeeded.
`ora.rac.rac1.inst` is already OFFLINE.
Attempting to stop `ora.rac1.ASM1.asm` on member `rac1`
Stop of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
`ora.rac.rac2.inst` is already OFFLINE.
Attempting to stop `ora.rac2.ASM2.asm` on member `rac2`
Stop of `ora.rac2.ASM2.asm` on member `rac2` succeeded.
Attempting to stop `ora.rac2.vip` on member `rac2`
Stop of `ora.rac2.vip` on member `rac2` succeeded.
Stop of `ora.rac1.ASM1.asm` on member `rac1` succeeded.
Attempting to stop `ora.rac1.vip` on member `rac1`
Stop of `ora.rac1.vip` on member `rac1` succeeded.
CRS-0216: Could not stop resource 'ora.rac.rac1.inst'.
CRS-0216: Could not stop resource 'ora.rac.rac2.inst'.
[root@rac1 ~]# ./crsstat
HA Resource Target State
----------- ------ -----
ora.rac.db OFFLINE OFFLINE
ora.rac.rac1.inst OFFLINE OFFLINE
ora.rac.rac2.inst OFFLINE OFFLINE
ora.rac1.ASM1.asm OFFLINE OFFLINE
ora.rac1.LISTENER_RAC1.lsnr OFFLINE OFFLINE
ora.rac1.gsd OFFLINE OFFLINE
ora.rac1.ons OFFLINE OFFLINE
ora.rac1.vip OFFLINE OFFLINE
ora.rac2.ASM2.asm OFFLINE OFFLINE
ora.rac2.LISTENER_RAC2.lsnr OFFLINE OFFLINE
ora.rac2.gsd OFFLINE OFFLINE
ora.rac2.ons OFFLINE OFFLINE
ora.rac2.vip OFFLINE OFFLINE
5、启动nodeapp
[root@rac2 ~]# srvctl start nodeapps -n rac1
[root@rac1 ~]# ./crsstat
HA Resource Target State
----------- ------ -----
ora.rac.db OFFLINE OFFLINE
ora.rac.rac1.inst OFFLINE OFFLINE
ora.rac.rac2.inst OFFLINE OFFLINE
ora.rac1.ASM1.asm OFFLINE OFFLINE
ora.rac1.LISTENER_RAC1.lsnr ONLINE ONLINE on rac1
ora.rac1.gsd ONLINE ONLINE on rac1
ora.rac1.ons ONLINE ONLINE on rac1
ora.rac1.vip ONLINE ONLINE on rac1
ora.rac2.ASM2.asm OFFLINE OFFLINE
ora.rac2.LISTENER_RAC2.lsnr OFFLINE OFFLINE
ora.rac2.gsd OFFLINE OFFLINE
ora.rac2.ons OFFLINE OFFLINE
ora.rac2.vip OFFLINE OFFLINE
6、启动asm
[root@rac2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application OFFLINE OFFLINE
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application OFFLINE OFFLINE
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 OFFLINE OFFLINE
ora....C2.lsnr application OFFLINE OFFLINE
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application OFFLINE OFFLINE
ora.rac2.vip application OFFLINE OFFLINE
7、启动 instance
[root@rac2 ~]# srvctl start instance -d rac -i rac1
[root@rac1 ~]# ./crsstat
HA Resource Target State
----------- ------ -----
ora.rac.db ONLINE ONLINE on rac2
ora.rac.rac1.inst ONLINE ONLINE on rac1
ora.rac.rac2.inst OFFLINE OFFLINE
ora.rac1.ASM1.asm ONLINE ONLINE on rac1
ora.rac1.LISTENER_RAC1.lsnr ONLINE ONLINE on rac1
ora.rac1.gsd ONLINE ONLINE on rac1
ora.rac1.ons ONLINE ONLINE on rac1
ora.rac1.vip ONLINE ONLINE on rac1
ora.rac2.ASM2.asm OFFLINE OFFLINE
ora.rac2.LISTENER_RAC2.lsnr OFFLINE OFFLINE
ora.rac2.gsd OFFLINE OFFLINE
ora.rac2.ons OFFLINE OFFLINE
ora.rac2.vip OFFLINE OFFLINE
[root@rac1 ~]# ./crsstat
按照上述方式启动其他集群节点,全部启动完成后如下:
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac2
ora....c1.inst application ONLINE ONLINE rac1
ora....c2.inst application ONLINE ONLINE rac2
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
三、停止集群
按照与启动集群相反的顺序执行
1、停止instance
[root@rac1 ~]# srvctl stop instance -d rac -i rac1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac2
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application ONLINE ONLINE rac2
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
2、停止asm
[root@rac1 ~]# srvctl stop asm -n rac1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac2
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application ONLINE ONLINE rac2
ora....SM1.asm application OFFLINE OFFLINE
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
3、停止nodeapps
[root@rac1 ~]# srvctl stop nodeapps -n rac1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac2
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application ONLINE ONLINE rac2
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
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
按照以上说明,停止其他节点
[root@rac1 ~]# srvctl stop instance -d rac -i rac2
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application OFFLINE OFFLINE
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
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
[root@rac1 ~]# srvctl stop asm -n rac2
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application OFFLINE OFFLINE
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
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
[root@rac1 ~]# srvctl stop nodeapps -n rac2
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application OFFLINE OFFLINE
ora....c1.inst application OFFLINE OFFLINE
ora....c2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....C2.lsnr application OFFLINE OFFLINE
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application OFFLINE OFFLINE
ora.rac2.vip application OFFLINE OFFLINE
四、停止crs
在每个节点上执行:
[root@rac1 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 ~]# crsctl check crs
Failure 1 contacting CSS daemon
Cannot communicate with CRS
Cannot communicate with EVM
更多推荐
所有评论(0)