Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Oracle boot script needed .
Save the following script as /etc/init.d/oradb
chown root:sys /etc/init.d/oradb
ln /etc/init.d/oradb /etc/rc2.d/K90oradb
ln /etc/init.d/oradb /etc/rc3.d/S90oradb
The oracle users .profile is also attached to show how oradb locates dbstart/dbshut/lsnrctl without script hardcoding. When multiple versions of Oracle are installed, PATH for the non-terminal process is set to the latest Oracle version. Then dbshut/dbstart sets the correct ORACLE_HOME for each database, and lsnrctl is the latest Oracle version.
case $1 in
'start')
echo "++ STARTUP: `date`" >> ${LOGFILE}
su - oracle -c "lsnrctl start LSNR01" 1>> ${LOGFILE} 2>&1 &
su - oracle -c "lsnrctl start LSNR02" 1>> ${LOGFILE} 2>&1 &
sleep 5
su - oracle -c "dbstart" 1>> ${LOGFILE} 2>&1 &
;;
'stop'|'shut')
echo "++ SHUTDOWN: `date`" > ${LOGFILE}
su - oracle -c "dbshut" 1>> ${LOGFILE} 2>&1 &
sleep 20
su - oracle -c "lsnrctl stop LSNR01" 1>> ${LOGFILE} 2>&1 &
su - oracle -c "lsnrctl stop LSNR02" 1>> ${LOGFILE} 2>&1 &
;;
esac
then
# if executing from terminal process
stty istrip stty erase "^h" kill "^u" intr "^c" . ${HOME}/bin/sid # set Oracle env THISHOST=`uname -n` ; export THISHOST PS1='${THISHOST}-${LOGNAME}:${ORACLE_SID}:${PWD}> ' SQLPATH=${HOME}/sql ; export SQLPATH EDITOR=vi ; export EDITOR
ORACLE_HOME=/opt/app/oracle/product/8.1.7 ; export ORACLE_HOME PATH=${PATH}:${ORACLE_HOME}/bin ; export PATHfi
> Andrey Bronfin wrote: > > Dear List ! > > I'm using Oracle 8.1.6 on sun Solaris 2.8 . > > I need to arrange that each time the machine reboots , Oracle DB and > the listener will boot themselves as soon as the machine is up . > Do U have such scripts ? > Where should i place those scripts ? > > Thanks a lot in advance !Received on Tue Nov 21 2000 - 07:50:41 CST