- Add entry in /etc/oratab if not already there
nghlab:/u01/app/oracle/product/11.2.0/db_1:Y
- log in as root user –
go to /etc/init.d
- Create a file called dbora as follows ñ (Note This works for the default LISTENER )
!/bin/sh
chkconfig: 345 99 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=/u01/app/oracle/product/11.2.0/db_1
ORA_OWNER=oracle
LISTENER_NAME=LISTENER
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo ìOracle startup: cannot startî
exit
fi
case ì$1? in
ëstartí)
Start the Oracle databases:
The following command assumes that the oracle login
will not prompt the user for any values
su ñ $ORA_OWNER -c ì$ORA_HOME/bin/lsnrctl startî
su ñ $ORA_OWNER -c $ORA_HOME/bin/dbstart
touch /var/lock/subsys/dbora
;;
ëstopí)
Stop the Oracle databases:
The following command assumes that the oracle login
will not prompt the user for any values
su ñ $ORA_OWNER -c $ORA_HOME/bin/dbshut
su ñ $ORA_OWNER -c ì$ORA_HOME/bin/lsnrctl stopî
rm -f /var/lock/subsys/dbora
;;
esac
- Change the Group and mode of dbora file –
[[email protected] init.d]# chgrp dba dbora
[[email protected] init.d]# chmod 750 dbora
- Create Soft Link ( Appropriate Run level Script)
[[email protected] init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
[[email protected] init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
[[email protected] init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora - TEST IT OUT –
REBOOT YOUR SERVER –
reboot –
OR Try –
/etc/init.d/dbora start
/etc/init.d/dbora stop