root@localhost oracle]# vim /etc/oratab
1 $ORACLE_SID:$ORACLE_HOME:Y
1 [root@localhost oracle]# vim /etc/init.d/dbora
view sourceprint 01 #!/bin/sh
02 # chkconfig: 345 99 10
03 # description: Oracle auto start-stop script.
04 #
05 # Set ORA_HOME to be equivalent to the $ORACLE_HOME
06 # from which you wish to execute dbstart and dbshut;
07 #
08 # Set ORA_OWNER to the user id of the owner of the
09 # Oracle database in ORA_HOME.
10
11 ORA_HOME=$ORACLE_HOME
12 ORA_OWNER=oracle
13
14 if [ ! -f $ORA_HOME/bin/dbstart ]
15 then
16 echo "Oracle startup: cannot start"
17 exit
18 fi
19
20 case "$1" in
21 'start')
22 # Start the Oracle databases:
23 # The following command assumes that the oracle login
24 # will not prompt the user for any values
25 su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
26 su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
27 touch /var/lock/subsys/dbora
28 ;;
29 'stop')
30 # Stop the Oracle databases:
31 # The following command assumes that the oracle login
32 # will not prompt the user for any values
33 su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
34 su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
35 rm -f /var/lock/subsys/dbora
36 ;;
37 esac
1 [root@localhost oracle]# chmod 750 /etc/init.d/dbora
1 [root@localhost oracle]# chkconfig --add dbora
在chkconfig时,若出现bash: chkconfig: command not found
1 [root@localhost oracle]# rpm -aq |grep chkconfig
2 chkconfig-1.3.30.2-2.el5
3 [root@localhost oracle]# export PATH=/sbin:$PATH
4 [root@localhost oracle]# chkconfig
应该可以了,重启系统吧!