ORACLE RAC数据库的启动与关闭

RAC数据库与单实例的差异主要表现在多个实例通过集群件来统一管理共享的资源。因此原有的单实例的管理方式,如数据库、监听器等的关闭启动等可以使用原有的方式进行,也可以通过集群管理工具,命令行来集中管理,这也是推荐的管理方式。由于集群件crs位于数据库之上,即RAC数据库依赖于集群件,因此数据库的启动与关闭应该结合集群来考虑,下面以11g RAC来描述数据库启动与关闭过程。


一、RAC 数据库启动与关闭顺序
1、关闭顺序

关闭监听,关闭 Oracle 实例,关闭 ASM 实例(关闭集群件)
  
2、启动顺序

启动ASM实例,启动oracle实例,启动监听,启动OEM<可选>

如果未使用ASM,则启动与关闭过程的有关ASM的操作可忽略
  
3、主要工具
  srvctl,sqlplus。本文主要描述的是使用srvctl命令来完成


以下为集群的状态:

[root@host01 ~]# crs_stat
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.FRA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.LISTENER_SCAN1.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.eons
TYPE=ora.eons.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.gsd
TYPE=ora.gsd.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host01.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host01.LISTENER_HOST01.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host01.gsd
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host01.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host01.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host02.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.host02.LISTENER_HOST02.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.host02.gsd
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host02.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.host02.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.net1.network
TYPE=ora.network.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.oc4j
TYPE=ora.oc4j.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.ons
TYPE=ora.ons.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.racdb.db
TYPE=ora.database.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.scan2.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on host02


现在关闭监听程序

[root@host01 cmd]# srvctl stop listener


之后的集群状态如下,注意对比监听部分的状态。

[root@host01 ~]# crs_stat 
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.FRA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.LISTENER_SCAN1.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.eons
TYPE=ora.eons.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.gsd
TYPE=ora.gsd.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host01.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host01.LISTENER_HOST01.lsnr
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host01.gsd
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host01.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host01.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.host02.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.host02.LISTENER_HOST02.lsnr
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host02.gsd
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.host02.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.host02.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on host02

NAME=ora.net1.network
TYPE=ora.network.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.oc4j
TYPE=ora.oc4j.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.ons
TYPE=ora.ons.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.racdb.db
TYPE=ora.database.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on host01

NAME=ora.scan2.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on host02

然后查看数据库实例:

host01机器:

[root@host01 ~]# ps -ef | grep pmon
oracle    3148     1  0 17:24 ?        00:00:01 asm_pmon_+ASM1
root      4182  2138  0 20:07 pts/2    00:00:00 grep pmon
oracle    7965     1  0 17:55 ?        00:00:02 ora_pmon_RACDB1

host02机器:

[oracle@host02 ~]$ ps -ef | grep pmon
oracle    3496     1  0 17:40 ?        00:00:00 asm_pmon_+ASM2
oracle    5994     1  0 17:56 ?        00:00:01 ora_pmon_RACDB2
oracle   28187 28159  0 20:08 pts/1    00:00:00 grep pmon


关闭数据库实例:
[root@host01 cmd]# srvctl stop database -d RACDB -o immediate

完成后再查看实例进程

[root@host01 ~]# ps -ef | grep pmon
oracle    3148     1  0 17:24 ?        00:00:01 asm_pmon_+ASM1
root      5737  2138  0 20:13 pts/2    00:00:00 grep pmon

[oracle@host02 ~]$ ps -ef | grep pmon
oracle    3496     1  0 17:40 ?        00:00:00 asm_pmon_+ASM2
oracle   29375 28159  0 20:13 pts/1    00:00:00 grep pmon

我们发现打开了RACDB数据库的两个实例RACDB1 和 RACDB2都已经关闭了


接下来停止集群件

[root@host01 cmd]# crsctl stop cluster -all

现在可以看到ASM实例也已经关闭了。

[root@host01 ~]# ps -ef | grep pmon
root      8231  2138  0 20:23 pts/2    00:00:00 grep pmon

[oracle@host02 ~]$ ps -ef | grep pmon
oracle   30696 28159  0 20:23 pts/1    00:00:00 grep pmon


然后就可以愉快的关闭服务器啦~~~

你可能感兴趣的:(oracle,服务器,RAC)