К основному контенту

Автозапуск Oracle в Linux

1. После создания экземпляра правим /etc/oratab, а именно устанавливаем флажок рестарта в 'Y'.
vim /etc/oratab
AXDB:/app/oracle/product/12.1.0/dbhome_1:Y

2. Теперь из под root'a создаем файл /etc/init.d/dbora вот с таким содержимым.
#!/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/12.1.0/dbhome_1
ORA_OWNER=oracle
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
        # 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
3. chmod 750 /etc/init.d/dbora
4. chkconfig  --add dbora

Но это для init систем. А что там с systemd?

Комментарии