Auto startup and shutdown oracle database services on linux
Auto startup and shutdown oracle database services on linux
Applies
to:
Enterprise Linux – Version: 5
Description:
I have oracle database 11gR2 on
enterprise Linux 5.7. I want that all database services and listener should be
stopped automatically when Linux going to shutdown. And after startup Linux all
database services and listener start automatically.
Solution:
To auto startup and
shutdown all database services:
- Following parameter in /etc/oratab file should be Y:
orcl:/d01/app/oracle/product/11.2.0/dbhome_1:Y
- Set the following parameter in $ORACLE_HOME/bin/dbstart :
ORACLE_HOME=/d01/app/oracle/product/11.2.0/dbhome_1;
export ORACLE_HOME
ORACLE_HOME_LISTNER=$ORACLE_HOME
- Set the following parameter in $ORACLE_HOME/bin/dbshut :
ORACLE_HOME=/d01/app/oracle/product/11.2.0/dbhome_1;
export ORACLE_HOME
ORACLE_HOME_LISTNER=$ORACLE_HOME
- Create a file “dbora” in /etc/init.d/ using root user
Contents of dbora
file is:
#!/bin/sh
# description:
Oracle database auto start-stop script.
#
ORA_HOME=/d01/app/oracle/product/11.2.0/dbhome_1
ORACLE_HOME_LISTNER=$ORA_HOME
ORA_OWNER=oracle
if [ ! -f
$ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot
start"
exit
fi
case "$1"
in
'start')
# Start the Oracle Database
Instance Using the Script Created by Rana Abdul Wahid:
# The following
command assumes that the oracle login
# will not prompt
the user for any values
su $ORA_OWNER -c
$ORA_HOME/bin/dbstart $ORACLE_HOME &
touch
/var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle Database
Instance Using the Script Created by Rana Abdul Wahid:
# The following
command assumes that the oracle login
# will not prompt
the user for any values
su $ORA_OWNER -c
$ORA_HOME/bin/dbshut $ORACLE_HOME
rm -f
/var/lock/subsys/dbora
;;
esac
- Save the above file
- chmod 750 /etc/init.d/dbora
- chkconfig --add dbora
Now each time all database services shutdown normally when Linux
shutdown. When Linux startup all database services automatically startup
normally.
Your comments, especially which will help us
improve the functionality, will be greatly appreciated. :)
Comments
Post a Comment