在Oracle 10g中CRS Resource 包括GSD(Global Serveice Daemon),ONS(Oracle Notification Service),VIP, Database, Instance 和 Service
在11gR2里面启动CRS的时候,会提示ohasd已经启动。 那么这个OHASD到底包含哪些资源。
[root@racnode1 ~]# crsctl status resource -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ARCH.dg ONLINE ONLINE racnode1 ONLINE ONLINE racnode2 ora.DATA.dg ONLINE ONLINE racnode1 ONLINE ONLINE racnode2 ora.LISTENER.lsnr ONLINE ONLINE racnode1 ONLINE ONLINE racnode2 ora.asm ONLINE ONLINE racnode1 Started ONLINE ONLINE racnode2 Started ora.gsd OFFLINE OFFLINE racnode1 OFFLINE OFFLINE racnode2 ora.net1.network ONLINE ONLINE racnode1 ONLINE ONLINE racnode2 ora.ons ONLINE ONLINE racnode1 ONLINE ONLINE racnode2 ora.registry.acfs ONLINE ONLINE racnode1 ONLINE ONLINE racnode2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE racnode1 ora.cvu 1 ONLINE ONLINE racnode1 ora.oc4j 1 ONLINE ONLINE racnode1 ora.prod.db 1 ONLINE ONLINE racnode1 Open 2 ONLINE ONLINE racnode2 Open ora.racnode1.vip 1 ONLINE ONLINE racnode1 ora.racnode2.vip 1 ONLINE ONLINE racnode2 ora.scan1.vip 1 ONLINE ONLINE racnode1
如果要关闭RAC 不能再通过crs_stop -all,这个命令是10g所使用的,在11g由于CRS的信息也是放在ASM 实例里的,所以要关asm,必须关闭crs,在Oracle11g RAC的架构如下
要关闭RAC,需在2个节点都配置好root的.bash_profile
export ORACLE_HOME=/u01/grid/product/11gr2 export PATH=$ORACLE_HOME/bin:$PATH
关闭RAC
[root@racnode1 ~]# crsctl stop has [root@racnode2 ~]# crsctl stop has
启动RAC
[root@racnode1 ~]# crsctl start has [root@racnode2 ~]# crsctl start has
crsctl的其他选项,通过以下命令只需要在一个节点上启动关闭RAC racnode1是节点的主机名
[root@racnode1 ~]# crsctl stop cluster -n racnode1 racnode2
启动RAC
[root@racnode1 ~]# crsctl start cluster -n racnode1 racnode2
当直接停止集群时,相关的Resource 也会被停止。 但实际情况下,我们操作更多的是对某些资源的启动或关闭等操作。具体就是使用SRVCTL 命令。该命令不常用总被忘记,因此可以用帮助选项 –h 来查看命令帮助:
[grid@racnode1 ~]$ srvclt –h
这个命令显示的结果太长,不好查看,可以进一步的查看帮助:
[grid@racnode1 ~]$ srvctl start -h
通过下列命令直接关闭数据库,通过上述帮助命令可以查看其他相关操作
[root@racnode1 ~]# srvctl stop database -d prod
crs_ctl -t命令仍然可用,11g rac有个BUG 实例正常启动,但是状态是offline
[root@racnode2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE racnode1
ora.DATA.dg ora....up.type ONLINE ONLINE racnode1
ora....ER.lsnr ora....er.type ONLINE ONLINE racnode1
ora....N1.lsnr ora....er.type ONLINE ONLINE racnode1
ora.asm ora.asm.type ONLINE ONLINE racnode1
ora.cvu ora.cvu.type ONLINE ONLINE racnode1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE racnode1
ora.oc4j ora.oc4j.type ONLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE racnode1
ora.prod.db ora....se.type ONLINE OFFLINE
ora....SM1.asm application ONLINE ONLINE racnode1
ora....E1.lsnr application ONLINE ONLINE racnode1
ora....de1.gsd application OFFLINE OFFLINE
ora....de1.ons application ONLINE ONLINE racnode1
ora....de1.vip ora....t1.type ONLINE ONLINE racnode1
ora....SM2.asm application ONLINE ONLINE racnode2
ora....E2.lsnr application ONLINE ONLINE racnode2
ora....de2.gsd application OFFLINE OFFLINE
ora....de2.ons application ONLINE ONLINE racnode2
ora....de2.vip ora....t1.type ONLINE ONLINE racnode2
ora....ry.acfs ora....fs.type ONLINE ONLINE racnode1
ora.scan1.vip ora....ip.type ONLINE ONLINE racnode1
尝试指定节点再次启动即可
srvctl start instance -d prod -i prod1
再次查看
[root@racnode2 ~]# crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.ARCH.dg ora....up.type ONLINE ONLINE racnode1 ora.DATA.dg ora....up.type ONLINE ONLINE racnode1 ora....ER.lsnr ora....er.type ONLINE ONLINE racnode1 ora....N1.lsnr ora....er.type ONLINE ONLINE racnode1 ora.asm ora.asm.type ONLINE ONLINE racnode1 ora.cvu ora.cvu.type ONLINE ONLINE racnode1 ora.gsd ora.gsd.type OFFLINE OFFLINE ora....network ora....rk.type ONLINE ONLINE racnode1 ora.oc4j ora.oc4j.type ONLINE ONLINE racnode1 ora.ons ora.ons.type ONLINE ONLINE racnode1 ora.prod.db ora....se.type ONLINE ONLINE racnode1 ora....SM1.asm application ONLINE ONLINE racnode1 ora....E1.lsnr application ONLINE ONLINE racnode1 ora....de1.gsd application OFFLINE OFFLINE ora....de1.ons application ONLINE ONLINE racnode1 ora....de1.vip ora....t1.type ONLINE ONLINE racnode1 ora....SM2.asm application ONLINE ONLINE racnode2 ora....E2.lsnr application ONLINE ONLINE racnode2 ora....de2.gsd application OFFLINE OFFLINE ora....de2.ons application ONLINE ONLINE racnode2 ora....de2.vip ora....t1.type ONLINE ONLINE racnode2 ora....ry.acfs ora....fs.type ONLINE ONLINE racnode1 ora.scan1.vip ora....ip.type ONLINE ONLINE racnode1