Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Automatic listener/database startup?
bluechase_at_my-deja.com wrote:
> I am running Oracle8i on solaris. How can I automate the startup of
> the listener and my database when the unix box is rebooted?
>
> The /var/opt/oracle/oratab file has been updated with the automatic
> database startup option, and the dbstart/dbshut files have been linked
> to the in init files for the server.
>
> 1. How do I setup the listener to starup automatically?
> 2. Any tips on how to get the dbstart script to work?
>
> Thanks,
> B
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Put the following script in a file named oracle_init.sh and put the file in ${ORACLE_HOME}/bin.
Then, make two links:
ln ${ORACLE_HOME}/bin/oracle_init.sh /etc/rc2.d/S98oracle ln ${ORACLE_HOME}/bin/oracle_init.sh /etc/rc0.d/K05oracle
Note that the "98" and "05" will have to be adapted to your own particular server. You probably have a known sequence in which you want things to start/stop and the numbers should reflect that. Also, this assumes that ${ORACLE_HOME} is in the same file system as root. If not, change the "ln" to "ln -s".
Also, modify the dbshut script provided by oracle so that the appropriate occurrance of "SHUTDOWN" is changed to "SHUTDOWN IMMEDIATE".
############################################################## Program: oracle_init.sh
#############################################################ORACLE_HOME=/oracle/app/oracle/product/8.1.6;export ORACLE_HOME ORACLE_SID=ORCL;export ORACLE_SID
Pid=`/usr/bin/ps -ef | /usr/bin/grep "ora_dbwr" | \
/usr/bin/grep -v grep | /usr/bin/awk '{print $2}'`
case $1 in
'start')
if [ "${Pid}" = "" ];then
su - oracle -c "${ORACLE_HOME}/bin/lsnrctl start"
>/tmp/sqlntstart.log 2>&1 &
sleep 5 su - oracle -c "${ORACLE_HOME}/bin/dbstart" >/tmp/dbstart.log 2>&1&
else
echo "Oracle already started";
fi;;
'stop')
if [ "${Pid}" != "" ];then
su - oracle -c "${ORACLE_HOME}/bin/dbshut" >/tmp/dbshut.log 2>&1 &
sleep 5 su - oracle -c "${ORACLE_HOME}/bin/lsnrctl stop"
else
echo "Oracle not running";
fi;;
*)
echo "usage: $0 {start|stop}";;
esac
Received on Mon Oct 16 2000 - 08:49:09 CDT