Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2736356
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: Oracle

2010-09-20 12:40:07

                                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

阅读(3751) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-09-21 08:05:36

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com