1.关闭数据库
切换至oracle用户
1.1 查看数据库实例状态
[oracle@db1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node db1
Instance orcl2 is running on node db2
1.2 停止所有节点上实例
[oracle@db1 ~]$ srvctl stop database -d orcl
2.停止HAS(High Availability Services),必须以root用户操作
2.1 查看节点集群状态
切换至grid用户,查看本节点集群进程状态
[grid@db1 ~]$ 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
查看本节点集群状态
[grid@db1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE db1
ora.FRA.dg ora....up.type 0/5 0/ ONLINE ONLINE db1
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE db1
ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE db2
2.2 停止has服务
需要在RAC的所有节点上执行,启动也一样。has与crs等同
[root@db1 ~]# find / -name crsctl
/u01/app/grid/11.2.0/bin/crsctl
[root@db1 ~]# cd /u01/app/grid/11.2.0/bin/
[root@db1 bin]# ./crsctl stop has -f
其实停止HAS服务以后集群已经关停,可以查看集群状态确认,无需下面3、4步
2.3 停止crs服务
需要在RAC的所有节点上执行,启动也一样。has与crs等同
root@db1 bin]# ./crsctl stop crs -f
CRS-4544: Unable to connect to OHAS
2.4 停止节点集群服务
停止节点集群服务,必须以root用户:
[root@db1 oracle]# cd /u01/grid/11.2.0/grid/bin
[root@db1 bin]# ./crsctl stop cluster ----停止本节点集群服务
[root@db1 bin]# ./crsctl stop cluster -all ---停止所有节点服务
也可以如下控制所停节点:
[root@rac1 bin]# crsctl stop cluster -n rac1 rac2
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
3 启动集群
可以单节点启动也可以双节点同时启动,下面分别介绍
3.1 单节点启动
两个节点都要执行
节点1
[root@db1 bin]# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[root@db1 bin]# ./crsctl start crs
CRS-4640: Oracle High Availability Services is already active
CRS-4000: Command Start failed, or completed with errors.
[root@db1 bin]# ./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
节点2也需要执行
3.2 所有节点启动
单节点执行即可
[root@db2 bin]# ./crsctl start cluster -n db1 db2
CRS-4690: Oracle Clusterware is already running on 'db1'
CRS-4690: Oracle Clusterware is already running on 'db2'
CRS-4000: Command Start failed, or completed with errors.
3.3 检查集群状态
[root@db1 bin]# ./crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE db1
ora.FRA.dg ora....up.type 0/5 0/ ONLINE ONLINE db1
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE db1
ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE db1
ora.ORC.dg ora....up.type 0/5 0/ ONLINE ONLINE db1
ora.REDO.dg ora....up.type 0/5 0/ ONLINE ONLINE db1
ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE db1
ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE db2
4、启动数据库
oracl用户执行srvctl命令:
语法:srvctl start|stop|status database -d dbname [-o immediate]
作用:可以一次性启动dbname的所有实例
4.1 启动所有节点数据库实例
[oracle@db1 ~]$ srvctl start database -d orcl
4.2 查看多有节点数据库实例状态
[oracle@db1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node db1
Instance orcl2 is running on node db2
4.3.详细输出资源全名称并检查状态
[grid@db1 ~]$ crsctl status resource -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
5、rac常用命令
5.1 常用srvctl命令
指定dbname上某个实例
srvctl start|stop|status instance -d -i <instance_name>
5.2 显示RAC下所有实例配置与状态
srvctl status|config database -d
5.3 显示所有节点的应用服务(VIP,GSD,listener,ONS)
srvctl start|stop|status nodeapps -n<node_name>
5.4 ASM进程服务管理
srvctl start|stop|status|config asm -n [-i <asm_inst_name>] [-o<oracle_home>]
srvctl config asm -a
srvctl status asm -a
5.5 获取所有的环境信息:
srvctl getenv database -d [-i<instance_name>]
5.6 设置全局环境和变量:
srvctl setenv database -d -t LANG=en
5.7 在OCR中删除已有的数据库信息
srvctl remove database -d
5.8 向OCR中添加一个数据库的实例:
srvctl add instance -d -i<instance_name> -n
srvctl add instance -d -i<instance_name> -n
5.9 检查监听的状态
srvctl status listener -l +实例名
srvctl config listener -a
5.10 SCAN配置信息
srvctl config scan
5.11 SCAN listener状态信息
srvctl status scan
小结:
crsctl命令是一个集群级别命令,可以对所有集群资源进行统一启动、停止等管理操作
srvctl命令是一个服务级别命令,可以对单一服务资源进行统一启动、停止等管理操作
标签:CRS,数据库,db1,集群,srvctl,ONLINE,oracle,节点,ora From: https://www.cnblogs.com/wjm0401/p/16729689.html