|
蓝森林 http://www.lslnet.com 2006年8月26日 15:18
[转]rhel as3 下自动启动关闭数据库的脚本
解决系统关闭时数据库不能自动关闭的问题
#!/bin/bash
#
# chkconfig: 35 95 5
# description: Startup/shutdown script for oracle listener\
# and instance;
# tested in rhel as 3u3 with oracle 10gR1
# writen by blue_stone@xinhuanet.com
# 12/30/2005
case "$1" in
start)
#when system stop redhat check /var/lock/subsys/oracle
#to make sure oracle is running.
touch /var/lock/subsys/oracle
# start tsnlisnter
echo "start tsnlisnter"
su - oracle -c "lsnrctl start"
# start database
echo "Start Oracle database instance"
su - oracle -c "echo \"
CONN / AS SYSDBA
STARTUP
exit \"|sqlplus /NOLOG"
# start enterprise manager
#echo " Start Emterprise Manager"
#su - oracle -c "emctl start dbconsole"
# start isqlplus
#echo "Start isqlplus"
#su - oracle -c "isqlplusctl start"
;;
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 "Shutdown Oracle database instance"
su - oracle -c "echo \"
CONN / AS SYSDBA
SHUTDOWN immediate
exit \"|sqlplus /NOLOG"
# stop tsnlisnter
echo "Stop tsnlisnter"
su - oracle -c "lsnrctl stop"
# stop enterprise manager
#echo " Stop Emterprise Manager"
#su - oracle -c "emctl stop dbconsole"
# stop isqlplus
#echo "Stop isqlplus"
#su - oracle -c "isqlplusctl stop"
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
|
| |