文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>RHCS+Oracle11g监控脚本

RHCS+Oracle11g监控脚本

时间:2010-09-20  来源:ghan

                                RHCS+Oracle11g监控脚本
#!/bin/bash
#
# standalone oracle databases
#
# description: oradb10g is a database daemon, which is the program
# that answer incoming database service requests.
# this script start listener and database daemon

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

unset ORACLE_HOME
unset ORACLE_OWNER
ORACLE_HOME=/u01/oracle/product/11.1.0/db_1
ORACLE_OWNER=oracle
export ORACLE_OWNER ORACLE_HOME

LISTENER=$ORACLE_HOME/bin/lsnrctl
DBSTART=$ORACLE_HOME/bin/dbstart
DBSHUTDOWN=$ORACLE_HOME/bin/dbshut
LOG=$ORACLE_HOME/logs

# gernel logs file
if [ -e $LOG ] ; then
touch $LOG
chown $ORACLE_OWNER $LOG
fi

start() {
# Start daemons.
RETVAL=$?
echo "Starting oracle linstener and databases"
/bin/date '+%F %X Starting oracle linstener and databases' >> $LOG
/bin/su - $ORACLE_OWNER -c "$LISTENER start >> $LOG"
/bin/su - $ORACLE_OWNER -c "$DBSTART >>$LOG"
return $RETVAL
}

stop() {
# Stop daemons.
echo $"Shutting down listener and databases "
RETVAL=$?
/bin/date '+%F %X Shutting down listener and databases ' >> $LOG
/bin/su - $ORACLE_OWNER -c "$LISTENER stop >> $LOG"
/bin/su - $ORACLE_OWNER -c "$DBSHUTDOWN >> $LOG"
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
status)
ps -ef |grep -v grep |grep -q ora_smon_gtmc
if [ $? = 0 ]
then
  exit 0
else
  exit 1
fi
;;

*)
echo $"Usage: $0 {start|stop|restart|}"
exit 1
esac

exit $RETVAL

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载