# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_OWNER=oracle
LOG=$ORA_HOME/startup.log
chmod a+r $LOG
then
echo "Oracle startup: cannot start"
exit
fi
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
if [ -f $ORA_HOME/bin/tnslsnr ] ;
then
echo "starting Oracle Net listener"
su - $ORA_OWNER -c $ORA_HOME/bin/lsnrctl start >> $LOG 2>&1 &
fi
echo "starting Oracle databases"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart >> $LOG 2>&1
;;
'stop')
echo "$0: shutting down" >> $LOG
date >> $LOG
# Stop Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "stopping Oracle Net listener"
su - $ORA_OWNER -c $ORA_HOME/bin/lsnrctl stop >> $LOG 2>&1
fi
echo "stopping Oracle databases"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut >> $LOG 2>&1
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
不过,chkconfig确实比较简单,我是没有习惯用而已,因为要使脚本支持chkconfig,在脚本的头部还要加两行注释。
well,添加一个使用chkconfig的文章吧
要看dbshut脚本
9i中默认安装的dbshut脚本
只是执行shutdown命令,所以会导致有用户连接的时候无法关闭数据库
我们只需要手工去修改dbshut脚本
将其中的shutdown命令改为shutdown immediate就可以了
在 start中追加 lsnrctl start&
在 stop中追加 lsnrctl stop&