!/bin/sh
chkconfig: 35 80 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=/home/oracle/app/oracle/product/19.3.0/dbhome_1
ORA_OWNER=oracle
if [ -f ORA_OWNER -c "1" in
'start')
Start the Oracle databases:
echo "Starting Oracle Databases ... "
echo "-------------------------------------------------" /var/log/oracle
date +" %T %a %D : Starting Oracle Databases as part of system up." /var/log/oracle
echo "-------------------------------------------------" /var/log/oracle
su - ORA_HOME/bin/dbstart" /var/log/oracle
echo "Done"
Start the Listener:
echo "Starting Oracle Listeners ... "
echo "-------------------------------------------------" /var/log/oracle
date +" %T %a %D : Starting Oracle Listeners as part of system up." /var/log/oracle
echo "-------------------------------------------------" /var/log/oracle
su - ORA_HOME/bin/lsnrctl start" /var/log/oracle
echo "Done."
echo "-------------------------------------------------" /var/log/oracle
date +" %T %a %D : Finished." /var/log/oracle
echo "-------------------------------------------------" /var/log/oracle
touch /var/lock/subsys/oracle
;;
'stop')
Stop the Oracle Listener:
echo "Stoping Oracle Listeners ... "
echo "-------------------------------------------------" /var/log/oracle
date +" %T %a %D : Stoping Oracle Listener as part of system down." /var/log/oracle
echo "-------------------------------------------------" /var/log/oracle
su - ORA_HOME/bin/lsnrctl stop" /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
Stop the Oracle Database:
echo "Stoping Oracle Databases ... "
echo "-------------------------------------------------" /var/log/oracle
date +" %T %a %D : Stoping Oracle Databases as part of system down." /var/log/oracle
echo "-------------------------------------------------" /var/log/oracle
su - ORA_HOME/bin/dbshut" /var/log/oracle
echo "Done."
echo ""
echo "-------------------------------------------------" /var/log/oracle
date +" %T %a %D : Finished." /var/log/oracle
echo "-------------------------------------------------" /var/log/oracle
;;
'restart')
0 start
;;
esac