开发者

Starting oc4j and oracle using rc start script

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.

开发者_如何学PythonI 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?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜