您的位置:首页 > 数据库 > Oracle

Oracle 学习之RAC(七) 集群启动解析

2015-08-13 22:54 721 查看
集群安装完毕后,重启计算机,集群会跟在系统一起启动。网上很多文章都说是在/etc/inittab中添加一行
h1:35:respawn:/etc/init.d/init.ohasd run >/dev/null 2>&1
但是在我装出来的系统中,inittab中并没有设置任何集群启动的信息。那么集群究竟是怎么启动的呢?

我们查看一下/etc/rc5.d或者/etc/rc3.d这个目录下的脚本。
[root@11grac1 rc5.d]# ll S96ohasd
lrwxrwxrwx 1 root root 17 Aug 13 11:11 S96ohasd -> /etc/init.d/ohasd
就是因为有了这个,集群才会随机启动的。

ohasd是整个集群的一个高可用服务,监控集群中的各个进程。当集群进程崩溃后,尝试重启这些进程。
系统启动时,会调用

crsctl start has -nowait


那么如何禁止集群自启动呢?
[root@11grac1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@11grac1 bin]# ./crsctl disable crs
CRS-4621: Oracle High Availability Services autostart is disabled.
/etc/oracle/scls_scr/11grac1/root/ohasdstr
这个脚本中的值控制着集群是否可以自动启动。

如何手工启动集群:
[root@11grac1 root]# /u01/app/11.2.0/grid/bin/crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
此命令先启动ohasd,然后由ohasd启动crsd、cssd等后台进程
[root@11grac1 root]# /u01/app/11.2.0/grid/bin/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
同时,它也会把数据库、asm、监听都一起启动。

关闭集群使用命令
[root@11grac1 root]# /u01/app/11.2.0/grid/bin/crsctl stop crs


如果想把这个集群中的全部或大部分关闭,可以使用如下命令
[root@11grac1 root]# /u01/app/11.2.0/grid/bin/crsctl start cluster -all
或者
[root@11grac1 root]# /u01/app/11.2.0/grid/bin/crsctl start cluster -n 11grac1 11grac2
但是使用start cluster命令的前提是ohasd已经启动。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ohasd