资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

oracle如何自启动 oracle设置自动启动

如何在Linux中设置开机自动启动oracle

对于LINUX 操作系统 有很多技术知识是我们需要学习的。这里我就给大家介绍Linux中设置oracle开机自动启动的 方法 。一起来看看吧。

成都创新互联-专业网站定制、快速模板网站建设、高性价比玛曲网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式玛曲网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖玛曲地区。费用合理售后完善,十载实体公司更值得信赖。

Linux中设置oracle开机自动启动的方法

在terminal中切换到root用户

查看/etc/oratab文件的内容,其内容如下

[root@golonglee ~]# cat /etc/oratab | grep -v ^$

#

# 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.

#

#

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

使用命令vi /etc/oratab编辑文件/etc/oratab,在最后添加如下内容

##### what I have written is as following

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y

#####Finished wrote in 2015-12-24

说明:/home/oracle/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改。

(注意:图中我用红色标记的N要改成Y)

找到最后的内容

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

复制该行oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N并注释掉

粘贴该行,并将该行

oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N最后的N

改为Y

最后按2次ESC键,并输入:wq并按下enter保存,退出

使用命令vi /etc/rc.d/rc.local编辑rc.local文件,添加如下内容

##### what I have written is as following

su oracle -lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"

su oracle -lc /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

#####Finished wrote in 2015-12-24

说明:因为第一行命令中有空格所以用双引号(英文的双引号)

/home/oracle/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改。

最后按2次ESC键,并输入:wq并按下enter保存,退出,重启机器,验证成功。

是不是很简单呢~快跟着我一起学习吧!!!如果觉得这篇 文章 不错的话就给我点一个赞吧。

oracle开机自动启动方法

以redhat 和oracle g为例 安装过程参考官方文档 以下是实现oracle自启动的方法

配置dbstart和dbshut

在$ORACLE_HOME/bin中 有dbstart和dbshut这两个脚本 more dbstart看一下可以看到

QUOTE:

#

# $Id: dbstart sh pp may : : vikrkuma Exp $

# Copyright (c) Oracle All rights reserved

#

###################################

#

# usage: dbstart

#

# This is used to start ORACLE from /etc/rc( local)

# It should ONLY be executed as part of the system boot procedure

#

# This will start all databases listed in the oratab file

# whose third field is a Y If the third field is set to Y and

# there is no ORACLE_SID for an entry (the first field is a *)

# then this will ignore that entry

#

# This requires that ASM ORACLE_SID s start with a + and

# that non ASM instance ORACLE_SID s do not start with a +

#

# If ASM instances are to be started with this it cannot

# be used inside an rc* d directory and should be invoked from

# rc local only Otherwise the CSS service may not be available

# yet and this will block init from pleting the boot

# cycle

#

# Note:

# Use ORACLE_TRACE=T for tracing this

#

# The progress log for each instance bringup plus Error and Warning message[s]

# are logged in file $ORACLE_HOME/startup log The error messages related to

# instance bringup are also logged to syslog (system log module)

# The Listener log is located at $ORACLE_HOME_LISTNER/listener log

可以看出这个脚本是用来启动oracle服务的 包括listener instance a *** instances 并且可以放到/etc/rc( local) 同样dbshut也是起到关闭服务的作用

配置系统使这个脚本起作用

) 以root编辑/etc/oratab 类似 orcl:/u /product/ /db_ :N 这种格式 其中orcl是你的ORACLE_SID /u /product/ /db_ 是ORACLE_HOME 这里需要把N改为Y 即orcl:/u /product/ /db_ :Y这样

) 以oracle编辑$ORACLE_HOME/bin/dbstart 找到其中第 行:ORACLE_HOME_LISTNER=改为你自己的路径 或者可以改成ORACLE_HOME_LISTNER=$ORACLE_HOME

保存脚本 以oracle用户运行dbshut和dbstart看是否能关闭 启动数据库 如果不能 一般是参数设置 根据报错找到对应位置更改

把dbstart和dbshut加到redhat启动服务中

经过上一步的配置 可以直接用dbstart命令启动数据listener instance a *** instances 但是还没有启动oracle g的EM ORACLE利用web页面管理数据库相当方便 也是 g的一个特色 所以应该一并启动起该服务来

QUOTE:

$ORACLE_HOME/bin/emctl start dbconsole

因此我们可以用rc local或者redhat服务都可以实现要求的开机启动 下面分别说一下

) 利用rc local 直接把dbstart加到rc local中 实现开机自动启动 这里需要注意的是必须以oracle启动该脚本

用root编辑/etc/rc local 添加下面一行

QUOTE:

su oracle c /u /product/ /db_ /bin/dbstart

su oracle c /u /product/ /db_ /bin/emctl start dbconsole

这里/u /product/ /db_ 需要替换成实际的ORACLE_HOME

保存并退出后 reboot服务器测试一下 可以看到 当系统启动以后oracle监听 实例和em都已经起来了

) 如果我们不用rc local 也可以加到redhat服务中 在/etc/rc d/init d中添加如下脚本文件 命名为oracle

QUOTE:

#!/bin/sh

#cconfig:

#deion: ORACLE g Server

ORACLE_HOME=/u /product/ /db_

if [ ! f $ORACLE_HOME/bin/dbstart ]

then

echo ORACLE cannot start

exit

fi

case $ in

start )

echo Starting Oracle Database

su oracle c $ORACLE_HOME/bin/dbstart

su oracle c $ORACLE_HOME/bin/emctl start dbconsole

;;

stop )

echo Stoping Oracle Database

su oracle c $ORACLE_HOME/bin/emctl stop dbconsole

su oracle c $ORACLE_HOME/bin/dbshut

;;

esac

注意其中两行注释 网上很多脚本因为少了这两行不能使服务自启动

QUOTE:

#cconfig:

#deion: ORACLE g Server

其中cconfig 是指脚本将为运行级 启动oracle g服务 启动优先级为 关闭优先级为

然后以root权限:

QUOTE:

# cd /etc/rc d

# ln s /etc/rc d/init d/oracle S oracle

# cconfig list oracle

# cconfig level on

重启系统 就可以在启动的过程中看到 Starting oracle 因为我们设置的优先级为 一般是最后启动 [OK]以后就可以了 因为要启动emctl 可能有点慢 等待的时间要稍微长一点

lishixinzhi/Article/program/Oracle/201311/16863

oracle开机自启动

1) 建立用户, 组, 目录

[root@node1 ~]# id oracle

id: oracle: No such user

[root@node1 ~]# groupadd -g 54321 oinstall

[root@node1 ~]# groupadd -g 54322 dba

[root@node1 ~]# useradd -u 54321 -g oinstall -G dba oracle

[root@node1 ~]# passwd oracle

Changing password for user oracle.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

[root@node1 ~]# mkdir -p /u01/app/oracle

[root@node1 ~]# chown -R oracle:oinstall /u01/

2) 环境变量

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export ORACLE_SID=ora11g

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

LANG=C

3) Cat /etc/sysctl.conf

kernel.shmmax = 4294967295

kernel.shmall = 2097152

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default=1048576

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048576

fs.aio-max-nr=1048576

4) oracle 开机自启

[root@node1 ~]# cp /etc/init.d/network /etc/init.d/oracle

[root@node1 ~]# vim /etc/init.d/oracle

[root@node1 ~]# chmod +x /etc/init.d/oracle

[root@node1 ~]# chkconfig oracle on

[root@node1 ~]# cat /etc/init.d/oracle

[oracle@node1 auto_backup]$ cat /etc/init.d/oracle

#! /bin/bash#

chkconfig: 2345 10 90

#

Source function library.

. /etc/init.d/functions

# See how we were called.

case "$1" in

start)

su - oracle -c "/home/oracle/startdb11g"

;;

stop)

su - oracle -c "/home/oracle/stopdb11g"

;;

*)

echo #34;Usage: $0 {start|stop}"

exit 2

esac

exit $rc

[oracle@node1 auto_backup]$ chkconfig oracle on


本文名称:oracle如何自启动 oracle设置自动启动
网站路径:http://cdkjz.cn/article/hghpcj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220