Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Start Oracle during the boot

Start Oracle during the boot

Hi,
I have Oracle 8.1.7 running on HPUX B.11. I want to start oracle database automatically when the server startup.

The problem that when i read the /sbin/init.d/oracle file its mentionned this :

# WARNING: Changing this script in any way may lead to a system that
# is unbootable. Do not modify this script.

I can't change this script and i can't add these lines:

ORA_HOME=/software/app/oracle/product/8.1.7
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "BASES ORACLE : START IMPOSSIBLE"
exit
fi
case "$1" in
start_msg)
echo "BASES ORACLE : START OK "
;;

stop_msg)
echo "BASES ORACLE : ARRET OK"
;;
'start')
# Demarrage des Bases Oracle et du listner
/usr/bin/su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
/usr/bin/su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
;;
'stop')
# Arret des Bases Oracle et du listner
/usr/bin/su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
/usr/bin/su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
esac

I have no idea to resolve this problem
Please give me same advise

Thank you

4 REPLIES
A. Clay Stephenson
Acclaimed Contributor

Re: Start Oracle during the boot

Don't be too alarmed by those warnings. They are an artifact of the file '/sbin/init.d/template' from which your file was derived.

You must edit the file to do what you want to do.

I can tell you that your /usr/bin/su - ${ORA_OWNER} command are almost certainly a BAD idea. THe problem with su - is that it reads the user's .profile. You think that is a good thing but the .profile probably contains commands like tget, stty, tabs ... - all of which require an interactive environemt. You have two choices: 1) surround all those commands in .profile with
if [ -t 0 -o -t 1 ]
then
stty ...
tabs ...
fi
OR 2) create a small file (e.g. /usr/local/bin/oraenv.sh) and let it set and export all the needed variables. Put no return or exit statements in this file. Then BOTH .profile AND your init.d script source this file using the 'dot' operator.
. /usr/local/bin/oraenv.sh

I know you are worried about changing the file; don't be - but be a little careful and TEST (e.g. /sbin/init.d/oracle start [and stop]) before making the symbolic links to the rcN.d directory entries.
If it ain't broke, I can fix that.
Jeanine Kone
Trusted Contributor

Re: Start Oracle during the boot

my /sbin/init.d/dbora calls dbstart and dbshut. I did modify them a bit to get them to work the way I wanted. I understand why they put a warning there, but I tested my changes first and had no problems.
Wodisch
Honored Contributor

Re: Start Oracle during the boot

Hi Abdel,

in addition: "dbshut" is a very BAD idea to be used for a shutdown script, as it WAITS for all connected clients to volunteerily log off first. Only then it continues...
Use a script with "shutdown immediate" instead of "shutdown normal"!

Just my $0.02,
Wodisch

Re: Start Oracle during the boot

Hi,

Thank you for all your helps.

Regards