http://www.cnblogs.com/edwardcmh/archive/2012/05/11/2495671.html

安装完毕Oracle 11g每次都得手动启动 | 停止数据库(dbstart | dbshut)、监听器(lsnrctl)、控制台(emtcl)。

设置一下,若手动启动数据库的同时监听器没有启动(即启动数据库时自动启动监听器,停止数据库时停止监听器),则需要修改dbstart脚本文件:

[oracle@localhost ~]$ cd /u01/app/oracle/product/11.1.0/db_1/bin/
[oracle@localhost ~]$ vi 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:

[oracle@localhost ~]$ vi 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

完成后配置Linux启动脚本oracle,内容如下:

[oracle@localhost bin]$ cd /etc/init.d/
[oracle@localhost init.d]$ vi oracle
#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g AutoRun Services
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin ORA_OWNR="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 -- startup, shutdown, restart
# of the instance and listener or usage display case "$1" in
start)
# Oracle listener and instance startup
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|reload|reload}"
exit 1
esac
exit 0

赋予脚本可执行权限:

[oracle@localhost init.d]$ chmod 750 /etc/init.d/oracle

建立链接:

[oracle@localhost init.d]$ ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle
[oracle@localhost init.d]$ ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle

启用脚本并添加到服务:

[oracle@localhost init.d]$ chkconfig --level 345 oracle on
[oracle@localhost init.d]$ chkconfig --add oracle

注意:

这样的脚本一般不会启动实例,如果想让实例也随脚本一起启动的话,就需要修改文件/etc/oratab 
如果这个文件不存在,就要运行脚本文件产生它。

[root@localhost init.d]# $ORACLE_HOME/root.sh
# 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/app/oracle/product/11.1.0/db_1:Y

可以看出,实例orcl是自动启动的(标识为Y),只要在这里配置好,再配合上面的脚本,即可实现自动启动。

Linux配置Oracle 11g自动启动的更多相关文章

  1. Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考

    操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...

  2. Oracle linux安装Oracle 11G

    Oracle  linux安装Oracle 11G 系统环境 Oracle linux   5.8.19.6(64位) Oracle     11.2.0.1(64位) 本文档详细介绍Oracle  ...

  3. 配置ORACLE 11g绿色版客户端和PLSQL远程连接环境

    配置ORACLE 11g绿色版客户端和PLSQL环境   本方法是通过使用ORACLE官方提供的精简版客户端,即绿色免安装的客户端.   Instant client的版本很多:主要是Basic和Ba ...

  4. Linux平台oracle 11g单实例 安装部署配置 快速参考

    1.重建主机的Oracle用户 组 统一规范 uid gid 以保证共享存储挂接或其他需求的权限规范 userdel -r oracle groupadd -g 7 oinstall groupadd ...

  5. Redhat Enterprise 5.4下安装配置Oracle 11g R2详细过程

    1.Linux环境配置准备 环境:Linux:Redhat Enterprise 5.4,DB:Oracle 11g R2 X64,Oracle安装到/home/oralce_11目录下. 配置过程如 ...

  6. Linux安装Oracle 11G过程(测试未写完)

    一.简介 Oracle数据库在系统运维中的重要性不言而喻,通过熟悉Oracle的安装来加深对操作系统和数据库知识的了解.Linux安装Oracle前期修改linux内核参数很重要,其实就是linux下 ...

  7. Linux上Oracle 11g安装步骤图解

    Oracle 11g下载地址: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html 选 ...

  8. linux 安装oracle 11g

    安装环境 Linux服务器:SuSe10 sp2 64位 Oracle服务器:Oracle11gR2 64位 系统要求 Linux安装Oracle系统要求 系统要求 说明 内存 必须高于1G的物理内存 ...

  9. Linux下oracle 11g安装

    服务器环境要求     硬盘 20G以上 ,必须高于1G的物理内存,交换空间一般为内存的2倍,例如:1G的内存可以设置swap 分区为3G大小   在Root用户下执行以下步骤: 修改用户的SHELL ...

随机推荐

  1. 监听器(Listener)学习(二)

    一.监听域对象中属性的变更的监听器 域对象中属性的变更的事件监听器就是用来监听 ServletContext, HttpSession, HttpServletRequest 这三个对象中的属性变更信 ...

  2. LOJ2362. 「NOIP2016」蚯蚓【单调队列】

    LINK 思路 良心来说这题还挺思维的 我没看题解也不知道要这样维护 把每次斩断的点分别放进两个队列里面 因为要维护增长,所以可以让新进队的节点来一个负增长? 是不是就好了? 然后很容易发现因为在原始 ...

  3. 【模板】NTT

    NTT模板 #include<bits/stdc++.h> using namespace std; #define LL long long const int MAXL=22; con ...

  4. SqlServer使用CONVERT 对时间进行格式化

    前言 在最近使用SqlServer的时候遇到时间格式的转换,特此记录下. 本文参考:https://www.cnblogs.com/xiaoleiel/p/8301027.html,如有侵权,请联系删 ...

  5. C# 线程间不能调用剪切板的问题

    最近做一个项目,需要用到线程,而且要用到剪切板,创建了一个子线程之后发现在子线程中剪切板上获取不到数据,当时特别纳闷,上网查资料,最后终于搞定,现将解决方法归纳如下: 第一步: public void ...

  6. 在ng中的select的使用方法的讲解

    项目中我们可能会使用到条件过滤选择框之类的东西,最简单的就是input.select. 关于select的使用我们通常会需要从数据库中返回数据进行动态绑定. 此时我们会有两种方式: 1)使用ng-re ...

  7. java 工作流

    BPM是jboss旗下遵守LGPL许可的java开源工作流,功能比较完善,从4.0开始引入了pvm的概念,支持jPDL.BPEL等流程定义语言.由于相关资料还比较少,开发自己的一个demo还不是太容易 ...

  8. Unit07: MyBatis框架简介 、 MyBatis基本应用

    Unit07: MyBatis框架简介 . MyBatis基本应用 1. myBatis (1)myBatis是什么? 是一个开源的持久层框架. 注:myBatis底层仍然是jdbc. (2)编程步骤 ...

  9. C++中const使用注意要点(一)

    最近看<C++编程思想>发现自己的基础确实不牢固,也想起了以前写代码时也因为const的事情浪费过时间,这里总结下几个要点. 首先说下内部链接和外部链接. 当一个cpp文件在编译时,预处理 ...

  10. 兼顾FPGA和单片机

    当今,FPGA和单片机的应用非常广泛,在有FPGA知识的基础上,笔者认为可以把FPGA作为主要的学习目标,单片机作为辅助技能.其实二者是相互促进的.不管是FPGA还是单片机的开发其实都是基于较强的逻辑 ...