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

Re : startup and shutdown script for oracle

SOLVED
Go to solution
Vincent_5
Super Advisor

Re : startup and shutdown script for oracle

Hi,
Can someone teach me how to write a startup and shutdown script for oracle. And where can I place the startup and shutdown script so that it can do a auto startup and shutdown.


Regards
Vincent
nothing is better than to know more
8 REPLIES
Pete Randall
Outstanding Contributor

Re: Re : startup and shutdown script for oracle

Vincent,

Try this post (found by searching on "startup script" +Oracle)
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xeaf869b1e860d511abcd0090277a778c,00.html

I think that should help you.

Pete

Pete
Sanjay_6
Honored Contributor

Re: Re : startup and shutdown script for oracle

Hi Vincent,

Maybe this link can help,

http://docs.hp.com/hpux/onlinedocs/os/startup.pdf

Hope this helps.

Regds
Jeanine Kone
Trusted Contributor

Re: Re : startup and shutdown script for oracle

Did you get your answer from those links?
Andreas D. Skjervold
Honored Contributor
Solution

Re: Re : startup and shutdown script for oracle

Hi

You have to use the supplied dbstart and dbshut scripts
located in $ORACLE_HOME/bin.

Reference these scripts from a rc script placed under /sbin/init.d/

rc-script dbora:

#!/sbin/sh
# Start/stop of Oracle database
#
ORA_HOME=/oracle/product/8.0.6
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
start_msg)
echo "Start ORACLE server"
;;

stop_msg)
echo "Stop ORACLE server"
;;
'start')
# Start the oracle databases
/usr/bin/su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;
'stop')
# Stop the oracle databases
/usr/bin/su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
esac


Then make a link to this script and place in /sbin/rc2.d and rc0.d :
ln -s /sbin/init.d/dbora /sbin/rc2.d/S990dbora
ln -s /sbin/init.d/dbora /sbin/rc0.d/K10dbora

Then ensure that your oratab file is inplace in /etc/oratab, and enter a Y in the last column of those databases supposed to start.
BICO_XXU:/oracle/product/8.1.7:Y


Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Jerry Jaynes
Frequent Advisor

Re: Re : startup and shutdown script for oracle

Vincent,

This comes from our system. We do it every night, so we can do extraa backups as required. It works very well.

I also included the dump command that will create an oracle dump file... just in case.

Good luck!

Jerry Jaynes


/dbase/oracle/data_srv/intralink/bin/dserv_shutdown # To shutdown Oracle Data Server

/dbase/oracle/data_srv/intralink/bin/dserv_startup # To startup Oracle Data Server

/dbase/oracle/data_srv/intralink/export/cron_dump # Database Dump file creation utility.
Never let 'em see you choke!!
Jerry Jaynes
Frequent Advisor

Re: Re : startup and shutdown script for oracle

Vincent,

These are the actual scripts, The note above was for the correct locations. Check your permissions and see that they are as follows:

-rwxr-xr-x 1 oracle dba


/dbase/oracle/data_srv/intralink/bin/dserv_shutdown

#!/bin/csh -f

# /usr/ucb is not on the path while processing rc files (whoami is
# in /usr/ucb on sun4_solaris.
setenv ORACLE_HOME /dbase/oracle/data_srv/oracle
set path=( $path /usr/ucb )

if ( `whoami` == "root" ) then
su - oracle -c "$ORACLE_HOME/bin/dbshut_ilink >& $ORACLE_HOME/rdbms/log/dbstop.log"
else
$ORACLE_HOME/bin/dbshut_ilink >& $ORACLE_HOME/rdbms/log/dbstop.log
endif

/dbase/oracle/data_srv/intralink/bin/dserv_startup
#!/bin/csh -f

# /usr/ucb is not on the path while processing rc files (whoami is
# in /usr/ucb on sun4_solaris.
setenv ORACLE_HOME /dbase/oracle/data_srv/oracle
set path=( $path /usr/ucb )

if ( `whoami` == "root" ) then
su - oracle -c "$ORACLE_HOME/bin/dbshut_ilink >& $ORACLE_HOME/rdbms/log/dbstop.log"
else
$ORACLE_HOME/bin/dbshut_ilink >& $ORACLE_HOME/rdbms/log/dbstop.log
endif
everest 23: cat /dbase/oracle/data_srv/intralink/bin/dserv_startup
#!/bin/csh -f

# THIS SCRIPT SHOULD ONLY BE RUN BY SYSTEM STARTUP

# /usr/ucb is not on the path while processing rc files (whoami is
# in /usr/ucb on sun4_solaris.
setenv ORACLE_HOME /dbase/oracle/data_srv/oracle
set path=( $path /usr/ucb )

if ( `whoami` == "root" ) then
su - oracle -c "$ORACLE_HOME/bin/dbstart_ilink >& $ORACLE_HOME/rdbms/log/dbstart.log"
else
$ORACLE_HOME/bin/dbstart_ilink >& $ORACLE_HOME/rdbms/log/dbstart.log
endif

/dbase/oracle/data_srv/intralink/export/cron_dump

#!/usr/bin/csh
set host = `hostname`
rm -f /storage/oracle_dumpfiles/$host.ilink.dmp.zip
/dbase/oracle/data_srv/intralink/export/ilink_export manager $host.ilink.dmp
/usr/bin/zip /storage/oracle_dumpfiles/$host.ilink.dmp.zip $host.ilink.dmp*
rm -f /dbase/oracle/data_srv/intralink/export/$host.ilink.dmp
rm -f /dbase/oracle/data_srv/intralink/export/$host.ilink.dmp.lst




Never let 'em see you choke!!
Rory R Hammond
Trusted Contributor

Re: Re : startup and shutdown script for oracle

Vincent,

Andreas

Has the correct information. you put the script in the /sbin/init.d directory. Then link it with the correct rc directory.
Mine is /sbin/rc2.d.

You probably want to do the same for the listener. I have also edited oracles dbshut script, adding immediate after the shutdown command.

I am attaching /sbin/init.d/listener
There are a 100 ways to do things and 97 of them are right
Vincent_5
Super Advisor

Re: Re : startup and shutdown script for oracle

Hi,
Thanks for all the info, I will try out, appologised for the late reply !!


Regards
Vincent
nothing is better than to know more