Enabling Autostart during server reboot of Oracle Database 19c filesystem on Oracle / Redhat Linux 7



============= Create a file /etc/init.d/dbora using dbora================


vi /etc/init.d/dbora


#! /bin/sh  -x

#

# This is my old script for auto-starting Oracle DB on Linux.

# When I'm not using Cloud Databases, I now install the Oracle Database 21c RPM which includes its own script

#

# chkconfig: 2345 80 05

# description: start and stop Oracle Databases


#

# OL7: systemctl enable dbora

#

# Note:

#   Change the awk pattern to match a DB of the ORACLE_HOME to be used

#   Change the autostart entry of /etc/oratab to Y for any DB you want started; this is required by dbstart


ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1


# Note: Change the value of ORACLE to the login name of the oracle owner


ORACLE=oracle


PATH=${PATH}:$ORACLE_HOME/bin

export ORACLE_HOME PATH


case $1 in

'start')

        echo -n $"Starting Oracle: "

        su $ORACLE -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" &

        ;;

'stop')

        echo -n $"Shutting down Oracle: "

        su $ORACLE -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" &

        ;;

'restart')

        echo -n $"Shutting down Oracle: "

        su $ORACLE -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" &

        sleep 5

        echo -n $"Starting Oracle: "

        su $ORACLE -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" &

        ;;

*)

        echo "usage: $0 {start|stop|restart}"

        exit

        ;;

esac


exit



=========Give permissions to the script==========


# chmod 750 /etc/init.d/dbora



========On Oracle Linux 7 run:==========


# systemctl enable dbora


========Edit /etc/oratab ===================

In /etc/oratab, change the autostart field from N to Y for any databases that you want autostarted.


Starting / Stopping the DB

The DB will start and stop at machine boot and shutdown.


Or it can be manually controlled with:


# systemctl start dbora


and


# systemctl stop dbora


On Oracle Linux 7, use 'systemctl start dbora' and 'systemctl stop dbora'


Starting Oracle Database Multitenant PDBs

To also start all pluggable databases when the container database starts, run this in SQL*Plus as SYSDBA:


alter pluggable database all open;

alter pluggable database all save state;

Comments

Popular posts from this blog

Management of Users and privilleges in Oracle Database 12c / 19c in container & Pluggable database

Oracle Temporary Tablespace Resize