在linux环境下静默安装oracle 11g后设置自动启动

要让oracle随linux启动而启动,需要设置以下五个地方:

1、修改/etc/oratab

# 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.
#
orcl11g:/u01/app/oracle/product/11.2.0/db_1:Y

2、修改dbstart

/u01/app/oracle/product/11.2.0/db_1/bin/dbstart

# ORACLE_HOME_LISTNER=$1

改为

ORACLE_HOME_LISTNER=$ORACLE_HOME


3、修改dbshut

/u01/app/oracle/product/11.2.0/db_1/bin/dbshut

# ORACLE_HOME_LISTNER=$1

改为

ORACLE_HOME_LISTNER=$ORACLE_HOME


4、创建/etc/init.d/oradb

#!/bin/bash  
# chkconfig: 2345 90 10  
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1  
export ORACLE_SID=orcl11g
export PATH=$PATH:$ORACLE_HOME/bin  
ORCL_OWN="oracle"  
# if the executables do not exist -- display error  
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]  
then  
   echo "Oracle startup: cannot start"  
   exit 1  
fi  
# depending on parameter -- start, stop, restart  
# of the instance and listener or usage display  
case "$1" in  
start)  
# Oracle listener and instance startup  
echo -n "Starting Oracle: "  
su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbstart"  
touch /var/lock/subsys/oradb  
# su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl start dbconsole"  
echo "OK"  
;;  
stop)  
# Oracle listener and instance shutdown  
echo -n "Shutdown Oracle: "  
# su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl stop dbconsole"  
su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbshut"  
rm -f /var/lock/subsys/oradb  
echo "OK"  
;;  
reload|restart)  
$0 stop  
$0 start  
;;  
*)  
echo "Usage: 'basename $0' start|stop|restart|reload"  
exit 1  
esac  
exit 0  

需要修改的有:

a.ORACLE_BASE

b.ORACLE_SID

c.ORCL_OWN


5、授权+加入服务

chmod 755 /etc/rc.d/init.d/oradb

chkconfig --add oradb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值