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

Home -> Community -> Usenet -> c.d.o.server -> Re: Solaris/Oracle startup script how-to?

Re: Solaris/Oracle startup script how-to?

From: <oratune_at_aol.com>
Date: Tue, 22 Aug 2000 02:10:42 GMT
Message-ID: <8nsnek$5t$1@nnrp1.deja.com>

In article <Atho5.2294$kM2.297434_at_newshog.newsread.com>,   "Van Messner" <vmessner_at_bestweb.net> wrote:
> Here's some crude scripts that I keep in my bin directory. I'm sure
 you can
> improve them. For example you might want to stop the listener or
 bounce it
> once if you are starting all the databases.
>
> Van
>
> ORALOAD
> $ cat oraload
> echo "Type the SID for the database you want to start up"
> echo "Your choices are DNEG, DEV6 . Or type ALL to start up all the
> instances."
> read dbsid
>

PATH=/usr/bin:/usr/ucb:/etc:/oracle/app/oracle/product/8.1.5/bin:/usr/cc s/bi
> n:.
> export PATH
> echo "Environment variable PATH set and exported"
> case $dbsid
> in
> DNEG) ORACLE_SID=$dbsid
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DNEG and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> startup open pfile='/oracle/app/oracle/admin/DNEG/pfile/initDNEG.ora';
> disconnect
> EOF
> ;;
> DEV6) ORACLE_SID=$dbsid
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DEV6 and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> startup open pfile='/oracle/app/oracle/admin/DEV6/pfile/initDEV6.ora';
> disconnect
> EOF
> ;;
> ALL) ORACLE_SID=DNEG
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DNEG and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> startup open pfile='/oracle/app/oracle/admin/DNEG/pfile/initDNEG.ora';
> disconnect
> EOF
> ORACLE_SID=DEV6
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DEV6 and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> startup open pfile='/oracle/app/oracle/admin/DEV6/pfile/initDEV6.ora';
> disconnect
> EOF
> ;;
> *) echo "You entered no SID or an invalid SID - program
 stopped" ;;
> esac
>
> ORAUNLD
> vi oraunld
> "oraunld" 79 lines, 2163 characters
> echo "Type the SID for the database you want to shut down"
> echo "Your choices are DNEG GSP2 GSPD ORCL. Or type ALL to shut
 down all
> the instances."
> read dbsid
>

PATH=/usr/bin:/usr/ucb:/etc:/oracle/app/oracle/product/8.1.5/bin:/usr/cc s/bi
> n:.
> export PATH
> echo "Environment variable PATH set and exported"
> case $dbsid
> in
> DNEG) ORACLE_SID=$dbsid
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DNEG and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> shutdown immediate;
> disconnect
> EOF
> ;;
> DEV6) ORACLE_SID=$dbsid
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DEV6 and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> shutdown immediate;
> disconnect
> EOF
> ;;
> ALL) ORACLE_SID=DNEG
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DNEG and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> shutdown immediate;
> disconnect
> EOF
> ORACLE_SID=DEV6
> export ORACLE_SID
> echo "Environment variable ORACLE_SID set to DEV6 and
 exported"
> SQL*Plus /nolog <<EOF
> connect internal
> shutdown immediate;
> disconnect
> EOF
> ;;
> *) echo "You entered no SID or an invalid SID - program
 stopped" ;;
> esac
>
> <iztoku_at_my-deja.com> wrote in message

 news:8nrt89$10d$1_at_nnrp1.deja.com...
> > In article <8nrs8f$vqj$1_at_nnrp1.deja.com>,
> > lkj741_at_my-deja.com wrote:
> > > Connect internal from svrmgrl
> > >
> > > shutdown immediate or normal
> > >
> > > Startup open or startup mount then alter database open.
> > >
> > > start or stop lsnrctl....
> > >
> > > hope this will help...
> >
> > I am sorry I wasn't clear. I am looking into shell script examples I
> > could run from /etc/init.d on booting/shutting down solaris box.
> >
> > Regards,
> > Iztok
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>

Unfortunately this will not be usable at system boot -- interactive scripts usually aren't.

Try this instead; it relies upon the existence of the dbstart and dbshut scripts in $ORACLE_HOME as well as the ability of 'root' to 'su' to any account without a password:

#!/bin/sh
#
# Oracle database startup/shutdown script
#
# Called at system boot/shutdown
#
#

if [ $# -ne 1 ]
then

     echo "USAGE: `basename $0` start|stop"
     exit 1

fi

case $1 in
start)

        # Start the database(s)

          su - oracle dbstart

        # Start the listener

          su - oracle "lsnrctl start";;

stop)

        # Stop the listener

        su - oracle "lsnrctl stop"

        # Stop the database(s)

        su - oracle dbshut;;

esac

Place this script into /etc/init.d and name it oracle. Link this into the rc?.d directories that should start and stop the instance; use S99oracle for startup and K01oracle for shutdown (these are just suggestions). The K??oracle script would be linked into the /etc/rc2.d directory to shut down the instances when leaving run level 2 and the S??oracle would be linked into the rc3.d directory to start the instances when entering run level 3. Again, these are suggestions.

Have fun. I hope this helps.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Aug 21 2000 - 21:10:42 CDT

Original text of this message

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