Oracle Linux 7: init.dを使用したOracleの自動起動

Oracle Linux 7: init.dを使用したOracleの自動起動

Oracle Linux 7.3システムでinit.dからOracle 12.1.0.2.0を起動しようとしています。

私は次の例に従いました。https://oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux

これはデータベースを起動するスクリプトです。

#!/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=/u01/app/oracle/product/12.1.0.2/db_1
ORA_OWNER=oracle

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        # Remove "&" if you don't want startup as a background process.
        su $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" &
        su $ORA_OWNER -c $ORA_HOME/bin/dbstart &
        touch /var/lock/subsys/dbora
        ;;
    '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/dbshut
        su $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        rm -f /var/lock/subsys/dbora
        ;;
esac

最初は何も起こらなかった。/etc/rc0.dにソフトリンクを作成しました/etc/rc3.d

ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
chkconfig --level 2345 dbora on

chkconfigdbora.shとともに一覧表示runlevel 2345

次のように短いスクリプトを使用して手動で起動すると、うまく動作します。

#!/bin/sh
$ORACLE_HOME/bin/lsnrctl start
$ORACLE_HOME/bin/dbstart

私は何を見逃していますか?

ベストアンサー1

wurtelのおかげで解決策を見つけました。 Oracle DBをマシン上で実行するには、systemdを使用する必要があります。これに関するガイドは次のとおりです。 https://oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux#oracle-11gr2-update

start.shとshutdown.shを作成する方法を学ぶには、Oracle 11gR2 +セクション(最後のセクション)に従ってください。次に、このチュートリアルに従ってユニットファイルを設定します。 https://oracle-base.com/articles/linux/linux-services-systemd#creating-linux-services

奇跡的に動作します:)

おすすめ記事