linux 下oracle自动启动

来源:互联网 发布:ubuntu中安装jenkins 编辑:程序博客网 时间:2024/05/19 00:55
1、修改/etc/oratab
[root@db ~]# cat /etc/oratab
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.


# 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:/opt/oracle/product/11.2/db_1:Y          -----此处默认为N,改为Y,启用dbstart脚本。


2、修改dbstart脚本
cd $ORACLE_HOME/bin
vi /dbstart
# First argument is used to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME        ---此处默认为“$1”需要修改为“$ORACLE_HOME”
if [ ! $ORACLE_HOME_LISTNER ] ; then
  echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
  echo "Usage: $0 ORACLE_HOME"
else
  LOG=$ORACLE_HOME_LISTNER/listener.log




3、修改/etc/rc.local配置开机自动启动脚本
[root@db ~]# cat /etc/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 "/opt/oracle/product/11.2/db_1/bin/dbstart"    ---增加此条。
0 0