244139.1
61333.1 Automatic startup and shutdown of Oracle database instances
207508.1 Dbstart does not work if using an spfile only
91815.1 Annotated dbstart script
1019790.6 Automatic startup/ shutdown of Oracle instances on HP-UX Unix
222813.1 Automatic startup/ shutdown of Oracle instances on Linux
Automating Database Startup and Shutdown for AIX:
http://download.oracle.com/docs/html/A96167_01/post-inst.htm#i1035384
Oracle Corporation recommends that you configure your system to automatically start Oracle databases when your system starts up, and to shut down Oracle databases when your system shuts down. Automatic database startup and shutdown protects against improper shutdown of the database.
Automating Database Startup
Perform the following tasks to set up the dbstart and dbshut scripts so that they are called at system startup. This process must be completed for every new database that you want to configure for automated startup:
1.Edit the /etc/oratab file.
Database entries in the oratab file appears in the following format:
ORACLE_SID:ORACLE_HOME:{Y|N}
In the preceding command, Y or N specifies whether you want the dbstart and dbshut scripts to start up and shut down the database.
For Oracle Real Application Clusters installation, this entry appears in the following format:
DB_NAME:ORACLE_HOME:{Y|N}
In the preceding command, DB_NAME is the cluster database name. Y or N specifies whether you want the dbstart and dbshut scripts to start up and shut down the database.
2.For each database that you want to start up, find the ORACLE_SID entry identified by the sid in the first field. Change the last field for each to Y.
3.Add the dbstart script to the /etc/inittab file:
# mkitab "oradb:2:wait:/bin/su oradb -c|/$ORACLE_HOMES/bin/dbstart"
In the preceding command, oradb is the identifier of the oracle user for which you want to start the database.
Automating Database Shutdown
Automate database and system shutdown by creating a script, shut, to start dbshut and the system executable /etc/shutdown. Complete the following steps to create the script:
1.If you have not already done so, edit the database entries of your /etc/oratab file to enable dbstart and dbshut, as described in step 1 of the dbstart instructions.
2.As root, create the shut shell script:
# cd /etc
cat > shut << EOF
? su oracle_owner -c /usr/oracle/bin/dbshut
? /etc/shutdown $* \
? [Ctrl-D]
# chmod u+x shut
3.Execute the following command to run the shut script and shut down the database:
# /etc/shut -h now
This closes Oracle databases and shuts down the system with the specified options.
Actual Step on AIX:
- make a backup copy of your existing dbstart script prior to proceeding
- edit the dbstart script
- add the following line:
SPFILE=${ORACLE_HOME}/dbs/spfile${ORACLE_SID}.ora
after this line: PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora
- change:
if [ -f $PFILE ] ; then
to:
if [ -f $PFILE -o -f $SPFILE ] ; then
At the end of the file, make the following entry:
$ORACLE_HOME/bin/lsnrctl start
/etc/mkitab "oracle:2:wait:/bin/su oracle -c
<$ORACLE_HOME>/bin/dbstart > /dev/console 2>&1"
Make sure that the entry is made in /etc/inittab
Automating Database Startup and Shutdown for Linux:
http://download.oracle.com/docs/html/A96167_01/post-inst.htm#i1035370
Oracle Corporation recommends that you configure your system to automatically start Oracle databases when your system starts up, and to shut down Oracle databases when your system shuts down. Automatic database startup and shutdown protects against improper shutdown of the database.
The dbstart and dbshut scripts are located in the $ORACLE_HOME/bin directory and can be used to automate database startup and shutdown. The dbstart and dbshut scripts reference the same entries in the oratab file, so the scripts must apply to the same set of databases. For example, you cannot have the dbstart script automatically start up databases sid1, sid2, and sid3, and the dbshut script shut down only databases sid1 and sid2. You can, however, specify that the dbshut script shut down a set of databases while the dbstart script is not used at all. To do this, include a dbshut entry in the system shutdown file but omit the dbstart entry from the system startup files.
See Also:
init command in your UNIX system documentation for more information on system startup and shutdown procedures.
Perform the following tasks to set up the dbstart and dbshut scripts so that they are called at system startup. This process must be completed for every new database that you want to configure for automated startup and shutdown.
1.Edit the /var/opt/oracle/oratab file for Solaris and /etc/oratab file for HP and Linux.
Database entries in the oratab file appears in the following format:
ORACLE_SID:ORACLE_HOME:{Y|N}
In the preceding command, Y or N specifies whether you want the dbstart and dbshut scripts to start up and shut down the database. For each database that you want to start up, find the ORACLE_SID entry identified by the sid in the first field. Change the last field for each to Y.
For Oracle Real Application Clusters installation, this entry appears in the following format:
DB_NAME:ORACLE_HOME:{Y|N}
In the preceding command, DB_NAME is the cluster database name. Y or N specifies whether you want the dbstart and dbshut scripts to start up and shut down the database.
2.In the /etc/init.d directory, create a dbora script similar to the following, if it does not already exist. Be sure to give the full path of the dbstart utility.
#!/bin/sh
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/u01/app/oracle/product/9.2.0.1.0
ORA_OWNER=oracle
if [! -f $ORA_HOME/bin/dbstart]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &
;;
esac
3.Create symbolic links to the dbora script in the appropriate run-level script directories, as follows:
# ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
The system shutdown process in AIX involves only the /etc/shutdown script.
You can perform shutdown manually, or write a script which automatically
shuts down Oracle instances and then shuts down the system.
Here is a sample script that performs these actions. Make sure that the
script you write is owned and executable only by root.
#!/bin/sh
/bin/su oracle -c
/usr/sbin/shutdown $*
Note: we strongly recommend that you do not alter the system shutdown script
Save it and execute it as /etc/shut -h now