Help - Search - Members - Calendar
Full Version: Automating Database Startup and Shutdown
Oracle DBA Forums > Oracle > Oracle Forum
robinson
Hi all,

We are having a problem trying to automate our 11g database startup on a Linux Platform (Redhat). This is the procedure we followed.

1. Logged in as the root user.

2. Edited the oratab file for the platform.

vi /etc/oratab
db:/u01/app/oracle/product/11.2.0/dbhome_1:Y


3. Create a file called dbora in /etc/init.d directory

4. Entered the following in dbora:

#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
if [ "$PLATFORM" = "HP-UX" ] ; then
remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
exit
else
rsh $HOST -l $ORACLE $0 $1 ORA_DB
if [ "$PLATFORM" = "Linux" ] ; then
touch /var/lock/subsys/dbora
fi
exit
fi
fi
#
case $1 in
'start')
$ORACLE_HOME/bin/dbstart $ORACLE_HOME &
;;
'stop')
$ORACLE_HOME/bin/dbshut $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit


4. Changed permissions of dbora

chgrp dba dbora
chmod 750 dbora


5. Created symbolic links to the dbora script in the appropriate run-level script
directories:

# 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


Have I covered everything needed? At system restart the listener and database fail to startup as expected.
robinson
Probably worth me noting that we've tried this exact process on multiple 11g databases on different servers but still no luck. We have also created a service desk request with Oracle but I'm guessing it will be a few days before we hear from them.

Thanks
burleson
Hi Robinson,

>> We have also created a service desk request with Oracle but I'm guessing it will be a few days before we hear from them.

This is a shell script, Oracle wil not help you because it's not an Oracle problem . . .

This is clever code, I just don't undeerstand why you don't just let them autostart on the own servers.

Also, why use sh? Most folks use ksh or bash!

Look at the coraenv utility:

http://www.dba-oracle.com/t_oraenv_coraenv.htm

******************************************
>> At system restart the listener and database fail to startup as expected.

You don't know shell scripting

******************************************
>> We are having a problem trying to automate our 11g database startup on a Linux Platform

So, what is the problem? Did you get an error message?

Here is how I do automatic starting in Oracle Linux:

http://www.dba-oracle.com/t_automatic_rest...racle_linux.htm

***********************************
>> remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"

Rsh and remsh is a security danger . . . .

************************************
>> $ORACLE_HOME/bin/dbstart $ORACLE_HOME &

This should be nohupped . . . .

If you did not write this yourself, get the book Oracle Shell Sceriting and redo it so that you intimately understand it:

http://www.rampant-books.com/book_0701_shell_scripting.htm

If you don't want to write your own, you can download pre-wrttted and pre-tested scripts here:

http://www.dba-oracle.com/oracle_scripts.htm
robinson
Hi Don,

Thanks for your input, I'll try my best to respond to everything!

-Neither myself nor my supervisor have an in-depth knowledge of shell scripting, so my apologies if the scripts seemed flawed. I suppose this is one area that I must develop a little further.

- We used the book "Administratorís Reference 11g Release 2 (11.2) for Linux and UNIX-Based Operating Systems" from the Oracle Documentation library for this process. The section was "Automating Database Startup and Shutdown on Other Operating Systems"

It seemed to be a standard and straightforward procedure at the time! I was unaware that Oracle are reluctant to help with such requests- however I was lucky enough to receive a reply and they pointed me to the note [ID 281912.1]

-The issue was purely that on restart both the listener and databases remained down. There were no errors; we just weren't reaching the desired result. However, the script that Oracle provided is working fine for us now.

-Thank you for your links, and especially your own personal method of achieving automatic startup. I was surprised to learn that it is possible to startup multiple databases with different versions! I'll try this out today on our test databases.


Thanks again,
Sean
burleson
Hi Sean,


>> The issue was purely that on restart both the listener and databases remained down.

Yes, but that should throw an error in your alert log if indeed Oracle signalled a startup and it failed. . . .

Find out of dbstart got far enough to issue a startup command . . .

If you can find your alert log, see if there were any messages at auto-start time.

If you want to de-bug your script, salt it with "echo" commands . . .

You can also use the "debug mode" on the script:

http://www.dba-oracle.com/Shell-Script-sec.pdf

Work backwards, and see if this command works on your test server by itself:

$ORACLE_HOME/bin/dbstart $ORACLE_HOME &


Try without the ambersand:

CODE
${ORACLE_HOME}/bin/dbstart ${ORACLE_HOME}


****************************************
As for the listener, I don't see any "lsnrctl start" command in your script!

Check dbora . . . .

Also:

CODE
ORACLE_HOME_LISTENER=$ORACLE_HOME
export ORACLE_HOME_LISTENER


In any case, please post the solution to benefit future readers!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.