#!/bin/bash #chkconfig:35 98 01 #description:Startup Script for Oracle Databases #/etc/rc.d/init.d/oracle export ORACLE_BASE=/opt/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_LOG=$ORACLE_HOME/log export ORACLE_OWNER=oracle case "$1" in "start") echo -n "Starting Oracle11gR2:" su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" >>$ORACLE_LOG/ora_autostart.log su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" >>$ORACLE_LOG/ora_autostart.log touch /var/lock/subsys/oracle su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole" >>$ORACLE_LOG/ora_autostart.log echo "OK" ;; "stop") echo -n "Shutting Down Oracle11gR2:" su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole" >>$ORACLE_LOG/ora_autoshut.log su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" >>$ORACLE_LOG/ora_autoshut.log su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop" >>$ORACLE_LOG/ora_autoshut.log rm -f /var/lock/subsys/oracle echo "OK" ;; "restart") $0 stop $0 start ;; *) echo "Usage: $0{start|stop|restart}" exit 1 ;; esac exit 0
chkconfig --add oracle
chkconfig --level 35 oracle on