Search This Blog

Total Pageviews

Wednesday, 20 April 2011

oracle start up shutdown script on linux / unix

Oracle start up automatic script

Oracle start up shutdown script

Oracle start up automatically at the time of boot

Oracle Database start automatic on Linux

Automating Database Start up and Shutdown on Linux


1. Change in the oratab file from N to Y


oracle@apt-lnxtst-01:/opt/oracle/product/10.2/bin> cat /etc/oratab





# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/opt/oracle/product/10.2:N <<----- change N to Y





apt-lnxtst-01:/etc/init.d # ls -ltr /etc/oratab
-rw-rw-r-- 1 oracle root 710 2011-04-20 08:38 /etc/oratab




2.

as a root

cd /etc/init.d/

apt-lnxtst-01:/etc/init.d # cat dbora ----- create this file as a root

#!/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.


# change the value as per your home -------------<<<<<<<<<<<
ORA_HOME=/opt/oracle/product/10.2

ORA_OWNER=oracle

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/dbstart $ORA_HOME"
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 $ORA_HOME"
rm -f /var/lock/subsys/dbora
;;
esac



apt-lnxtst-01:/etc/init.d # ls -ltr dbora
-rw-r--r-- 1 root root 1045 2011-04-20 08:49 dbora


3 .

Change the prmission of this file

apt-lnxtst-01:/etc/init.d # chmod 750 /etc/init.d/dbora



4.

apt-lnxtst-01:/etc/init.d # chkconfig --add dbora
dbora 0:off 1:off 2:off 3:on 4:off 5:on 6:off

or


Linux

# ln -s /etc/init.d/dbora /etc/rc.d/rc3.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/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

No comments:

Oracle DBA

anuj blog Archive