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: auto start/stop of database on Solaris reboot?

Re: auto start/stop of database on Solaris reboot?

From: Yass Khogaly <ykhogaly_at_us.oracle.com>
Date: Mon, 19 Jul 1999 18:16:04 -0700
Message-ID: <7n0f3o$of4$1@inet16.us.oracle.com>


The following list summarizes the functions performed by the different Oracle
startup and shutdown scripts (which are invoked during system startup and shutdown, respectively).

Script                    Description
-------------------------|--------------------------------------------------
$ORACLE_HOME/bin/dbstart |Ensures a clean startup of database instance(s),
                         |even after system failure
-------------------------|--------------------------------------------------
$ORACLE_HOME/bin/dbshut  |Ensures a clean shutdown for data base instances
-------------------------|--------------------------------------------------

/etc/oratab or |Contains a field that specifies whether a
/var/opt/oracle/oratab |particular database instance should be brought
|up/down at system startup/shutdown time. By |specifying "Y" in this field, the "dbstart" and |"dbshut" scripts bring this database instance up or |down. -------------------------|--------------------------------------------------

System V Versus BSD UNIX Startup and Shutdown Procedures



Since the system re-boot procedure is unique for each Unix Operating System, but can be generalized based on whether the Operating System is System V-based
or BSD-based, this section describes the generic approach taken by System V and BSD-based UNIX operating systems at system startup and shutdown time. For
more specific information, refer to the appropriate operating system-specific
section below.

System V Procedures
- - - - - - - - - -
System V initialization scripts are contained in /etc/rc<n>.d directories where "n" is the run-level value of the script. A run-level of 0 usually signifies power shutdown mode, while a run-level of 2 signifies multi-user mode.

The directories contain initialization scripts such as "S75cron" and "K30tcp".
These scripts are named using the following method:

     [K or S][two-digit number][descriptive filename]

Names starting with "S" indicate scripts that are called at startup; names starting with "K" indicate scripts that are called at shutdown time.

Scripts containing larger numbers in their names are executed after those with lower numbers. Oracle startup scripts typically contain larger numbers in their names, such as "S99oracle", indicating that the script should be run after the system has been started up. Oracle shutdown script names, on the other hand, usually contain smaller numbers, such as "K01oracle" indicating that the script should be run before system shutdown.

BSD Procedures
- - - - - - -
BSD-based systems, use /etc/rc*, files, such as /etc/rc, /etc/rc.local and so on, at system startup time.

During system shutdown, the /etc/shutdown command is invoked before any system or system-defined scripts. Some implementations invoke
/etc/rc.shutdown at shutdown time.

Operating System-Specific Details



This section discusses some of the details for implementing automatic startup and shutdown of Oracle instances on six major UNIX platforms. For more details, please refer to your System Administrator's Guide, or the on-line man pages.

SunOS 4.1.3
- - - - - -

     Relevant Files:

        /etc/rc.local - The startup script for the system

The /etc/rc/local script is executed at startup time. An entry such as the one below is necessary to start up the Oracle instance(s):

     su <oracle_owner> -c <$ORACLE_HOME>/bin/dbstart

where "<$ORACLE_HOME>" stands for the expanded form of $ORCALE_HOME (since the value of $ORACLE_HOME might not be set for the super user).

No script is executed at shutdown time in SunOS. "dbshut" can only be invoked at system shutdown time manually, or by writing a shell script, such as the following:

     #!/bin/csh

     su <oracle_owner> -c <$ORACLE_HOME>/bin/dbshut
     /etc/shutdown $*

Such a script invokes Oracle's "dbshut" script before invoking the
/etc/shutdown executable. The above script must be owned and executed only
by

root.

Note: If the system is shut down without shutting down the databases,

       delete the SGA files in $ORACLE_HOME/dbs and restart the instance,
       otherwise, restarting the instance after powering back fails.

OSF/1
- - -

     Relevant Files

        /etc/inittab -- Controls the initialization process
        /sbin/rc3    -- Script to start/stop processes at run level 3
        /sbin/rc0    -- Script to start/stop processes at run level 0
        /sbin/rc3.d/S99oracle -- Link to the script /sbin/init.d/oracle
        /sbin/rc0.d/K01oracle -- Same as above

The /etc/inittab contains instructions for the initialization process, including when the process should be created and run. One of the entries in the inittab file is

     s3:3:wait:/sbin/rc3 < /dev/console > /dev/console 2>&1

which invokes the script /sbin/rc3 and waits for it to finish. The script is invoked when the initialization is at run level 3 (multiuser state).

/sbin/rc3 now invokes scripts that are in the /sbin/rc3.d directory.
If the name of the script starts with "K", /sbin/rc3 starts the script with a "stop" parameter, thereby stopping the process identified by the script. On the other hand, if the script name begins with a "S", /sbin/rc3 provides it with a runtime parameter of "start", thereby starting the processes identified by that particular script.

Consequently, /sbin/rc3.d/S99oracle is an Oracle script that is triggered by
/sbin/rc3 and gets a runtime parameter of "start". This script, in turn,
invokes the SQL*Net V1 and V2 listeners, if these are installed, and starts up the $ORACLE_HOME/bin/dbstart script.

The shutdown process works in a similar fashion. The entry

     s0:0:wait:/sbin/rc0 off < /dev/console > /dev/console 2>&1

in /etc/inittab triggers the /sbin/rc0 script, which calls all scripts in the /sbin/rc0.d directory, providing each with a runtime parameter of "start"
(for scripts whose names begin with "S") or "stop" (for those whose names begin with "K").

The /sbin/rc0.d/K01oracle script is thus invoked with a "stop" parameter This script stops the SQL*Net V1 and V2 listeners and invokes the $ORACLE_HOME/bin/dbshut script.

Note that both /sbin/rc3.d/S99oracle and /sbin/rc0.d/K01oracle are symbolic links to the script /sbin/init.d/oracle. These scripts are invoked with a "start" and "stop" parameter, respectively, which controls the behavior of the script.

Note: The links to /sbin/init.d/oracle may not be correctly established.

       Other links may be present, forcing startup, or shutdown, to occur
       more than once.

Solaris 2.3
- - - - - -

     Relevant Files

        /etc/inittab           -- Controls the initialization process
        /etc/rc2               -- Script to start/stop processes at run
                                  level 2
        /etc/rc0               -- Script to start/stop processes at run
                                  level 0
        /etc/rc2.d/S99dbstart  -- Link to the script /etc/init.d/dbstart
        /etc/rc0.d/K01dbshut   -- Link to the script /etc/init.d/dbshut
        /var/opt/oracle/oratab -- Oracle oratab file

The process of startup and shutdown for Solaris 2.3 is similar to that of OSF/1, the only difference being that all the appropriate scripts and directories can be accessed from /etc instead of /sbin (directories such as rc0.d, rc2.d and others are actually located in /etc). Scripts such as rc0, rc2, are symbolic links to corresponding scripts in /sbin.

/etc/init.d/dbstart and /etc/init.d/dbshut are simple one-line scripts
containing the following commands, respectively:

    su <oracle_owner> -c <$ORACLE_HOME>/bin/dbstart

            and

    su <oracle_owner> -c <$ORACLE_HOME>/bin/dbshut

where "<$ORACLE_HOME>" stands for the path to which $ORACLE_HOME points, and <oracle_owner> stands for the userid who owns the Oracle installation.

Unlike with OSF/1, the "start" and "stop" parameters, passed to the scripts by
the system, are ignored by /etc/init.d/dbstart and /etc/init.d/dbshut.

Note: please make sure that both dbstart and dbshut in /etc/init.d are

      executable by the oracle userid.

For more details of the initialization process, please refer to
/etc/init.d/README.

Regards

"The Views expressed here are my own and not necessarily those of Oracle Corporation"

Mark Fearer <mfearer.com> wrote in message news:7n03lh$me2$1_at_pyrite.mv.net...

> I have been having mixed results getting oracle databases to shutdown
> properly when a SUN/Solaris machine is rebooted.  I am using the suggested
> K99aspect shutdown script which calls the /oracle/7.3.4/bin/dbshut script.
> This scripts works as designed manually, but does not execute when the
> server is shutdown.
>
> I've tried putting the link to K99aspect in either rc2.d or rc3.d, but
> neither works every time reliably.
>
> Can anyone please offer a more reliable way to ensure the oracle databases
> get shutdown if someone reboots the server without manually shutting down
> the databases before hand.
>
>
> --
> --------------------------------------------------
> Mark Fearer                        *   C:\DOS
> mfearer_at_mail.fearernet.com         *   C:\DOS\RUN
> http://www.fearernet.com/mfearer   *   RUN\DOS\RUN


Received on Mon Jul 19 1999 - 20:16:04 CDT

Original text of this message

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