转至:https://www.cnblogs.com/yj411511/p/12459533.html
目录

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 

1.3 确认数据库实例状态

[oracle@db1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node db1
Instance orcl2 is not running on node db2
[oracle@db2 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node db1
Instance orcl2 is not running on node db2

2、停止HAS(High Availability Services),必须以root用户操作

2.1 查看节点集群状态

切换至grid用户,查看本节点集群进程状态

crsctl check crs

[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@db2 ~]$ 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
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
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE db1
ora....B1.lsnr application 0/5 0/0 ONLINE ONLINE db1
ora.db1.gsd application 0/5 0/0 ONLINE OFFLINE
ora.db1.ons application 0/3 0/0 ONLINE ONLINE db1
ora.db1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE db1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE db2
ora....B2.lsnr application 0/5 0/0 ONLINE ONLINE db2
ora.db2.gsd application 0/5 0/0 ONLINE OFFLINE
ora.db2.ons application 0/3 0/0 ONLINE ONLINE db2
ora.db2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE db2
ora.gsd ora.gsd.type 0/5 0/ ONLINE OFFLINE
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE db1
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE db2
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE db1
ora.orcl.db ora....se.type 0/2 0/1 ONLINE ONLINE db1
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE db1
ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE db2
[grid@db2 ~]$  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
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
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE db1
ora....B1.lsnr application 0/5 0/0 ONLINE ONLINE db1
ora.db1.gsd application 0/5 0/0 ONLINE OFFLINE
ora.db1.ons application 0/3 0/0 ONLINE ONLINE db1
ora.db1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE db1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE db2
ora....B2.lsnr application 0/5 0/0 ONLINE ONLINE db2
ora.db2.gsd application 0/5 0/0 ONLINE OFFLINE
ora.db2.ons application 0/3 0/0 ONLINE ONLINE db2
ora.db2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE db2
ora.gsd ora.gsd.type 0/5 0/ ONLINE OFFLINE
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE db1
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE db2
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE db1
ora.orcl.db ora....se.type 0/2 0/1 ONLINE ONLINE db1
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE db1
ora.scan1.vip ora....ip.type 0/0 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 [root@db2 ~]# find / -name crsctl
/u01/app/grid/11.2.0/bin/crsctl
[root@db2 ~]# cd /u01/app/grid/11.2.0/bin/
[root@db2 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
[root@db2 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

[root@db2 bin]# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[root@db2 bin]# ./crsctl start crs
CRS-4640: Oracle High Availability Services is already active
CRS-4000: Command Start failed, or completed with errors.
[root@db2 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

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.

或者

[root@db2 bin]# ./crsctl start cluster -all
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
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE db1
ora....B1.lsnr application 0/5 0/0 ONLINE ONLINE db1
ora.db1.gsd application 0/5 0/0 ONLINE OFFLINE
ora.db1.ons application 0/3 0/0 ONLINE ONLINE db1
ora.db1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE db1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE db2
ora....B2.lsnr application 0/5 0/0 ONLINE ONLINE db2
ora.db2.gsd application 0/5 0/0 ONLINE OFFLINE
ora.db2.ons application 0/3 0/0 ONLINE ONLINE db2
ora.db2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE db2
ora.gsd ora.gsd.type 0/5 0/ ONLINE OFFLINE
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE db1
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE db2
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE db1
ora.orcl.db ora....se.type 0/2 0/1 OFFLINE OFFLINE
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE db1
ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE db1

说明:

英文解释:

ora.gsd is OFFLINE by default ifthere is no 9i database in the cluster.
ora.oc4j is OFFLINE in 11.2.0.1 as DatabaseWorkload Management(DBWLM) is unavailable. these can be ignored in11gR2 RAC.

中文解释:

ora.gsd是集群服务中用于与9i数据库进行通信的一个进程,在当前版本中为了向后兼容才保存下来,状态为OFFLINE不影响CRS的正常运行与性能,我们忽略即可
ora.oc4j是在11.2.0.2以上版本中有效的服务进程,用于DBWLM的资源管理,因此在11.2.0.1以下版本并没有使用

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
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.FRA.dg
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.LISTENER.lsnr
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.ORC.dg
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.REDO.dg
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.asm
ONLINE ONLINE db1 Started
ONLINE ONLINE db2 Started
ora.gsd
ONLINE OFFLINE db1
ONLINE OFFLINE db2
ora.net1.network
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.ons
ONLINE ONLINE db1
ONLINE ONLINE db2
ora.registry.acfs
ONLINE ONLINE db1
ONLINE ONLINE db2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE db1
ora.cvu
1 ONLINE ONLINE db2
ora.db1.vip
1 ONLINE ONLINE db1
ora.db2.vip
1 ONLINE ONLINE db2
ora.oc4j
1 ONLINE ONLINE db2
ora.orcl.db
1 ONLINE ONLINE db1 Open
2 ONLINE ONLINE db2 Open
ora.scan1.vip
1 ONLINE ONLINE db1 [grid@db1 ~]$ crsctl status resource
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.FRA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.LISTENER_SCAN1.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on db1 NAME=ora.ORC.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.REDO.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.cvu
TYPE=ora.cvu.type
TARGET=ONLINE
STATE=ONLINE on db2 NAME=ora.db1.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on db1 NAME=ora.db2.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on db2 NAME=ora.gsd
TYPE=ora.gsd.type
TARGET=ONLINE , ONLINE
STATE=OFFLINE, OFFLINE NAME=ora.net1.network
TYPE=ora.network.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.oc4j
TYPE=ora.oc4j.type
TARGET=ONLINE
STATE=ONLINE on db2 NAME=ora.ons
TYPE=ora.ons.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.orcl.db
TYPE=ora.database.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on db1, ONLINE on db2 NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on db1

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命令是一个服务级别命令,可以对单一服务资源进行统一启动、停止等管理操作

 
 
 

oracle 11g rac集群重启顺序以及常用管理命令简介的更多相关文章

  1. 转载:【Oracle 集群】RAC知识图文详细教程(七)--Oracle 11G RAC集群安装

    文章导航 集群概念介绍(一) ORACLE集群概念和原理(二) RAC 工作原理和相关组件(三) 缓存融合技术(四) RAC 特殊问题和实战经验(五) ORACLE 11 G版本2 RAC在LINUX ...

  2. oracle 11g rac集群 asm磁盘组增加硬盘

    创建asm磁盘的几种方式 创建asm磁盘方式很多主要有以下几种 1.Faking方式 2.裸设备方式 3.udev方式(它下面有两种方式) 3.1 uuid方式 3.2 raw方式(裸设备方式) 4. ...

  3. 11g RAC集群启动关闭、各种资源检查、配置信息查看汇总。

    简要:一:集群的启动与关闭 1. rac集群的手动启动[root@node1 bin]# ./crsctl start cluster -all2. 查看rac集群的状态[root@node1 bin ...

  4. Oracle 12cR1 RAC集群安装(一)--环境准备

    基本环境 操作系统版本 RedHat6.7 数据库版本 12.1.0.2 数据库名称 testdb 数据库实例 testdb1.testdb2 (一)安装服务器硬件要求 配置项目 参数要求 网卡 每台 ...

  5. Oracle 12cR1 RAC集群安装(二)--使用图形界面安装

    Oracle 12cR1 RAC集群安装文档:Oracle 12cR1 RAC集群安装(一)--环境准备Oracle 12cR1 RAC集群安装(二)--使用图形界面安装Oracle 12cR1 RA ...

  6. Hadoop基础-HDFS集群中大数据开发常用的命令总结

    Hadoop基础-HDFS集群中大数据开发常用的命令总结 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 本盘博客仅仅列出了我们在实际生成环境中常用的hdfs命令,如果想要了解更多, ...

  7. Oracle 11gR2 RAC集群服务启动与关闭总结

    引言:这写篇文章的出处是因为我的一名学生最近在公司搭建RAC集群,但对其启动与关闭的顺序和原理不是特别清晰,我在教学工作中也发现了很多学员对RAC知识了解甚少,因此我在这里就把RAC里面涉及到的最常用 ...

  8. 11g RAC 集群数据库不能跟随集群启动

    1.查看集群资源详细情况 [oracle@rac01-+ASM1 ~]$ crsctl stat res -p 2.修改集群资源ora.rac.db的auto_start属性改为always [ora ...

  9. 案例:Oracle 10g RAC 集群无法启动

    环境:RHEL 5.7 + Oracle 10.2.0.5 RAC 很多年前的一套测试环境,今天发现集群无法启动.手工尝试启动crs,集群日志也无任何输出.进一步检查集群配置: [oracle@rac ...

随机推荐

  1. node.js和vue cli脚手架下载安装配置方法

    一.node.js安装以及环境配置 1.下载vue.js 下载地址: https://nodejs.org/en/ 2.安装node.js 下载完成后,双击安装包开始安装.安装地址最好换成自己指定的地 ...

  2. 运维利器-ClusterShell集群管理

    在运维实战中,如果有若干台数据库服务器,想对这些服务器进行同等动作,比如查看它们当前的即时负载情况,查看它们的主机名,分发文件等等,这个时候该怎么办?一个个登陆服务器去操作,太傻帽了!写个shell去 ...

  3. Jupyter Notebook 更改字体、字体大小、行高

    (废话):今天在做实验的时候遇到了一点问题,就问了问本科的室友,结果室友推荐我使用Jupyter Notebook来写代码,以前看其他同学使用过,但是一直在用Pycharm写,需要的时候顶多是Debu ...

  4. STC89C52引脚图(彩色)

    不知道大家有没有见过像这样的arduino引脚功能图:   还有ESP系列: 还有stm32的: 给人的第一感觉就是漂亮,清晰明了,相比之下STC51的就...... 楼主搜罗了一下,目前网络上还没有 ...

  5. LeetCode673

    LeetCode每日一题2021.9.20 LeetCode673. 最长递增子序列的个数 思路 在最长上升子序列的转移时,维护一个 cnt 数组,表示 以 i 结尾的最长上升子序列个数 f[i] 表 ...

  6. C++学习Day 1

    c++的函数需要声明才能再写他的定义,声明可以写多次,如果执行在main之前可以不写,全写不会犯错,现在看好像c++的函数定义里没有out,也没有变量的public和private(后面有再改) 声明 ...

  7. ApacheCN 数据库译文集 20211112 更新

    创建你的 Mysql 数据库 零.前言 一.介绍 MySQL 设计 二.数据采集 三.数据命名 四.数据分组 五.数据结构调整 六.补充案例研究 Redis 学习手册 零.序言 一.NoSQL 简介 ...

  8. chmod 权限-rw-r--r--表示什么含义

    感谢原文作者:bugcoder321 原文链接:https://blog.csdn.net/li_canhui/article/details/89452134 在linux中,有时候可以看到一个文件 ...

  9. 我对JavaWeb中中文URL编码的简单总结

    1.application/x-www-form-urlencoded 它是一种编码类型.当URL地址里包含非西欧字符的字符串时,系统会将这些字符转换成application/x-www-form-u ...

  10. js获取高度

    转载请注明来源:https://www.cnblogs.com/hookjc/ <script> function getInfo() { var s = ""; s ...