dbstart and dbshut scripts – reference for the new oracle dba





A new oracle dba can find here about the 2 scripts dbstart and dbshut that oracle provides to automatically start and shutdown the oracle database and listener.

dbstart / dbshut

Oracle provides two  UNIX  scripts that assist DBAs with starting and stopping the database: dbstart and dbshut.  For Windows platforms, the oradim utility is provided for starting and stopping the Oracle instance.

The dbstart utility reads the oratab file, shown in the example below.  The oratab file will reside in either /etc or /var/opt/oracle, depending on the  UNIX  version.  It contains three data items separated by colons:

ASG920xr:/usr/oracle/9.2.0:Y

ASG817xr:/usr/oracle/8.1.7:Y

TEST920xr:/usr/oracle/9.2.0:N

PROD920xr:/usr/oracle/9.2.0:N

The first field is the Oracle SID.  The second field is the home directory for that Oracle SID.  The Y or N instructs Oracle whether to start or stop the particular database when either the dbstart or dbshut command is issued.  The dbstart command simply parses the oratab file and starts those databases that have a Y in the third field.  It also uses the ORACLE_HOME specified in the file to connect internally to the database and issue the startup command.

The dbstart command can be added to the  UNIX  servers’ initialization or run level scripts.  This enables dbstart to be executed each time the machine is booted or when it changes run levels.   The method for implementing this is platform specific, as we see below. 

Auto Start on HP-UX and Solaris

For HP-UX version 10 and above, the system initialization scripts are contained in /etc/rc<n>.d directories, where “n” is the operating system run-level.  These directories contain scripts that begin with a K or S, followed by a number, and then a file name (S75cron).  All scripts that begin with “S” are executed at system startup in ascending order of their number.  Scripts beginning with “K” (Kill) are called at system shutdown time.

As a general rule of thumb, the Oracle startup script should have a high sequence number (S99dbstart), which will ensure that other system processes have been started prior to Oracle.  Likewise, the kill scripts should have a low sequence number in order to shutdown Oracle early in the process (K01dbshut).

Auto Start on AIX

For AIX servers, the system initialization file is /etc/inittab and the initialization script is /etc/rc.  A utility (/usr/sbin/mkitab) can be used to make an entry in the inittab file.  The shutdown script for AIX is /usr/sbin/shutdown, although it should not be modified to support dbshut.

To add the dbstart utility to the AIX initialization process, the following steps can be performed:

1.   Create the script /etc/rc.oracle.  The script should contain the following:

su oracle <<EOF

<$ORACLE_HOME>/bin/dbstart

EOF

2.   Add the script to the inittab using the mkitab utility. 

$ /usr/sbin/mkitab “rcoracle:2:wait:/etc.rc.oracle >/dev/console 2>&1”  

All references to <$ORACLE_HOME> should be replaced with the actual Oracle Home directory.  Now upon system startup, the dbstart utility is invoked at run level 2.

Author: admin