安装配置gi、安装数据库软件、dbca建库见下:
http://blog.csdn.net/kadwf123/article/details/78429961
1、检查集群节点及状态:
[root@rac2 ~]# olsnodes -s
rac1 Active
rac2 Active
rac3 Active
rac4 Active
[root@rac2 ~]#
可以看到集群的节点和状态信息。
2、检查crs
[root@rac2 ~]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[root@rac2 ~]#
只会列出当前节点的服务,可以看到四个集群的主要服务都是online的。
3、想看全部集群节点的情况:
[root@rac2 ~]# crsctl check cluster -all
**************************************************************
rac1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
rac2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
rac3:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
rac4:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
[root@rac2 ~]#
可以看到四个节点的集群状态,但是只能看到三个服务,其实看到这三个都是online,可以确定集群高可用服务ohasd也是活的。因为这个命令本身需要统计别的节点的集群信息,就是通过集群的高可用服务来进行通信的。
4、查看集群的资源:
[grid@rac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
ora.DATA.dg
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ONLINE ONLINE rac3 STABLE
OFFLINE OFFLINE rac4 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
ora.net1.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
ora.ons
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE rac3 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE rac1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE rac1 169.254.255.184 10.0
.11.2,STABLE
ora.asm
1 ONLINE ONLINE rac1 Started,STABLE
2 ONLINE ONLINE rac2 Started,STABLE
3 ONLINE ONLINE rac3 Started,STABLE
ora.cvu
1 ONLINE ONLINE rac1 STABLE
ora.mgmtdb
1 ONLINE ONLINE rac1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE rac1 STABLE
ora.rac1.vip
1 ONLINE ONLINE rac1 STABLE
ora.rac2.vip
1 ONLINE ONLINE rac2 STABLE
ora.rac3.vip
1 ONLINE ONLINE rac3 STABLE
ora.rac4.vip
1 ONLINE ONLINE rac4 STABLE
ora.scan1.vip
1 ONLINE ONLINE rac2 STABLE
ora.scan2.vip
1 ONLINE ONLINE rac3 STABLE
ora.scan3.vip
1 ONLINE ONLINE rac1 STABLE
ora.tar.db
1 ONLINE ONLINE rac3 Open,STABLE
2 ONLINE OFFLINE STABLE
3 ONLINE ONLINE rac2 Open,STABLE
4 ONLINE ONLINE rac4 Open,STABLE
--------------------------------------------------------------------------------
[grid@rac2 ~]$
集群的资源分为本地资源和集群资源。
5、集群的停止:
[root@rac2 ~]# crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac2'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac2'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac2'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac2'
CRS-2673: Attempting to stop 'ora.tar.db' on 'rac2'
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac2'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.rac2.vip' on 'rac2'
CRS-2677: Stop of 'ora.tar.db' on 'rac2' succeeded
CRS-2677: Stop of 'ora.scan1.vip' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.scan1.vip' on 'rac4'
CRS-2677: Stop of 'ora.rac2.vip' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.rac2.vip' on 'rac3'
CRS-2676: Start of 'ora.scan1.vip' on 'rac4' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'rac4'
CRS-2676: Start of 'ora.rac2.vip' on 'rac3' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'rac2'
CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'rac4'
CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'rac4' succeeded
ORA-00444: background process "PING" failed while starting
ORA-00610: Internal error code
CRS-2674: Start of 'ora.asm' on 'rac4' failed
CRS-2673: Attempting to stop 'ora.ons' on 'rac2'
CRS-2677: Stop of 'ora.ons' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac2'
CRS-2677: Stop of 'ora.net1.network' on 'rac2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac2' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.storage' on 'rac2'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac2'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac2'
CRS-2677: Stop of 'ora.storage' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac2'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac2'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac2'
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.crf' on 'rac2' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac2'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac2'
CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac2'
CRS-2677: Stop of 'ora.gipcd' on 'rac2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@rac2 ~]# crsctl check cluster -all
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Check failed, or completed with errors.
[root@rac2 ~]#
注意,集群的停止需要使用root用户权限。上面的命令只会停止一个集群节点。停止一个节点后的资源情况:
[root@rac3 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
ora.DATA.dg
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac3 STABLE
OFFLINE OFFLINE rac4 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
ora.net1.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
ora.ons
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac3 STABLE
ONLINE ONLINE rac4 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac4 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE rac3 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE rac1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE rac1 169.254.255.184 10.0
.11.2,STABLE
ora.asm
1 ONLINE ONLINE rac1 Started,STABLE
2 ONLINE OFFLINE Instance Shutdown,ST
ABLE
3 ONLINE ONLINE rac3 Started,STABLE
ora.cvu
1 ONLINE ONLINE rac1 STABLE
ora.mgmtdb
1 ONLINE ONLINE rac1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE rac1 STABLE
ora.rac1.vip
1 ONLINE ONLINE rac1 STABLE
ora.rac2.vip
1 ONLINE INTERMEDIATE rac3 FAILED OVER,STABLE
ora.rac3.vip
1 ONLINE ONLINE rac3 STABLE
ora.rac4.vip
1 ONLINE ONLINE rac4 STABLE
ora.scan1.vip
1 ONLINE ONLINE rac4 STABLE
ora.scan2.vip
1 ONLINE ONLINE rac3 STABLE
ora.scan3.vip
1 ONLINE ONLINE rac1 STABLE
ora.tar.db
1 ONLINE ONLINE rac3 Open,STABLE
2 ONLINE OFFLINE STABLE
3 ONLINE OFFLINE Instance Shutdown,ST
ABLE
4 ONLINE ONLINE rac4 Open,STABLE
--------------------------------------------------------------------------------
[root@rac3 ~]#
6、集群的停止,第二种方式:
[root@rac3 ~]# crsctl stop cluster -all
[root@rac3 ~]# crsctl stop crs
第一条命令会停止集群所有节点的csc、crs、evm三个服务。而第二条命令会停止当前执行命令的节点的ohasd高可用服务。
所以 第一条命令只需要一个节点上执行一次,第二条命令需要全部节点都执行一次。
7、集群的启动,3中方式,对应上面的集群停止。
第一种:
[root@rac3 ~]# crsctl start crs
启动当前节点。需要所有节点都执行。
[root@rac2 ~]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4529: Cluster Synchronization Services is online
CRS-4534: Cannot communicate with Event Manager
[root@rac2 ~]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[root@rac2 ~]#
第二种:
[root@rac3 ~]# crsctl start has
[root@rac3 ~]# crsctl start cluster
第三种:
直接通过oracle提供的自启动脚本启动:
/etc/init.d/init.ohasd run
[root@rac2 init.d]# pwd
/etc/init.d
[root@rac2 init.d]# ll *ohasd
-rwxr-xr-x. 1 root root 9114 10月 22 14:36 init.ohasd
-rwxr-xr-x. 1 root root 7148 10月 22 14:36 ohasd
[root@rac2 init.d]# nohup ./init.ohasd run &
通过脚本启动,4个节点都需要执行。