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

Can't get Oracle to autostart

SOLVED
Go to solution
jeff rowland
Occasional Contributor

Can't get Oracle to autostart

Have created file
in /sbin/init.d and /sbin/rc2.d and /sbin/rc0.d per Oracle documentation to start/stop oracle when the HP computer starts up or shutdown.

When the computer comes up Oracle is not started but checking the /etc/rc.log files does not show any errors. (Have attached last lines of rc.log file that shows the /sbin/rc2.d/S99dbora as being executed. (I put a set -x) in script to print out data for troubleshooting.

The dbora file is as follows:

set -x
PATH=$PATH:/oracle/oradb1:/oracle/oradb1/bin:/oracle/oradb1/lib;export PATH

ORACLE_BASE=/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/oradb1;export ORACLE_HOME
ORACLE_SID=oradb1;export ORACLE_SID
CLASS_PATH=$ORACLE_HOME/JRE/lib/rt.jar:$ORACLE_HOME/jlib:$ORACLE_HOME/lib:$ORACL
E_HOME/network/jlib;export CLASS_PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH
SHLIB_PATH=$ORACLE_HOME/lib;export SHLIB_PATH
PATH=$PATH:/usr/ccs/bin:$ORACLE_BASE:/usr/lib/X11:/usr/local/bin:/bin;export PAT
H
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data;export ORA_NLS33
export TNS_ADMIN=$ORACLE_HOME/network/admin

if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "ORACLE startup: cannot start"
exit
fi
case "$1" in
'start')
/usr/bin/su oracle -c "/oracle/oradb1/bin/dbstart &"
;;
'stop')
/usr/bin/su - oracle -c "/oracle/oradb1/bin/dbshut &"
;;
esac
You can Tune a Piano but you can't tuna fish
12 REPLIES
ajax13
Frequent Advisor

Re: Can't get Oracle to autostart

Hi,
This could be the problem,you may be missing the - between su and oracle to load oracle profile.
change:
/usr/bin/su -oracle -c "/oracle/oradb1/bin/dbstart &"
to:
/usr/bin/su oracle -c "/oracle/oradb1/bin/dbstart &"

Thanks
A. Clay Stephenson
Acclaimed Contributor

Re: Can't get Oracle to autostart

Hi Jeff,

I suspect that you have two problems:
1) the missing su "-" as mentioned earlier
2) your oracle .profile has stty commandsd, tabs, etc. You should either if out those command with a if [ -t 0 ] or source a separate environment command
If it ain't broke, I can fix that.
Luis Canepa
Occasional Visitor

Re: Can't get Oracle to autostart

I hope these tips could help you.
Personally, I use the /sbin/init.d/dbora file to startup the listeners, and has the following content:
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
su - oracle -c "lsnrctl start"
An important file is /etc/rc.config.d/oracle, this file tells you if you will be able to start th DB with dbstart, it content is:
ORACLE_START=1
export ORACLE_START

The system administrator can change this to :

ORACLE_START=0

to disable automatic startup and shutdown of databases.
I also recommend you to check the /etc/oratab file, should have the following content:
ORACLE_SID:ORACLE_HOME:{Y | N}
And finally, create a file /sbin/init.d/oracle with your dbora file content.
If you have any additional question, please fell free to email: l_canepa@yahoo.com

linuxfan
Honored Contributor

Re: Can't get Oracle to autostart

Hi Jeff,

what happens when you try running the script manually
/sbin/init.d/dbora start
/sbin/init.d/dbora stop

-Regards
Ramesh
They think they know but don't. At least I know I don't know - Socrates
jeff rowland
Occasional Contributor

Re: Can't get Oracle to autostart

Hi.
I took everyones advice and put a "-" after the su

I am now getting the
stty: not a typewrite error.
Yes the oracle .profile has stty commands etc. How do I use the [-t 0] to get around this. Have never used command like this before.

Thanks to all that have replied previously!
You can Tune a Piano but you can't tuna fish
Andreas D. Skjervold
Honored Contributor

Re: Can't get Oracle to autostart

Hi

Had the same problem, and found after several days of debugging that the startup / shutdown didn't work in the background... I couldn't figure out why,

but when I removed the ampersand (&) in the script:
/usr/bin/su oracle -c /oracle/oradb1/bin/dbstart &

everything worked...

why... beats me?

Andreas

Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Jared Westgate_1
Valued Contributor

Re: Can't get Oracle to autostart

Hello Jeff,

Have you checked your /etc/oratab file? If you look at the code of the $ORACLE_HOME/bin/dbstart script, it will only start those databases that are listed with a "Y" in the /etc/oratab file. Make sure your oratab file looks like this:

::Y

The "Y" specifies that the database should start on OS startup. Put an "N" here if you want to start the database manually.

I hope this helps a little,

Jared
James R. Ferguson
Acclaimed Contributor
Solution

Re: Can't get Oracle to autostart

Hi Jeff:

The test [ -t 0 ] will return true if the process is interactive and false if it is not.

Surround 'stty' calls in your $HOME/.profile with the test. Instead of unconditionally calling 'styy' as in:

# stty erase "^H" kill "^U" intr "^C" eof "^D"

...do:

# if [ -t 0 ]
> then
> stty erase "^H" kill "^U" intr "^C" eof "^D"
> fi

Regards!

...JRF...
Wodisch
Honored Contributor

Re: Can't get Oracle to autostart

Hello Jeff,

that ampersand to start your dbstart/dbshut in
the background is quite dangerous:
all those rc-scripts are supposed to run
sequentially - one after the other - not in
parallel!
The way you start your oracle commands the
"rest" of the rc-scripts will start before
oracle even has done a little bit of house-
keeping :-(

Just measure the time needed for
* dbshut
and for
* the rest of your shutdown scripts

What did you get? Say, 15min for oracle and
1min for the rest? Right? So, you system was
going down before oracle had any chance of
saving its SGA to disk!!! (lots of bangs here)

If you do not like the amount of time taken
by the oracle "dbshut", you could safely go
for this:
- do NOT use "dbshut", instead
- force oracle to do an checkpoint (something
--- like "alter system checkpoint;" or so)
- then do an "shutdown abort", really!
- Both together is quite safe and much faster!

BTW, you should *always* use the minus for "su"
in my opinion...

HTH,
Wodisch
Bill Thorsteinson
Honored Contributor

Re: Can't get Oracle to autostart

dbora should shutdown in this order
- dbsnmp (if you are using it, used by
Enterprise Manager for monitoring)
- listener (need to be shutdown for a
normal or immediate shutdown)
- databases

Startup should be in the reverse order.

Revise dbshut to do a 'shutdown immediate'
instead of a 'shutdown'. This will allow
current transactions to complete.

By the way the previous contributions should
be assigned points.
R. Allan Hicks
Trusted Contributor

Re: Can't get Oracle to autostart

I may have missed something, but the most common problem is to forget to modify /etc/oratab. Have you've made sure that it has a 'Y' on the end or the line for your instance? If it's not set up for auto start, you'll get the problem you described.

-Been there. Done That.
"Only he who attempts the absurd is capable of achieving the impossible
R. Allan Hicks
Trusted Contributor

Re: Can't get Oracle to autostart

Oops sorry, didn't see Jared's reply. Mine is a duplicate. No points expected.
"Only he who attempts the absurd is capable of achieving the impossible