#!/bin/bash # # chkconfig: 12345 99 10 # description: Oracle auto start-stop script # -------------------------------------------------------------------------- # File: oracle # # Purpose: Oracle auto start-stop script # # Location: /etc/init.d # # Certified: Oracle 10.2.0.3 on Enterprise Linux 5 # -------------------------------------------------------------------------- # Variables ORACLE_OWNER=oracle; export ORACLE_OWNER ORACLE_BASE=/export/home/oracle; export ORACLE_BASE ORACLE_SCRIPTS_DIR=$ORACLE_BASE/admin; export ORACLE_SCRIPTS_DIR ORACLE_HOME=$ORACLE_BASE/product/10.2.0; export ORACLE_HOME # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network RETVAL=0 prog="oracle" start() { echo -n $"Starting $prog: " if [ ! -f $ORACLE_SCRIPTS_DIR/dbstart ] then echo "Oracle not started (no dbstart script)" else # Start RDBMS su - $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbstart # Start Enterprise Manager Console # su - $ORACLE_OWNER $ORACLE_HOME/bin/emctl start dbconsole # Start iSQL*Plus # su - $ORACLE_OWNER $ORACLE_HOME/bin/isqlplusctl start fi RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/oracle return $RETVAL } stop() { echo -n $"Shutting down $prog: " if [ ! -f $ORACLE_SCRIPTS_DIR/dbshut ] then echo "Oracle not stopped (no dbshut script)" else # Stop iSQL*Plus # su - $ORACLE_OWNER $ORACLE_HOME/bin/isqlplusctl stop # Stop Enterprise Manager Console # su - $ORACLE_OWNER $ORACLE_HOME/bin/emctl stop dbconsole # Stop RDBMS su - $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbshut fi RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/oracle return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; *) echo $"Usage: $0 {start|stop}" exit 1 esac exit $RETVAL