Linux下设置Oracle11gR2开机自动启动_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1599 | 回复: 0   主题: Linux下设置Oracle11gR2开机自动启动        下一篇 
shylone
注册用户
等级:下士
经验:199
发帖:90
精华:0
注册:2011-11-24
状态:离线
发送短消息息给shylone 加好友    发送短消息息给shylone 发消息
发表于: IP:您无权察看 2015-8-21 11:10:21 | [全部帖] [楼主帖] 楼主

Oracle11gR2开机自启动实例配置过程


1. 修改/etc/oratab的值为Y


[oracle@ocp1 bin]$ 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.
#
#
ocp1:/u01/app/oracle/product/11.2.0/db_1:Y


2.修改dbstart和dbshut启动关闭脚本,使其启动数据库的同时也自动启动监听器(即启动数据库时启动监听器,停止数据库时停止监听器):

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


找到下面的代码,在实际脚本代码的前面

# First argument is used to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$1


# 将此处的 ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=$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


同样也修改dbshut脚本:

# The this to bring down Oracle Net Listener
ORACLE_HOME_LISTNER=$1
# 将此处的 ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME

if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener"
echo "Usage: $0 ORACLE_HOME"
else
LOG=$ORACLE_HOME_LISTNER/listener.log
# vim /u01/app/oracle/product/11.2.0/db_1/bin/dbshut
# The this to bring down Oracle Net Listener
ORACLE_HOME_LISTNER=$1


# 将此处的 ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME

if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener"
echo "Usage: $0 ORACLE_HOME"
else
LOG=$ORACLE_HOME_LISTNER/listener.log


3.  用root用户在rc.local里添加如下内容:

[oracle@ocp1 bin]$ 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"/u01/app/oracle/product/11.2.0/db_1/bin/dbstart"
su - oracle -c"/u01/app/oracle/product/11.2.0/db_1/bin/emctl start dbconsole"


这里注意必须用oracle 用户来启动脚本。

4. reboot 系统,Oracle就能自动启动了。



--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论