Oracle provides two
UNIX / Linux scripts that assist DBAs with starting and stopping the database:
dbshut. For Windows platforms,
the oradim utility is
provided for automatically starting and stopping the Oracle instance.
dbstart utility reads the
file, shown in the example below. The
oratab file will reside in either
/var/opt/oracle, depending on the
UNIX / Linux version. It contains three data items separated by colons:
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 automatically start or auto stop the particular database
when either the dbstart or
dbshut command is issued.
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
dbstart command can be added to
the UNIX / Linux 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
Answer: Oracle on Linux has a file called oratab which
exists in the /etc directory. This oratab file has a Y/N flag to
specify to re-start Oracle at Linux startup time:
St the oratab autostart column to 'Y' in the /etc/oratab file.
root> cat /etc/oratab
STEP 2. Create the file named "oracle" in /etc/init.d. This
oracle file calls the dbstart and dbshut routines.
soft links for init.d:
ln -s /etc/init.d/oracle /etc/rc0.d/K10oracle
ln -s /etc/init.d/oracle /etc/rc3.d/S99oracle
4. Change permissions: chmod 750 /etc/init.d/oracle
Run the chkconfig utility to associate the dbora service with the
appropriate run levels:
--level 2345 oracle on
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
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
it should not be modified to support
To add the
dbstart utility to the AIX
initialization process, the following steps can be performed:
Create the script /etc/rc.oracle.
The script should contain the following:
su oracle <<EOF
- Add the script to the inittab using the mkitab utility:
"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
Stopping on Windows
dbstop shell scripts do not exist
on Windows platforms. Consequently Oracle database startup and shutdown is
implemented completely differently. The
oradim utility is used on the Windows platform to perform these
-startup -sid ORCL92
-starttype SRVC,INST -pfile C:\oracle9i\admin\ORCL92\pfile\init.ora
— Indicates that the specified instance should be started.
— The SID of the database to start.
— The password for the database user.
— Specifies whether to start the instance, the service, or both (SRVC,
The following command
can be used to shutdown the instance with
C:\oracle9i\bin\oradim -shutdown -sid ORCL92
Notice that no password
is needed to perform this task.
shuttype parameter specifies what
is to be stopped – the service (SRVC), the instance (INST), or both (SRVC,
INST). The shutmode specifies
the method that should perform the shutdown – (A)bort, (I)mmediate, or (N)ormal.
regardless of success, is logged in the
oradim log file (ORACLE_HOME\database\OraDim.Log).
This file should be checked for errors after each
oradim command is executed.
oradim utility provides more than
just the ability to start and stop Windows databases.
oradim can create and edit
databases. It also allows DBAs to configure script-based installation
mechanisms, bypassing the Oracle Database Configuration Assistant's graphical
user interface (GUI).
oradim script download
Oracle Windows oradim Utility
Auto start Oracle Automatically
Batch script to start Oracle Windows services
from Google - 1/2012
Advanced Oracle Utilities - Oracle ORADIM Utility
How to start Oracle Windows services
Utilities Starting and Stopping Oracle on Windows
Oracle on Windows for Unix Users
For a reference of all
oradim commands, use the
coraenv utilities both aid in
setting the Oracle environment on UNIX / Linux systems (other utilities exist on Windows
platform that enable the Oracle Home to be set.) The
coraenv utility is appropriate
for the UNIX / Linux C Shell; oraenv
should be used with either the Bourne or Korn shells.
require the ORACLE_HOME to be
set before the user may access the database. If
ORACLE_HOME is not set, commands
such as sqlplus,
exp, or any other utility for
that matter, will not be found.
Both utilities are
shell scripts that do the same thing in the different UNIX / Linux shells. They will
prompt for a SID of the database unless
ORAENV_ASK is set to N. The utility will also append the ORACLE_HOME
value to the path, marking the location of the utility.
oraenv command will prompt for
the SID of the database that you wish
$ORACLE_HOME to access.
ORACLE_SID =  ? ASG920
dbhome utility can now be used to
verify that $ORACLE_HOME is
The "dot space" part of
the command is required to make the environment change with the parent shell, as
opposed to entering a command without it which would only affect the subshell
running that process.
These commands can be
used to avoid specifying the network service name when issuing commands. For
instance, without using oraenv,
an sqlplus command would look
sqlplus system/manager@nameofservice as sysdba
oraenv has been executed, the
following command would work:
sqlplus system/manager as sysdba
For more information on stopping and starting Oracle
"Oracle Shell Scripting" by Jon Emmons.
Original article by Mike Ault.
Get the Complete
Oracle SQL Tuning Information
The landmark book
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
for 30% off directly from the publisher.