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 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就能自动启动了。
参考:
来源: <
>
阅读(2109) | 评论(0) | 转发(0) |