#!/bin/sh # chkconfig: 345 99 10 # description: Oracle auto start-stop script. # # Set ORA_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORACLE_OWNER to the user id of the owner of the # Oracle database in ORA_HOME. ORACLE_BASE=/opt/app/oracle ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1 ORACLE_OWNER=oracle export ORACLE_BASE ORACLE_HOME if [ ! -f $ORACLE_HOME/bin/dbstart ] then echo "Oracle startup: cannot start" exit fi case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole" ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole" su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" ;; *) echo "usage: $0 {start|stop}" ;; esac