The content of this article mainly comes from: http://lbyzx123.javaeye.com/blog/829235
1. Create the script file Oracle10g under/etc/init. d/with the following content:
#! /Bin/bash
# Whoami
# Root
# Chkconfig: 345 51 49
#/Etc/init. d/Oracle10g
# Description: starts the Oracle dabase deamons
#
Ora_home =/home/Oracle/product/10.2.0/db_1/
Ora_owner = Oracle
Case "$1" in
Start)
Echo-n "Starting Oracle10g :"
Su-$ ora_owner-c "$ ora_home/bin/dbstart "&
Su-$ ora_owner-c "$ ora_home/bin/LSNRCTL start"
Touch/var/lock/subsys/Oracle10g
Echo
;;
Stop)
Echo-n "shutting down Oracle10g :"
Su-$ ora_owner-c "$ ora_home/bin/dbshut "&
Su-$ ora_owner-c "$ ora_home/bin/LSNRCTL stop"
Rm-F/var/lock/subsys/Oracle10g
Echo
;;
Restart)
Echo-n "Restarting Oracle10g :"
$0 stop
$0 start
Echo
;;
*)
Echo "Usage: 'basename $ 0' START | stop | restart"
Exit 1
Esac
Exit 0
2. Run chkconfig Oracle10g -- add to add service 3. The above script does not start the database instance. You need to modify the file/etc/oratab (if the file does not exist, run the script/home/Oracle/product/10.2.0/db_1/root. SH)
Change N in line similar to "orcl:/Oracle/product/10.2.0/db_1: N" to Y4 and run service Oracle10g [Start | stop] to test whether the database can be started or stopped. 5, restart the machine to test whether the database is successfully started.