1、查看/etc/oratab这个文件:
[oracle@readhatAS53 etc]$ cat /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
ORCL:/u01/oracle/product/ora10g:Y
当$ORACLE_SID:$ORACLE_HOME: 设置为Y时,允许实例自启动,当设置为N时,则不允许自启动。 这个文件里的配置仅仅起一个开关的作用,其并不会具体的执行启动和关闭,具体的操作由$ORACLE_HOME/bin/dbstart和dbshut 脚本来实现。 这2个脚本在执行时会检查/etc/oratab 文件里的配置,为Y时才能继续执行。因此只要将ORCL:/u01/oracle/product/ora10g:N修改为Y就行了。
2、使用root用户在/etc/rc.d/rc.local这个文件中添加如下内容:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -c'lsnrctl start'//启动oracle数据库监听
su - oracle -c'/u01/oracle/product/ora10g/bin/dbstart start'//启动oracle数据库实例
su - oracle -c'/opt/tomcat/apache-tomcat-6.0.20/bin/startup.sh'//启动tomcat服务器的配置。
3、reboot系统,oracle数据库与tomcat服务器就可以自动启动了。