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

Red Hat 4.1.2-52下设置Oracle11g自启动


用root用户创建文件/etc/oratab,如果安装的话直接修改, 内容修改为orcl:/u01/app/oracle/product/11.2/db_1:Y

把ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME

#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g AutoRun Services
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

export ORACLE_HOME=$ORACLE_BASE/product/11gr2/db_1
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin

# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
     echo "Oracle startup: cannot start"
     exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
     # Oracle listener and instance startup
     su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
     echo "Oracle Start Succesful!OK."
     ;;
stop)
     # Oracle listener and instance shutdown
     su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
     echo "Oracle Stop Succesful!OK."
     ;;
reload|restart)
     $0 stop
     $0 start
     ;;
*)
     echo $"Usage: `basename $0` {start|stop|reload|reload}"
     exit 1
esac
exit 0

chmod 750 /etc/init.d/oracle
ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle
ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle
chkconfig --level 345 oracle on
chkconfig --add oracle

http://0574116.blog.163.com/blog/static/18030431220123252464619/

http://space.itpub.net/17179887/viewspace-697274