有时候,我们会碰到客户提出需求,为rac数据库下的某个实例应用停掉,来做机器的正常维护,比如换HBA卡等
这个时候就需要我们DBA介入了,而且只关闭某个实例,而不影响到另外的实例和整个数据库的正常运行
下面就具体步骤列出来:假设我们要停RAC2实例
1.用crs_stat显示资源的全部状态
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application ONLINE ONLINE rac2
2.用srvctl停监听
[oracle@RAC2 ~]$ srvctl stop listener -n rac2
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 OFFLINE OFFLINE --可以看到监听资源已经停止
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application ONLINE ONLINE rac2
3.用srvctl停rac2实例
这个时候就需要我们DBA介入了,而且只关闭某个实例,而不影响到另外的实例和整个数据库的正常运行
下面就具体步骤列出来:假设我们要停RAC2实例
1.用crs_stat显示资源的全部状态
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application ONLINE ONLINE rac2
2.用srvctl停监听
[oracle@RAC2 ~]$ srvctl stop listener -n rac2
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 OFFLINE OFFLINE --可以看到监听资源已经停止
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application ONLINE ONLINE rac2
3.用srvctl停rac2实例
[oracle@RAC2 ~]$ srvctl stop instance -d racdb -i racdb2
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 OFFLINE OFFLINE
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE --可以看到实例2已经停止
4.用srvctl停实例2下面的asm
[oracle@RAC2 ~]$ srvctl stop asm -n rac2 -i +ASM2
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 --可以看到实例2下面的asm已经停止
ora....C2.lsnr application OFFLINE OFFLINE
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 OFFLINE OFFLINE
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE --可以看到实例2已经停止
4.用srvctl停实例2下面的asm
[oracle@RAC2 ~]$ srvctl stop asm -n rac2 -i +ASM2
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 --可以看到实例2下面的asm已经停止
ora....C2.lsnr application OFFLINE OFFLINE
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE
5.用srvctl停止节点2上面的资源 manage nodeapp
[oracle@RAC2 ~]$ srvctl stop nodeapps -n rac2
CRS-0216: Could not stop resource 'ora.rac2.LISTENER_RAC2.lsnr'.
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 --可以看到实例2下面的gsd,ons,vip资源都已经停止
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE
6.停止CRS
首先用 ps -ef|grep d.bin 命令查找进程
[oracle@RAC2 ~]$ ps -ef|grep d.bin
oracle 19373 19372 0 14:19 ? 00:00:07 /home/oracle/10gR2/db/bin/evmd.bin
root 19534 18342 2 14:19 ? 00:00:32 /home/oracle/10gR2/db/bin/crsd.bin reboot
root 19959 19543 0 14:19 ? 00:00:00 /home/oracle/10gR2/db/bin/oprocd.bin run -t 1000 -m 500 -f
oracle 20137 19576 0 14:19 ? 00:00:08 /home/oracle/10gR2/db/bin/ocssd.bin
oracle 30785 21369 0 14:45 pts/1 00:00:00 grep d.bin
[root@RAC2 bin]#./crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
可以看出crs相关进程已经停止了
[oracle@RAC2 ~]$ srvctl stop nodeapps -n rac2
CRS-0216: Could not stop resource 'ora.rac2.LISTENER_RAC2.lsnr'.
[oracle@RAC2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 --可以看到实例2下面的gsd,ons,vip资源都已经停止
ora.racdb.db application ONLINE ONLINE rac2
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE
6.停止CRS
首先用 ps -ef|grep d.bin 命令查找进程
[oracle@RAC2 ~]$ ps -ef|grep d.bin
oracle 19373 19372 0 14:19 ? 00:00:07 /home/oracle/10gR2/db/bin/evmd.bin
root 19534 18342 2 14:19 ? 00:00:32 /home/oracle/10gR2/db/bin/crsd.bin reboot
root 19959 19543 0 14:19 ? 00:00:00 /home/oracle/10gR2/db/bin/oprocd.bin run -t 1000 -m 500 -f
oracle 20137 19576 0 14:19 ? 00:00:08 /home/oracle/10gR2/db/bin/ocssd.bin
oracle 30785 21369 0 14:45 pts/1 00:00:00 grep d.bin
[root@RAC2 bin]#./crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
可以看出crs相关进程已经停止了
[root@RAC2 bin]# ps -ef|grep d.bin
root 31791 7853 0 14:49 pts/1 00:00:00 grep d.bin
root 31791 7853 0 14:49 pts/1 00:00:00 grep d.bin
[oracle@RAC1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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
ora.racdb.db application ONLINE ONLINE rac1
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE
Name Type Target State Host
------------------------------------------------------------
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
ora.racdb.db application ONLINE ONLINE rac1
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application OFFLINE OFFLINE
可以看出没有实例2的相关资源online了
这个时候我们就可以关闭rac2机器了,进行相关维护操作
机器起来后 就会自动启动rac2上的所有资源,包括监听和数据库
这里手工启动演示下
这个时候我们就可以关闭rac2机器了,进行相关维护操作
机器起来后 就会自动启动rac2上的所有资源,包括监听和数据库
这里手工启动演示下
[root@RAC2 bin]#./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
Attempting to start CRS stack
The CRS stack will be started shortly
[root@RAC2 bin]# ps -ef|grep d.bin
oracle 1712 1711 4 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/evmd.bin
root 1850 31619 4 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/crsd.bin reboot
root 2318 1859 0 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/oprocd.bin run -t 1000 -m 500 -f
oracle 2462 1912 14 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/ocssd.bin
root 2494 7853 0 14:56 pts/1 00:00:00 grep d.bin
oracle 1712 1711 4 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/evmd.bin
root 1850 31619 4 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/crsd.bin reboot
root 2318 1859 0 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/oprocd.bin run -t 1000 -m 500 -f
oracle 2462 1912 14 14:56 ? 00:00:00 /home/oracle/10gR2/db/bin/ocssd.bin
root 2494 7853 0 14:56 pts/1 00:00:00 grep d.bin
可以看到相关进程已经启动,需要等几分钟才会启动rac2相关资源
[oracle@RAC1 network-scripts]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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
ora.racdb.db application ONLINE ONLINE rac1
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application ONLINE ONLINE rac2
[oracle@RAC1 network-scripts]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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
ora.racdb.db application ONLINE ONLINE rac1
ora....b1.inst application ONLINE ONLINE rac1
ora....b2.inst application ONLINE ONLINE rac2