Ads

AUTO START DATABASE ON BOOTING

AUTO START DATABASE ON BOOTING
 STEP:-1 First make the entry in oratab as “Y” ,to which we want to start our
 database autostart .
 -MAKE ENTRY IN: vi /etc/oratab

 - EXAMPLE: orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y
 (sid): (path) :(Y/N)
STEP:-2 Create the startup and shutdown service in cd /etc/init.d
 we have to wirte the script of startup and shutdown in init.d with dbora
 file name.
– Vi /etc/init.d/dbora
– script as follow
 #! /bin/sh
#
#chkconfig: 2345 20 80
#description: start and stop Oracle Enterprise Edition on Oracle
Linux 5 and 6
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dhome_1
ORACLE_OWNER=oracle
case "$1" in
'start')
su - oracle -c /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
 ;;
'stop')
 su - oracle -c /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbshut
 ;;
esac
 -Explanation of Script
 #! /bin/sh
 #chkconfig: 2345 20 80
 #description: start and stop Oracle Enterprise Edition on Oracle Linux 5 and 6
 This are the mandatory to mention this three line because Skeleton reads this
line in the script ,no matter it is in # tag but it will read it.
 #chkconfig: 2345 20 80

 -2345:- this are the runlevel ,wg=here you want to start the service of dbora

 -20 :- is a startup priority

 -80:- is a shutdown priority
startup script:-

'start')
su - oracle -c /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
 ;;
-first it will switch the user because we are creating the scrip with root user
 and other user cannot set the script.

 -Then it will travel to the whole part and search for dbstart which generated
 during S/W creation ,they are binaries.
Shutdown Script:-
 'stop')

 su - oracle -c /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbshut
 ;;
 -first it will switch the user because we are creating the scrip with root user
 and other user cannot set the script.

 -Then it will travel to the whole part and search for dbshut which generated
 during S/W creation ,they are binaries.

STEP:-3 After creating the script change the rights and group of dbora service

 -chmod 750 dbora
-chgrp dba dbora
STEP:-4 create the softlink of dbora to the the specific runlevels
 # 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
 -K01dbora:-it is kill process which we give in rc0.d
 -S99dbora :-it is start process which we create in rc3.d and
rc5.d
STEP:-5 ADD the dbora service
 -chkconfig –-add dbora
STEP:-6 TO check the service is got added or not then use
 -chkconfig --list | grep dbora
 O/P:- dbora 0:off 1:off 2:on 3:on 4:on 5:on 6:off
STEP:-7 Restart the system and check the status whether the database
 is started or not
 AT os level check using command
 ps -ef | grep pmon
 o/p:- orcl_pmon
 HERE YOUR DATABASE IS STARTED IN AUTO MODE