tags:

views:

288

answers:

1

I am having a problem with a couple of my linux boot scripts, specifically the ones that start up my Oracle 10g database and my oc4j container.

I have used chkconfig to tell Linux to start the database before the container, however, it seems that the container starts before the database which oc4j does not like at all. I can get to my application(s), however, I have no DB connections. If I restart oc4j everything works just fine.

Is there a way that I can "pause" the start-up of oc4j until the database (and listener) are both started and ready for connections?

+1  A: 

Put them in 1 start script?

start listener
start database
start appserver

This is my /etc/init.d/dbora script. Add the call to start OC4J

#!/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 ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
echo $1
if [ ! -f $ORA_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 - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
        su - $ORA_OWNER -c $ORA_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 - $ORA_OWNER -c $ORA_HOME/bin/emctl stop dbconsole
        su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        ;;
esac
Robert Merkwürdigeliebe
I've done that, unfortunately the database doesn't finish initializing until the app server is already started.
El Guapo
If you run these sequencially the control of the 'start database' script is returned when the database is started and fully operational. Make sure you start the listener first so the database registers itself with the listener.
Robert Merkwürdigeliebe
Thanks!!!! This worked perfectly... it's not too different from what I had, but I'm just glad it's working.
El Guapo
www.oracle-base.com is a very nice resource for questions like this. Search on "start script" et voila. http://www.oracle-base.com/articles/linux/AutomatingDatabaseStartupAndShutdownOnLinux.php
Robert Merkwürdigeliebe