Oracle 11gR2 单实例数据库开机自启
1.修改 /etc/oratab 最下面的 N 改为 Y
2.修改 $ORACLE_HOME/bin/dbstart 和 $ORACLE_HOME/bin/dbshut
ORACLE_HOME_LISNER=$ORACLE_HOME的绝对路径
3.加为linux服务:
vi /etc/init.d/oracle
#!/bin/sh
# chkconfig: 35 90 90
# description: Oracle 11gR2
# /etc/init.d/oracle
#
# Run-level Stratup script for the Oracle Instance, Listener, and Web Interface
export ORACLE_SID=doudou
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export TMP=/tmp
export TMPDIR=/u01/tmp
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:
umask 022
ORA_OWNR="oracle"
case "$1" in
start)
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
echo "Oracle Start Successful!"
;;
stop)
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Successful!"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|reload|restart}"
exit 1
esac
exit 0
4.添加开机启动服务
chmod 755 /etc/init.d/oracle
chkconfig --add oracle
chkconfig oracle on
chkconfig --list oracle