Thursday, August 27, 2009

dbstart/dbshut

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:

ORCL:/data1/oracle/oracle/product/10.2.0/db_1:Y
IMANYDME:/data1/oracle/oracle/product/10.2.0/db_1:Y
dmedemo1:/data1/oracle/oracle/product/10.2.0/db_1:Y

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.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.

No comments:

Post a Comment