Archive

Posts Tagged ‘startup’

Automate database Startup and Shutdown

April 25, 2013 Leave a comment

To automate the database startup and shutdown perform the below steps

1. Add the below entry /etc/oratab file

bharatdb:/u01/app/oracle/product/11.2.0/db_2:Y

2. Prepare the script /etc/init.d/dbora as root user

vi dbora
#!/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_2; export ORA_HOME;
 ORA_OWNER=oracle; export ORA_OWNER;
 #export ORACLE_UNQNAME=DB11G
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
 echo -n "Starting Oracle Databases: " > /var/log/oracle
 echo "-------------------------------------------" >> /var/log/oracle
 date +"! %T %a %D : Starting Oracle Databases as 
                                part of system up." >> /var/log/oracle
 echo "-------------------------------------------" >> /var/log/oracle
 su $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
 echo "Done." >> /var/log/oracle
 echo "" >> /var/log/oracle
 echo "-------------------------------------------" >> /var/log/oracle
 date +"! %T %a %D : Finished." >> /var/log/oracle
 echo "-------------------------------------------" >> /var/log/oracle
 touch /var/lock/subsys/oracle
 ;;
 stop)
 # Stop the Oracle databases:
 # The following command assumes that the oracle login
 # will not prompt the user for any values
 echo -n "Shutting Down Oracle Listeners: " >> /var/log/oracle
 echo "--------------------------------------------" >> /var/log/oracle
 date +"! %T %a %D : Shutting Down Oracle Databases as part 
                                    of system down." >> /var/log/oracle
 echo "--------------------------------------------" >> /var/log/oracle
 su $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
 echo "Done."  >> /var/log/oracle
 echo ""
 echo "--------------------------------------------" >> /var/log/oracle
 date +"! %T %a %D : Finished." >> /var/log/oracle
 echo "--------------------------------------------" >> /var/log/oracle
 rm -f /var/lock/subsys/oracle
 ;;
 esac

3. Grant the necessary privileges

chmod 750 /etc/init.d/dbora

4. Make this script run automatically with the below command

chkconfig --add dbora

Now the databases will startup/shutdown accordingly during server reboot

Peasland Database Blog

Where all the Action Is !!!!

Kevin Closson's Blog: Platforms, Databases and Storage

Platform, Database and Storage Topics

DBsGuru

Where all the Action Is !!!!

sqlmaria.com/

Oracle Database Product Manager with a passion for SQL, the Optimizer and performance.

Richard Foote's Oracle Blog

Focusing Specifically On Oracle Indexes, Database Administration and Some Great Music

https://dbakevlar.com/

Where all the Action Is !!!!

Pythian Technical Track

Where all the Action Is !!!!

Tales From A Lazy Fat DBA

Its all about Databases & their performance, troubleshooting & much more .... ¯\_(ツ)_/¯

Database Heartbeat

Oracle Database and Oracle Cloud Technologies

Databases Are Fun

dohdatabase.com

Upgrade your Database - NOW!

Mike Dietrich's Blog About Oracle Database Upgrades... Mostly

Oracle database internals by Riyaj

Discussions about Oracle performance tuning, RAC, Oracle internal & E-business suite.

Pavan DBA's Blog

The DBA Knowledge Store

ORACLE-BASE - Latest Articles

Where all the Action Is !!!!