0

我的几个 linux 启动脚本有问题,特别是那些启动我的 Oracle 10g 数据库和我的 oc4j 容器的脚本。

我已经使用 chkconfig 告诉 Linux 在容器之前启动数据库,但是,似乎容器在 oc4j 根本不喜欢的数据库之前启动。我可以访问我的应用程序,但是我没有数据库连接。如果我重新启动 oc4j 一切正常。

有没有一种方法可以“暂停” oc4j 的启动,直到数据库(和侦听器)都启动并准备好连接?

4

1 回答 1

1

将它们放入 1 个启动脚本中?

start listener
start database
start appserver

这是我的 /etc/init.d/dbora 脚本。添加调用以启动 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
于 2010-02-09T07:56:49.407 回答