1. Create a file/etc/oratab
# Add the following content to the/etc/oratab file,
# $ Oracle_sid is the SID of your Oracle Database
# $ ORACLE_HOME is the ORACLE_HOME of your Oracle Database
# Y indicates that Oracle database is required to be started at system startup. N indicates that Oracle database cannot be started at system startup.
$ Oracle_sid: $ ORACLE_HOME: Y
2. Modify the file/etc/rc. Local and add two lines.
##
# For more information about Su commands, see the Linux Manual document.
##
Su-Oracle-C 'dbstart'
Su-Oracle-C 'lsnrctl start listener'
Environment variable settings:
Edit/etc/profile
Export oracle_base =/usr/Oracle
Export ORACLE_HOME = $ oracle_base/product/10.2.0/db_2
Export oracle_sid = orcl
Export Path = $ path: $ home/bin: $ ORACLE_HOME/bin
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib
Export lc_ctype = en_US.UTF-8
Reprinted and self-started by script:
#! /Bin/sh
# Author: jackylau <squidipt@yahoo.com.cn>
# Chkconfig: 345 99
# Description: start or stop Oracle
./Etc/rc. d/init. d/functions
# Oracle_env
Export oracle_base =/home/Oracle
Export ORACLE_HOME = $ oracle_base/product/9.2.0
Export Path = $ path: $ ORACLE_HOME/bin
Export oracle_sid = oradb
Export oracle_term = VT100
Export ora_nls33 = $ ORACLE_HOME/ocommon/NLS/admin/Data
Export nls_lang = american_america.zhs16gbk
Oracle_user = Oracle
# Killproc
Start (){
Echo-n "Starting ORACLE :"
Su-"$ oracle_user" <
LSNRCTL start
Sqlplus/nolog <
Connect/As sysdba
Startup
EOS
EOO
}
Stop (){
Echo-n "stoping ORACLE :"
Su-"$ oracle_user" <
LSNRCTL stop
Sqlplus/nolog <
Connect/As sysdba
Shutdown immediate
EOS
EOO
}
Case "$1" in
Start)
Start
Touch/var/lock/subsys/orad
;;
Stop)
Stop
Rm-F/var/lock/subsys/orad
;;
Status)
Status Oracle
;;
Restart)
Stop
Sleep 3
Start
;;
*)
Echo "$0 {START | stop | status | restart }"
;;
Esac
Run the script CP to the/etc/rc. d/init. d/directory.
Add executable permissions:
Chmod 755/etc/rc. d/init. d/orad
Release:
Chkconfig -- add orad
You can!