使用 rc 启动脚本启动 oc4j 和 oracle

发布于 2024-08-20 20:24:42 字数 231 浏览 3 评论 0原文

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

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅浅淡淡 2024-08-27 20:24:42

将它们放入 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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文