首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用rc启动脚本启动oc4j和oracle

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

Stack Overflow用户
提问于 2010-02-08 23:38:16
回答 1查看 1.7K关注 0票数 0

我的几个linux引导脚本出现了问题,特别是启动Oracle10g数据库和oc4j容器的那些脚本。

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

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-02-09 15:56:49

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

代码语言:javascript
复制
start listener
start database
start appserver

这是我的/etc/init.d/dbora脚本。添加启动OC4J的调用

代码语言:javascript
复制
#!/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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2222681

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档