[Sunhelp] startup oracle at boot

Andrew Wallace andreww at pcs.co.uk
Tue Aug 8 04:23:56 CDT 2000


Hi Tim,

This is explained more fully in chapter 4 of the Oracle documentation
that you'll find on the Oracle 8 install CD.

Basically there are two scripts in the $ORACLE_HOME directory that start
up and shutdown the DB for you - called, dbstart and dbshut.

If you decide to automatically shutdown the DB when you bring down the
system and you use dbshut, then may find that you have to edit dbshut to
do shutdown immediate rather than shutdown normal, as the second option
waits for all users to log out of the DB before shutting it down and
you'll find that the DB is not shut correctly. If you find this
happening, it's not really a problem though as Oracle guarantee DB
recovery in the case of instance failure. 

Here is the bit  from the documentation that you need:

1.Edit the /var/opt/oracle/oratab file. 

        Database entries in the oratab file appear in the following
format: 

        ORACLE_SID:ORACLE_HOME:{Y|N}


        where Y or N specifies whether you want the dbstart and dbshut
scripts to start
        up and shut down the database. 

   2.Find the entries for all the databases that you want to start up.
They are
        identified by the sid in the first field. Change the last field
for each to Y. 

   3.Create a file named dbora in the /etc/init.d directory (if it does
not already exist). 

   4.Create entries similar to the following at the end of the dbora
file (if they do not
        already exist). Be sure to give the full path of the dbstart
utility. 

        #!/bin/sh
        # Set ORA_HOME to be equivalent to the ORACLE_HOME 

        # from which you wish to execute dbstart and

        # dbshut

        # set ORA_OWNER to the user id of the owner of the 

        # Oracle database in ORA_HOME

        ORA_HOME=/u01/app/oracle/product/8.1.5

        ORA_OWNER=oracle

        if [! -f $ORA_HOME/bin/dbstart]

        then

        echo "Oracle startup: cannot start"

        exit

        fi

        case "$1" in

        'start')


        # Start the Oracle databases:
        # The following command assumes that the oracle login will not
prompt the

        # user for any values

        su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &

        ;;

        'stop')

        # Stop the Oracle databases:
        # The following command assumes that the oracle login will not
prompt the

        # user for any values

        su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &

        ;;

        esac


   5.Link dbora by entering: 

        # ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
        # ln -s /etc/init.d/dbora /etc/rc2.d/S99dbora      

Hope it helps,

Andy Wallace





More information about the SunHELP mailing list