Oracle Linux 7: Автозапуск Oracle с помощью init.d

Я пытаюсь запустить Oracle 12.1.0.2.0 с системой через init. d на моем компьютере с Oracle Linux 7.3.

Я последовал этому примеру: 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

chkconfig перечисляет dbora.sh с уровень запуска 2345 на

запуск вручную с коротким скриптом отлично работает, например:

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

Что мне не хватает?

0
06.02.2017, 14:28
1 ответ

Благодаря wurtel я нашел решение. Чтобы запустить Oracle DB на машине, мне пришлось использовать systemd. Вот руководство к этому: https://oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux#oracle-11gr2-update

Следуйте разделу Oracle 11gR2 + (последнему) о том, как создать startup.sh и shutdown.sh. Затем следуйте этому руководству, чтобы настроить файл модуля: https://oracle-base.com/articles/linux/linux-services-systemd#creating-linux-services

Работает как charm :)

0
28.01.2020, 04:48

Теги

Похожие вопросы