使用srvctl 启动和关闭rac
在centos 6中启动CRS,CSSD等服务的文件,在/etc/init.d目录下
[root@csicn20db01 init.d]# ls -l init.ohasd
-rwxr-xr-x 1 root root 8782 May 10 13:30 init.ohasd
查看集群的状态
[grid@csicn20db01 ~]$ crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRS.dg
ONLINE ONLINE csicn20db01
ONLINE ONLINE csicn20db02
ora.DATA.dg
ONLINE ONLINE csicn20db01
ONLINE ONLINE csicn20db02
ora.LISTENER.lsnr
ONLINE ONLINE csicn20db01
ONLINE ONLINE csicn20db02
ora.asm
ONLINE ONLINE csicn20db01 Started
ONLINE ONLINE csicn20db02 Started
ora.gsd
OFFLINE OFFLINE csicn20db01
OFFLINE OFFLINE csicn20db02
ora.net1.network
ONLINE ONLINE csicn20db01
ONLINE ONLINE csicn20db02
ora.ons
ONLINE ONLINE csicn20db01
ONLINE ONLINE csicn20db02
ora.registry.acfs
ONLINE ONLINE csicn20db01
ONLINE ONLINE csicn20db02
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE csicn20db02
ora.csicn20db01.vip
1 ONLINE ONLINE csicn20db01
ora.csicn20db02.vip
1 ONLINE ONLINE csicn20db02
ora.cvu
1 OFFLINE OFFLINE
ora.mycim.db
1 ONLINE ONLINE csicn20db01 Open
2 ONLINE ONLINE csicn20db02 Open
ora.oc4j
1 OFFLINE OFFLINE
ora.scan1.vip
1 ONLINE ONLINE csicn20db02
Note:正确关闭rac有助于理解rac各个资源的依赖关系
关闭rac
1:关闭数据库
[grid@csicn20db01 ~]$ srvctl stop database -d mycim
Note:mycim为数据库
[grid@csicn20db01 ~]$ crsctl status res -t
可以看到数据库offline
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE csicn20db02
ora.csicn20db01.vip
1 ONLINE ONLINE csicn20db01
ora.csicn20db02.vip
1 ONLINE ONLINE csicn20db02
ora.cvu
1 OFFLINE OFFLINE
ora.mycim.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
2:关闭节点的的asm实例
[grid@csicn20db01 ~]$ srvctl stop asm -n csicn20db01
[grid@csicn20db01 ~]$ srvctl stop asm -n csicn20db02
PRCR-1014 : Failed to stop resource ora.asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2529: Unable to act on 'ora.asm' because that would require stopping or relocating 'ora.CRS.dg', but the force option was not specified
Note:无法关闭asm,这是因为ocr盘存放在asm盘上,而crsd又是asm的client客户端,所以无法关闭asm,但是后面的提示说强制关闭的方式不受限制
解决方式:
关闭CRS(两个节点都需要执行)
[root@csicn20db01 bin]# ./crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.crsd' on 'csicn20db01'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.CRS.dg' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'csicn20db01'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.csicn20db01.vip' on 'csicn20db01'
CRS-2677: Stop of 'ora.DATA.dg' on 'csicn20db01' succeeded
CRS-2677: Stop of 'ora.registry.acfs' on 'csicn20db01' succeeded
CRS-2677: Stop of 'ora.csicn20db01.vip' on 'csicn20db01' succeeded
CRS-2672: Attempting to start 'ora.csicn20db01.vip' on 'csicn20db02'
CRS-2676: Start of 'ora.csicn20db01.vip' on 'csicn20db02' succeeded
CRS-2677: Stop of 'ora.CRS.dg' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'csicn20db01'
CRS-2677: Stop of 'ora.asm' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'csicn20db01'
CRS-2677: Stop of 'ora.ons' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'csicn20db01'
CRS-2677: Stop of 'ora.net1.network' on 'csicn20db01' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'csicn20db01' has completed
CRS-2677: Stop of 'ora.crsd' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.evmd' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.asm' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'csicn20db01'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'csicn20db01'
CRS-2677: Stop of 'ora.evmd' on 'csicn20db01' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'csicn20db01' succeeded
CRS-2677: Stop of 'ora.asm' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'csicn20db01'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'csicn20db01' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'csicn20db01'
CRS-2677: Stop of 'ora.drivers.acfs' on 'csicn20db01' succeeded
CRS-2677: Stop of 'ora.cssd' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'csicn20db01'
CRS-2677: Stop of 'ora.gipcd' on 'csicn20db01' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'csicn20db01'
CRS-2677: Stop of 'ora.gpnpd' on 'csicn20db01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'csicn20db01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
节点二也执行
[root@csicn20db02 bin]# ./crsctl stop crs
Note:可以看到关闭了所有的集群资源和asm实例
启动rac
启动CRS(两个节点都执行)
[root@csicn20db02 bin]# ./crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
[grid@csicn20db01 ~]$ crsctl status res -t
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE csicn20db01
ora.csicn20db01.vip
1 ONLINE ONLINE csicn20db01
ora.csicn20db02.vip
1 ONLINE ONLINE csicn20db02
ora.cvu
1 OFFLINE OFFLINE
ora.mycim.db
1 OFFLINE OFFLINE Instance Shutdown
2 OFFLINE OFFLINE Instance Shutdown
ora.oc4j
1 OFFLINE OFFLINE
ora.scan1.vip
1 ONLINE ONLINE csicn20db01
Note:根据资源状态没有启动数据库
启动数据库
[grid@csicn20db01 ~]$ srvctl start instance -d mycim -i mycim1 -o open
[grid@csicn20db01 ~]$ srvctl start instance -d mycim -i mycim2 -o open
查看资源状态
ora.mycim.db
1 ONLINE ONLINE csicn20db01 Open
2 ONLINE ONLINE csicn20db02 Open
启动某一个instance
srvctl start nodeapps -n rac1
srvctl start asm -n rac1
srvctl start instance -d racdb -i racdb1 -o open
单独启动和关闭某一个资源
crsctl start ora.csicn20db01.vip
crsctl stop ora.csicn20db01.vip