1. 编辑/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:<N|Y>:
#
# 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/oracle/product/10.2.0/db_1:Y
2. 修改文件/etc/rc.local添加一下两行
su - oracle -c 'dbstart'
su - oracle -c 'lsnrctl start '
3 重新启动的时候出现如下的错误
Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr
看来是listener服务没有起来,但是执行lsnrctl start却能启动listener服务。
搜索dbstart文件中的tnslsnr字符串
grep tnslsnr dbstart
返回结果:
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
echo "Failed to auto-start Oracle Net Listene using $ORACLE_HOME_LISTNER/bin/tnslsnr"
看来可能是ORACLE_HOME_LISTNER环境变量引起的,查找 ORACLE_HOME_LISTNER
grep ORACLE_HOME_LISTNER dbstart
返回结果
# 3) Set ORACLE_HOME_LISTNER
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
LOG=$ORACLE_HOME_LISTNER/listener.log
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
$ORACLE_HOME_LISTNER/bin/lsnrctl start >> $LOG 2>&1 &
export VER10LIST=`$ORACLE_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for " | cut -d' ' -f5 | cut -d'.' -f1`
echo "Failed to auto-start Oracle Net Listene using $ORACLE_HOME_LISTNER/bin/tnslsnr"
$LOGMSG "Restart Oracle Net Listener using an alternate ORACLE_HOME_LISTNER: lsnrctl start"
其中有一段给ORACLE_HOME_LISTNER环境变量赋值,但是这个路径是不对的,编辑dbstart文件
vi dbstar
将该行改为export ORACLE_HOME_LISTNER=$ORACLE_HOME
4 修改完毕第三步的设置
oracle就可以随着系统重新启动正常启动了