1.Edit /etc/oratab file for Linux.
Database entries in the oratab file appears in the following format: ORACLE_SID:ORACLE_HOME:{YN}
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.
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.4
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
touch /var/lock/subsys/dbora
;;
'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.Go to the /etc/init.d directory, and issue this command:chmod 755 dbora
4.Create symbolic links to the dbora script in the appropriate run-level script directories, as follows:
# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K10dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc6.d/K10dbora
5.If your database uses an spfile to start, you must do the follows:
- make a backup copy of your existing dbstart script prior to proceeding ($ORACLE_HOME/bin/dbstart)
- 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
Note:
The original script in the manual starts a background process by add a "&" to the end of the "su" command, and this may make the script not work.
All above have been tested under Redhat ES3, oracle 9.2.0.4.
Reference:
Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems:
AIX-Based Systems, Compaq Tru64 UNIX, HP 9000 Series HP-UX, Linux Intel, and Sun Solaris
Part No. A96167-01
Document 207508.1 on metalink.oracle.com
Document 83630 on OiSC
Thursday, September 14, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment