Question: I have five
instances on my Oracle Windows Server and I want to know how to automate
the startup of Oracle when the Intel server and Windows OS are
re-booted. How can I make Oracle
start automatically in Windows?
Answer: Oracle provides
two Windows scripts that assist DBAs with starting and stopping the
Windows-based database: dbstart and dbshut.
For pre-written and pre-tested Oracle auto start scripts see
the Oracle script download.
The
dbstart utility reads the oratab file, shown in the example below.
The oratab file will reside in /etc. It contains three data items
separated by colons:
oracle > cat /etc/oratab| wc -l
oracle > cat /etc/oratab
MYSID1:/usr/oracle/9.2.0:Y
MYSID2:/usr/oracle/11.1.0:Y
MYSID3:/usr/oracle/10.2.03:N
Above we see that there are three instances on this
server, all on different releases of Oracle and the Oracle10g is
marked "N", so that database will not re-start when the Windows OS
re-starts.
1 - The first field is the Oracle SID.
2
- The second field is the home directory for that Oracle SID.
3 - The third column is a 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 Windows
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.
Automatic Starting and
Stopping on Windows
The
dbstart and
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
tasks.
C:\oracle9i\bin\oradim
-startup -sid ORCL92
?usrpwd manager
-starttype SRVC,INST -pfile C:\oracle9i\admin\ORCL92\pfile\init.ora
- startup - Indicates that the specified instance should be started.
- sid - The SID of the database to start.
- usrpwd - The password for the database user.
- starttype - Specifies whether to start the instance, the service, or both (SRVC,
INST).
The following command
can be used to shutdown the instance with
oradim:
C:\oracle9i\bin\oradim -shutdown -sid ORCL92
-shutttype SRVC,INST
'shutmode A
Notice that no password
is needed to perform this task.
The
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.
Each operation,
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.
The
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).
For a reference of all
oradim commands, use the
oradim?help command.
Automating Oracle re-start within shell scripts
Please see these important notes on embedding
Oracle re-start details within the
oraenv utility . For more information on stopping and starting Oracle
automatically, see
"Oracle Shell Scripting" by Jon Emmons.
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
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
buy it
for 30% off directly from the publisher.
|