日期:2014-05-16  浏览次数:20630 次

linux下设置oracle开机自启动
#!/bin/sh
#
# Copyright (C) 1998-2008 Oracle, Inc. All Rights Reserved.
#
# This script manages the services needed to run oracle software
# Basic support for IRIX style chkconfig
# chkconfig: 2345 99 01
# description: ORACLE 10g Server
ORACLE_HOME=/oracle/10g
ORACLE_BASE=/oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "ORACLE cannot start"
exit
fi
case "$1" in
'start')
echo "Starting Oracle Database..."
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Starting Oracle Databasee as part of system up." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - oracle -c "$ORACLE_HOME/bin/dbstart" >> /var/log/oracle
echo "Done."
echo "Starting Oracle EM Control ... "
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Starting Oracle EM Control as part of system up." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole" >> /var/log/oracle
echo "Done."
echo ""
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Finished." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
;;
'stop')
echo "Stoping Oracle Database"
su - oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole" >> /var/log/oracle
echo "Stoping Oracle EM Control ... "
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Stoping Oracle EM Control as part of system down." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - oracle -c "$ORACLE_HOME/bin/dbshut" >> /var/log/oracle
echo "Done."
echo ""
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Finished." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
;;
'restart')
$0 stop
$0 start
;;
*)
echo "Usage: oracle {start|stop|restart}"
exit 1
esac

【本人另一篇linux下oracle 10g安装的文章的一步对于以上启动代码】