数据库:Oracle 11.2.0.4
系统:CentOS 7.9
环境:ASM 单实例
问题:集群服务不随系统的启动而自动开启,告警日志报错如下:
2022-07-24 10:21:20.779:
[ohasd(2107)]CRS-0715:Oracle High Availability Service has timed out waiting for init.ohasd to be started.
临时解决方案:
Clear all sockets under /var/tmp/.oracle or /tmp/.oracle if any and then open two terminals of the same node, where stack is not coming up.
会话1:
[root@leo ~]# /u01/app/grid/product/11.2.0/grid/bin/crsctl start has
CRS-4123: Oracle High Availability Services has been started.
会话1执行start has后,马上在会话2执行以下语句,待has启动成功后,按CTRL+C终止dd命令.
[root@leo .oracle]# dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1
那么如何实现集群服务随系统的启动而自动开启呢?
以下解决此问题:
[root@leo ~]# vi /etc/init.d/ohasd
以下新增部分特别有说明,总共增加三行.
if [ -r $AUTOSTARTFILE ]
then
case `$CAT $AUTOSTARTFILE` in
enable*)
$LOGERR "Oracle HA daemon is enabled for autostart."
/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1 & (此行为新增)
my_crsctl start has -nowait
sleep 600 (此行为新增)
ps -ef | grep dd| grep hasd|awk '{print $2}'|xargs kill -9 (此行为新增)
;;
disable*)
$LOGERR "Oracle HA daemon is disabled for autostart."
重启系统后集群也自动开启.
[root@leo ~]# reboot
[grid@leo ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE leo
ora.LISTENER.lsnr
ONLINE ONLINE leo
ora.asm
ONLINE ONLINE leo Started
ora.ons
OFFLINE OFFLINE leo
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE leo
ora.diskmon
1 OFFLINE OFFLINE
ora.evmd
1 ONLINE ONLINE leo
ora.orcl.db
1 ONLINE ONLINE leo Open