Chinaunix首页 | 论坛 | 博客
  • 博客访问: 284188
  • 博文数量: 48
  • 博客积分: 1255
  • 博客等级: 中尉
  • 技术积分: 486
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-01 18:28
文章分类

全部博文(48)

文章存档

2014年(10)

2012年(9)

2011年(17)

2010年(9)

2009年(3)

我的朋友

分类: LINUX

2010-12-08 22:26:17

#!/bin/bash
# /etc/init.d/oracle
### BEGIN INIT INFO
# Provides:
# Required-Start: $network $syslog
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Description: Startup/shutdown script for oracle listener and instance;
### END
. /etc/rc.status
rc_reset
start()
{
#when system stop redhat check /var/lock/subsys/oracle
#to make sure oracle is running.
touch /var/lock/subsys/oracle
# start tsnlisnter
echo -n "Start tsnlisnter:"
su - oracle -c "lsnrctl start" >/dev/null 2>/dev/null
rc_status -v
# start database
echo -n "Start Oracle database instance:"
su - oracle -c "echo \"
CONN / AS SYSDBA
STARTUP
exit \"|sqlplus /NOLOG" >/dev/null 2>/dev/null
rc_status -v
# start enterprise manager
echo -n "Start Enterprise Manager:"
su - oracle -c "emctl start dbconsole" >/dev/null 2>/dev/null
rc_status -v
#start isqlplus
echo -n "Start isqlplus"
su - oracle -c "isqlplusctl start">/dev/null 2>/dev/null
rc_status -v
}
stop()
{
#when system stop redhat check /var/lock/subsys/oracle
#to make sure oracle is running.
rm -rf /var/lock/subsys/oracle
# shutdown database
echo -n "Shutdown Oracle database instance:"
su - oracle -c "echo \"
CONN / AS SYSDBA
SHUTDOWN immediate
exit \"|sqlplus /NOLOG">/dev/null 2>/dev/null
rc_status -v
# stop tsnlisnter
echo -n "Stop tsnlisnter:"
su - oracle -c "lsnrctl stop">/dev/null 2>/dev/null
rc_status -v
# stop enterprise manager
echo -n "Stop Enterprise Manager:"
su - oracle -c "emctl stop dbconsole"
rc_status -v
# stop isqlplus
echo -n "Stop isqlplus:"
su - oracle -c "isqlplusctl stop"
rc_status -v
}
case "$1" in
start)
start
echo "Oracle Start at:" `date` >>/var/log/oracle.log
;;
stop)
stop
echo "Oracle Stop at:" `date` >>/var/log/oracle.log
;;
restart)
echo "Oracle Restart at:" `date` >>/var/log/oracle.log
stop
start
;;
*)
echo "Usage: $0 { start | stop| restart }"
exit 1

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

chinaunix网友2010-12-09 15:19:05

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