Configuring oracle database auto start: Easy step-by-step Guide

oracle database auto start

This post will cover everything you need to know about Configuring Oracle database auto start. Let’s get started!

If you do not configure Oracle Restart, the Oracle database won’t start automatically upon rebooting the machine. Follow the below steps to create and deploy a script that ensures the database starts up automatically after a reboot:

1.Login to your database server or VirtualBox as root user and edit the last field of the oratab file as below(Change N to Y):

oradb:/u01/app/oracle/product/19.3.0/dbhome_1:Y

2. Create a file called /etc/init.d/dbora and add the following:

vi /etc/init.d/dbora

#! /bin/sh
# Oracle database auto startup script.
HOME=/u01/app/oracle/product/19.3.0/dbhome_1
OWNER=oracle
case "$1" in
'start')
# To start the Oracle databases
su - $OWNER -c "$HOME/bin/dbstart $HOME" &
touch /var/lock/subsys/dbora
;;
'stop')
# To stop the Oracle databases
su - $OWNER -c "$HOME/bin/dbshut $HOME" &
rm -f /var/lock/subsys/dbora
;;
esac

:wq!

3. Change the group and permission of the created dbora file:

chgrp oinstall /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

5. Restart the machine as root user and verify if oracle database auto restart is enabled or not:

reboot

[root@srv1 ~]# sudo su - oracle
Last login: Tue Jun 18 20:19:55 +04 2024

[oracle@srv1 ~]$ ps -ef|grep pmon
oracle 2378 1 0 20:20 ? 00:00:00 ora_pmon_oradb
oracle 2937 2855 0 20:20 pts/0 00:00:00 grep --color=auto pmon

[oracle@srv1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 18 20:20:58 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Configuring oracle database auto start: Easy step-by-step Guide

I hope you found this article helpful. Feel free to reach out if you have any questions. Explore related topics like auto-restart of CRS in RAC on our site to deepen your understanding.

Leave a Reply