1. Create the/etc/rc. d/init. d/Oracle10g script file as the root user. The content is as follows (the environment variable settings are modified according to the actual situation ):
#! /Bin/bash
#
# Chkconfig: 35 95 1
# Description: init script to start/stop Oracle Database 10g, TNS Listener, EMS, ISQLPLUS
#
#
#
# Match these values to your environment:
Export oracle_base =/home/APP/Oracle
Export ORACLE_HOME = $ oracle_base/product/10.1.0/db_1
# Export oracle_term = xterm
Export Path = $ path: $ ORACLE_HOME/bin
Export nls_lang = 'American _ America. zhs16gbk'
Export oracle_sid = esales
# Export display = localhost: 0
Export oracle_user = Oracle
# See how we are called:
Case $1 in
Start)
Su-"$ oracle_user" <EOO
LSNRCTL start
Sqlplus/nolog <Eos
Connect/As sysdba
Startup
EOS
Emctl start dbconsole
Isqlplusctl start
EOO
;;
Stop)
Su-"$ oracle_user" <EOO
LSNRCTL stop
Sqlplus/nolog <Eos
Connect/As sysdba
Shutdown immediate
EOS
Emctl stop dbconsole
Isqlplusctl stop
EOO
;;
*)
Echo "Usage: $0 {START | stop }"
;;
Esac
2. Run the following command as the root user
Chmod 755/etc/rc. d/init. d/Oracle10g
Chkconfig -- add Oracle10g
3. Restart the service
Service Oracle10g stop
Service Oracle10g start
In this way, Oracle automatically starts and stops when the host is switched on and off.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/wzy0623/archive/2007/06/27/1668662.aspx