日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

oracle运行环境配置,oracle 环境配置开机自启动

發(fā)布時(shí)間:2024/8/23 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle运行环境配置,oracle 环境配置开机自启动 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

環(huán)境:centos 6.5 + oracle 11g

自啟動(dòng)之前問(wèn)題

虛擬機(jī)里的oracle環(huán)境,每次重啟完系統(tǒng),用plsql developer連接,先是報(bào)錯(cuò):

無(wú)TNS監(jiān)聽(tīng)程序

解決方法是切換到系統(tǒng)的oracle用戶,執(zhí)行l(wèi)snrctl start,但是執(zhí)行之前,因?yàn)镺RACLE_HOME環(huán)境變量沒(méi)有生效,還要是環(huán)境變量文件生效,步驟如下:

[oracle@localhost ~]$source .bash_profile

[oracle@localhost ~]$echo $ORACLE_HOME

/home/oracle/app/oracle/product/11.2.0/dbhome_1

[oracle@localhost ~]$lsnrctl start

啟動(dòng)完成后,再次連接,又報(bào)錯(cuò):

oracle沒(méi)有啟動(dòng)。啟動(dòng)步驟如下:

[oracle@localhost ~]$ sqlplus /nolog

sql*Plus: Release 11.2.0.1.0 Production on Wed Oct 19 14:29:10 2016

Copyright (c) 1982,2009,Oracle. All rights reserved.

sql> conn / as sysdba

Connected to an idle instance.

sql> startup

ORACLE instance started.

Total System Global Area 776646656 bytes

Fixed Size 2217384 bytes

Variable Size 490736216 bytes

Database Buffers 281018368 bytes

Redo Buffers 2674688 bytes

Database mounted.

Database opened.

配置自啟動(dòng)

下面把上述過(guò)程都配置成開(kāi)機(jī)啟動(dòng)。

環(huán)境變量生效

可能是因?yàn)槲业膐racle用戶不是桌面登錄的,是從終端su切換過(guò)來(lái)的,.bash_profile文件沒(méi)有運(yùn)行。我把文件里的內(nèi)容寫入.bashrc文件后,重啟就可以了。

TNS監(jiān)聽(tīng)以及oracle服務(wù)自啟動(dòng)

編輯: /etc/oratab文件,把最后一行的N改成Y

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

#

#

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

路徑可能不同

編輯 /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

service smb restart

su - oracle -c 'lsnrctl start'

su - oracle -c 'dbstart'

su - oracle -c 'emctl start dbconsole'

dbstart是數(shù)據(jù)庫(kù)自帶的啟動(dòng)腳本,我們只要加到rc.local中讓它開(kāi)機(jī)調(diào)用就可以了。但是還需要編輯一下它。修改dbstart的ORACLE_HOME_LISTNER,使其指向$ORACLE_HOME:

# First argument is used to bring up OracleNet Listener

ORACLE_HOME_LISTNER=$ORACLE_HOME

重啟虛擬機(jī),發(fā)現(xiàn)plsql developer可以直接連接上了。

總結(jié)

以上是生活随笔為你收集整理的oracle运行环境配置,oracle 环境配置开机自启动的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。