Search This Blog

Monday, December 12, 2016

Oracle Database Auto Database Startup and Shutdown on Linux Platform

First login using Root user ;  then use the below command :

# vi /etc/oratab

You will find following line ( you may fund different line as per your install location of DB).

NANODB:/u01/app/oracle/product/11.2.0/dbhome_1:N

Now, you have to change it to

NANODB:/u01/app/oracle/product/11.2.0/dbhome_1:Y


Now, Create a file called '/etc/init.d/dbora' as the Root user, containing the following code.

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

mount -t tmpfs shmfs -o size=28g /dev/shm

ORA_HOME=/DATABASE/u01/app/oracle/product/11.2.0/dbhome_1

ORACLE_HOME=/DATABASE/u01/app/oracle/product/11.2.0/dbhome_1

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/emctl start dbconsole"

su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"

su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;

'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/emctl stop dbconsole"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;

esac
export ORACLE_HOME=/DATABASE/u01/app/oracle/product/11.2.0/dbhome_1
/etc/init.d/httpd stop
/etc/init.d/httpd start
route add default gw 225.57.178.188 em1
exit $?

  
Use the chmod command to set the privileges to 750 as well as service list

chmod 750 /etc/init.d/dbora
#chkconfig --add dbora


No comments:

Post a Comment