Linux下自动启动Oracle服务器

2014-11-24 17:25:50 · 作者: · 浏览: 0

  然后编辑此oracle10g文件。内容如下。


# !/bin/bash
# whoami
# root
# chkconfig: 345 51 49
# description: starts the oracle dabase deamons
#
ORA_HOME=/opt/oracle
ORA_OWNER=oracle
case "$1" in
'start')
echo -n "Starting oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
touch /var/lock/subsys/oracle10g
echo
;;


'stop')
echo -n "shutting down oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
rm -f /var/lock/subsys/oracle10g
echo
;;


'restart')
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
*)
echo "usage: oracle10g { start | stop | restart }"
exit 1


esac
exit 0
  保存文件,退出以后,添加并启动察看服务。


/sbin/chkconfig --add oracle10g
/sbin/chkconfig --list oracle10g
  重新启动Linux的时候,如果看到启动项Oracle出现OK,代表Oracle成功随Linux启动了。