Oracle 8i | Oracle 9i | Oracle 10g | Oracle 11g | Oracle 12c | Miscellaneous | PL/SQL | SQL | Oracle RAC | Oracle Apps | Linux

Oracle AS10g Automatic Startup/Shutdown

This article describes a method to make Oracle AS10g start and stop automatically during server startup and shutdown on Linux.

As the oracle user create a "dba" directory.

su - oracle
mkdir $ORACLE_BASE/dba

Next create a file called "startup" in the dba directory with the following contents.

#!/bin/ksh

dcmctl shutdown
opmnctl stopall
opmnctl start
# -----------------------------------
# Adjust to start desired components.
dcmctl start -ct ohs
dcmctl start -co container1
dcmctl start -co container2
# -----------------------------------
emctl stop iasconsole
emctl start iasconsole

The list of components to start should be altered to match your requirements.

Then create a file called "shutdown" in the dba directory with the following contents.

#!/bin/ksh

dcmctl shutdown
opmnctl stopall
emctl stop iasconsole

Make sure both files are executable.

chmod u+x startup
chmod u+x shutdown

As the root user create a file called "/etc/init.d/oracle" with the following contents.

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
ORA_BASE=/u01/app/oracle
ORA_HOME=/u01/app/oracle/product/904_j2ee
ORA_OWNER=oracle
case "$1" in
     'start')
          # Start the Oracle databases:
     su - $ORA_OWNER -c $ORA_BASE/dba/startup &
     ;;
     'stop')
          # Stop the Oracle databases:
          # The following command assumes that the oracle login 
          # will not prompt the user for any values
     su - $ORA_OWNER -c $ORA_BASE/dba/shutdown &
     ;;
esac

Use chmod to set the privileges to 750.

chmod 750 /etc/init.d/oracle

Associate the oracle service with the appropriate run levels and set it to auto-start.

chkconfig --level 345 dbora on

The relevant instances should now startup/shutdown automatically at system startup/shutdown.

Hope this helps. Regards Tim...

Back to the Top.