Automating Database Startup and Shutdown ---------------------------------------- 1. Change the last field for the database line to Y vi /etc/oratab orcl:/u01/app/oracle/product/19.3.0.0/dbhome_1:Y 2. Create the file /etc/init.d/dbora and add the following code in it vi /etc/init.d/dbora #! /bin/sh # description: Oracle auto start-stop script. ORA_HOME=/u01/app/oracle/product/19.3.0.0/dbhome_1 ORA_OWNER=oracle case "$1" in 'start') # Start the Oracle databases: # Remove "&" if you don't want startup as a background process. su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" & touch /var/lock/subsys/dbora ;; 'stop') # Stop the Oracle databases: su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" & rm -f /var/lock/subsys/dbora ;; esac 3. Change the group of the dbora file to dba, and set its permissions to 750 chgrp dba /etc/init.d/dbora chmod 750 /etc/init.d/dbora 4. Create symbolic links to the dbora script in the appropriate run-level script directories 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 srv1 and wait for a few minutes to allow the database to automatically start up. ps -ef | grep pmon sqlplus / as sysdba
That’s it.
If you would have any questions or concerns, please leave your comments. I would be glad to explain in more details. Thank you so much for all your feedback and support!