Cluster 中啟動 Oracle 的方法
2013-07-14 03:02
1.先建立以下 bash script
[root@voipdb1 dbclu]# cat dbstart.sh
#!/bin/sh
sqlplus / as sysdba<
startup
exit
EOF
lsnrctl start
[root@voipdb1 dbclu]# cat dbstop.sh
#!/bin/sh
lsnrctl stop
sqlplus / as sysdba<
shutdown immediate
exit
EOF
2. 建立啟動 script
[root@voipdb1 init.d]# cat oradb
#!/bin/bash
start() {
su - oracle -c '/etc/init.d/dbclu/dbstart.sh'
echo "$(date) oracle service start" >> /var/log/cluster/event
RETVAL=$?
}
stop() {
su - oracle -c '/etc/init.d/dbclu/dbstop.sh'
echo "$(date) oracle service stop" >> /var/log/cluster/event
RETVAL=$?
}
status() {
aa=`ps -ef|grep "ora_smon_orcl$"|grep -v grep |wc -l`
bb=`ps -ef|grep "tnslsnr LISTENER -inherit$"|grep -v grep |wc -l`
if [ $aa -lt 1 ] ; then
RETVAL=1
echo "$(date) smon Process not found!" >> /var/log/cluster/event
elif [ $bb -lt 1 ] ; then
echo "$(date) smon Process not found!" >> /var/log/cluster/event
su - oracle -c 'lsnrctl start'
RETVAL=$?
else
RETVAL=0
echo "ALL Service OK!!"
fi
echo $RETVAL
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: oradb {start|stop|status}"
exit 1
;;
esac
echo $RETVAL
exit $RETVAL
3. 在 Cluster 網頁中設定
4. 設定 fence