【前言】Oracle 12c RAC已经慢慢开始普及使用了,这边简单整理了RAC服务的启停操作。
【环境说明】
数据库版本:12.2.0.1
操作系统:Center OS 7.0
【基础知识】
Oracle RAC跟单节点的启停有很大的不一样,因为RAC是在集群件上面构建起来的,针对集群件Oracle增加了几个工具和命令,所以RAC的启停更多的是这几个工具的使用而已;
工具的分类,按照功能的区分简单可以分成两类:对于Oracle实例的管理srvctl和对于集群的管理crsctl。
【一】CRSCTL命令介绍
【1】crsctl命令的功能
Oracle Clusterware 11
g
release 2 (11.2)
introduces cluster-aware commands with which you can perform check,
start, and stop operations on the cluster. You can run these commands
from any node in the cluster on another node in the cluster, or on all
nodes in the cluster, depending on the operation.
You can use CRSCTL commands to perform several operations on Oracle Clusterware, such as:
Starting and stopping Oracle Clusterware resources
Enabling and disabling Oracle Clusterware daemons
Checking the health of the cluster
Managing resources that represent third-party applications
Integrating Intelligent Platform Management Interface (IPMI) with
Oracle Clusterware to provide failure isolation support and to ensure
cluster integrity
Debugging Oracle Clusterware component
【2】命令的使用
$ crsctl -help
Usage: crsctl add - add a resource, type or other entity
crsctl check - check the state or operating status of a service, resource, or other entity
crsctl config - display automatic startup configuration
crsctl debug - display or modify debug state
crsctl delete - delete a resource, type or other entity
crsctl disable - disable automatic startup
crsctl discover - discover DHCP server
crsctl enable - enable automatic startup
crsctl eval - evaluate operations on resource or other entity without performing them
crsctl get - get an entity value
crsctl getperm - get entity permissions
crsctl lsmodules - list debug modules
crsctl modify - modify a resource, type or other entity
crsctl query - query service state
crsctl pin - make the leases of specified nodes immutable
crsctl relocate - relocate a resource, server or other entity
crsctl replace - change the location of voting files
crsctl release - release a DHCP lease
crsctl request - request a DHCP lease or an action entry point
crsctl setperm - set entity permissions
crsctl set - set an entity value
crsctl start - start a resource, server or other entity
crsctl status - get status of a resource or other entity
crsctl stop - stop a resource, server or other entity
crsctl unpin - make the leases of previously pinned nodes mutable
crsctl unset - unset an entity value, restoring its default
这个命令可以看到crsctl的所有功能,还可以继续对更加详细的功能进行了解,比如:crsctl start -help
【3】进行集群件的常用操作
集群状态的检查
[grid@dbrac1 ~]$ crsctl check -help
Usage:
crsctl check crs
Check status of OHAS and CRS stack
crsctl check cluster [[-all]|[-n [...]]]
Check status of CRS stack
crsctl check ctss
Check status of Cluster Time Synchronization Services
crsctl check resource { [...]|-w } [-n ] [-k ] [-d ]
Check status of resources
crsctl check css
Check status of Cluster Synchronization Services
crsctl check evm
Check status of Event Manager
[grid@dbrac1 ~]$ crsctl check cluster -all
**************************************************************
dbrac1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
dbrac2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
通过以上命令就可以检查整个集群件的状态,
oline
说明都是启动状态
【集群的停止操作】
If you intend to stop Oracle Clusterware on all or a list of nodes, then use the
command, because it prevents certain resources from being relocated to
other servers in the cluster before the Oracle Clusterware stack is
stopped on a particular server. If you must stop the Oracle High
Availability Services on one or more nodes, then wait until the
crsctl stop cluster
command completes and then run the
crsctl stop crs
command on any particular nodes, as necessary.
crsctl stop cluster -all可以关闭集群件的集群服务
crsctl stop cluster -n node1 是关闭单台的集群服务
如果要关闭单台的的高可用服务用crsctl stop crs即可,关闭了高可用服务后,构建在高可用服务上的集群服务也会跟着关闭;
【集群的启动操作】
默认的情况下,启动操作系统后整个集群会跟着启动的,但是集群在启动的状态下进行了手工的关闭,那么就需要进行启动了。启动的命令其实也很简单:
启动整个集群的服务:crsctl start cluster -all
启动单台的集群服务:crsctl start cluster
如果这个时候高可用服务也被关了的话,运行命令:crsctl start crs,虽然表面上只启动OHAS服务,但是相关的集群服务也会跟着启动。
【自启动服务的配置】
刚才说了,集群服务会自动跟着操作系统的启用而启动的,如果操作系统启动后集群没有启动,要么集群有问题,或者集群的自启动服务没启用,通过下面的命令可以检查。
[root@dbrac1 ~]# crsctl config crs
CRS-4622: Oracle High Availability Services autostart is enabled.#这个状态说明是自动启用的
如果上面检查出来的状态是disable,那么可以通过以下命令进行启用;
crsctl enable crs
以上是简单的CRSCTL命令的常用介绍,后续会继续进行SRVCTL常用命令的介绍。