My OS: Red Hat Enterprise Server 4
The Database Service, Oracle em, and Oracle ISQLPLUS are installed.
Log in as root,
1) Change the/etc/oratab File
For example, my oratab file is as follows:
Sharkl:/u01/APP/Oracle/product/10.2.0/db_1: Y
This line means: Instance name: ORACLE_HOME: Start or not
Dbstart and dbshut in ORACLE_HOME/bin scan the file to determine whether to start the Oracle database service.
2) goto/etc/init. d
Create an oracle file (a shell script file). For example, the content of my Oracle file is as follows:
#! /Bin/bash
#
#/Etc/rc. d/init. d/Oracle
#
# Source function library.
#
# Test-x/usr/sbin/ATD | exit 0
Retval = 0
ORACLE_HOME =/u01/APP/Oracle/product/10.2.0/db_1
#
# See how we were called.
#
Prog = "oracle"
Start (){
# Check If atd is already running
# If [! -F/var/lock/subsys/Oracle]; then
Echo-N $ "Starting $ prog :"
Su-Oracle-c "$ ORACLE_HOME/bin/dbstart"
Su-Oracle-c "$ ORACLE_HOME/bin/LSNRCTL start"
# Fi
Return $ retval
}
Stop (){
Echo-N $ "Stopping $ prog :"
Su-Oracle-c "$ ORACLE_HOME/bin/dbshut"
Su-Oracle-c "$ ORACLE_HOME/bin/LSNRCTL stop"
Return $ retval
}
Restart (){
Stop
Start
}
Reload (){
Restart
}
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Reload | restart)
Restart
;;
*)
Echo $ "Usage: $0 {START | stop | restart }"
Exit 1
Esac
Exit $?
Exit $ retval
3) Run chmod 755 Oracle
4) log on to XWindow as root,
Click "application"Program/System/Server Settings /"
Select "Action/Add service" and enter the service name oracle. Note that the name must be consistent with the file name created in step 2.
Other Oracle em services and ISQLPLUS services are similar to Oracle database services.
Oracle EM: emctl START | stop dbconsole
ISQLPLUS: isqlplusctl START | stop