Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Oracle boot script needed .

Re: Oracle boot script needed .

From: Suzy Vordos <lvordos_at_datsit.com>
Date: Tue, 21 Nov 2000 06:50:41 -0700
Message-Id: <10687.122604@fatcity.com>


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.



#!/sbin/sh
#
# /etc/init.d/oradb - Start/Stop the Oracle Databases & Listeners
#

PATH=/usr/bin:/usr/sbin ; export PATH
LOGFILE=/home/oracle/logs/oraboot.log ; export LOGFILE

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



# .profile
#
# Set env based on terminal or non-terminal
if [ -t 0 ]

   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

   else
   # if executing from non-terminal process, eg., system reboot
      ORACLE_HOME=/opt/app/oracle/product/8.1.7 ; export ORACLE_HOME
      PATH=${PATH}:${ORACLE_HOME}/bin ; export PATH
fi
> 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US