佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > centos 6.5下安裝oracle 11gR2與Oracle自動啟動的配置

centos 6.5下安裝oracle 11gR2與Oracle自動啟動的配置

熱門標(biāo)簽:網(wǎng)站排名優(yōu)化 百度競價(jià)排名 鐵路電話系統(tǒng) 地方門戶網(wǎng)站 AI電銷 服務(wù)外包 呼叫中心市場需求 Linux服務(wù)器

注意:以下命令使用 root 用戶操作

安裝依賴包

主要思路為配置 oracle yum 倉庫,直接使用 yum 命令來安裝依賴包,避免手工逐個(gè)的安裝依賴包。

配置 yum 倉庫以下載 orcale 依賴包

注意:這里是CentOS 6.X 的 oracle 依賴倉庫,其他版本不同的。

導(dǎo)入 GPG Keys

wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle --no-check-certificate

安裝 oracle 依賴

yum install oracle-rdbms-server-11gR2-preinstall

設(shè)置 hostname

打開文件 /etc/sysconfig/network,并修改 HOSTNAME。

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oracle.buzheng.org

打開 /etc/host, 添加服務(wù)器本機(jī)IP地址 指向到 HOSTNAME

vi /etc/hosts
192.168.1.15 oracle.buzheng.org oracle

oracle 用戶設(shè)置

當(dāng)安裝好 oracle 依賴之后, oracle 用戶已經(jīng)創(chuàng)建好了,不需要手工創(chuàng)建 oracle 用戶和相關(guān)的用戶組。

修改 oracle 用戶密碼

[root@oracle ~]# passwd oracle
更改用戶 oracle 的密碼 。
新的 密碼:
重新輸入新的 密碼:
passwd: 所有的身份驗(yàn)證令牌已經(jīng)成功更新。

修改系統(tǒng)限制

在文件 /etc/security/limits.d/90-nproc.conf 中添加如下的最后一行

[root@oracle ~]# vi /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
*   soft nproc  1024
root  soft nproc  unlimited
*   -  nproc  16384

修改 SELinux 為 permissive 模式

修改文件 /etc/selinux/config 如下所示

[root@oracle ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#  enforcing - SELinux security policy is enforced.
#  permissive - SELinux prints warnings instead of enforcing.
#  disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
#  targeted - Targeted processes are protected,
#  mls - Multi Level Security protection.
SELINUXTYPE=targeted

重啟機(jī)器

[root@oracle]# reboot

創(chuàng)建 oracle 安裝目錄,并授權(quán)

[root@oracle]# mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
[root@oracle]# chown -R oracle:oinstall /u01
[root@oracle]# chmod -R 775 /u01

授權(quán) oracle 用戶能夠訪問 X Server

[root@oracle]# xhost + # 要在主機(jī)上運(yùn)行,不能是遠(yuǎn)程 shell

注意:以下命令使用 oracle 用戶操作

配置 oracle 安裝環(huán)境變量

切換到 oracle 用戶, 編輯 .bash_profile 文件, 如下所示, 添加環(huán)境配置。

[root@oracle]# su oracle
[oracle@oracle]# vi .bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=oracle.buzheng.org; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH export PATH

下載 oracle 安裝文件,解壓縮后安裝

下載 oracle

打開 oracle 下載頁面,http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html , 下載下面兩個(gè)文件到 /home/oracle

linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

解壓縮文件并運(yùn)行

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
cd database
./runInstaller

若為中文系統(tǒng),安裝界面會出現(xiàn)中文亂碼,需要先將環(huán)境變?yōu)橛⑽?,在安裝

export LANG=en_US
./runInstaller

沒有截圖, 安裝步驟大致包括以下幾步:

  1. Create and configure a database
  2. Server Class
  3. Single instance database installation
  4. Advanced install
  5. Language: English
  6. Enterprise Edition
  7. database type: General Purpose / Transaction Processing
  8. Memory: Enable Automatic Memory Management
  9. Character sets: Use Unicode(AL32UTF8)

圖性界面安裝最后會提示以ROOT 執(zhí)行下面兩個(gè)腳本

[root@oracle ~]# /u01/app/oraInventory/orainstRoot.sh 
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oracle ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh 
Running Oracle 11g root.sh script...
The following environment variables are set as:
 ORACLE_OWNER= oracle
 ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: 
 Copying dbhome to /usr/local/bin ...
 Copying oraenv to /usr/local/bin ...
 Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

出現(xiàn)的問題

1, 當(dāng)環(huán)境變量中的 ORACLE_SID 與 安裝時(shí)實(shí)際配置不一致時(shí),會導(dǎo)致 startup 出錯,出錯信息如下:

ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initDB11G.ora'

2, 如果遠(yuǎn)程客戶端連接是報(bào)錯:ora-12514 tns 監(jiān)聽程序當(dāng)前無法識別連接描述符中請求的服務(wù),則需要配置 listener.ora,添加如下節(jié)點(diǎn):

SID_LIST_LISTENER = 
 (SID_LIST= 
 (SID_DESC =
  (SID_NAME = orcl)
  (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
 )
 )

好了,到此已經(jīng)安裝完成,通過訪問 web 管理界面可驗(yàn)證。下面步驟也很重要,請繼續(xù)。

注意:以下命令使用 root 用戶操作

配置防火墻規(guī)則,開放偵聽端口

將 1521(你配置的 oracle 偵聽端口) 端口添加到防火墻規(guī)則,以便遠(yuǎn)程用戶能順利的訪問到 oracle 服務(wù)。

iptables -I INPUT 4 -m state --state NEW -p tcp --dport 1521 -j ACCEPT
service iptables save
service iptables reload

設(shè)置 oracle 自動啟動

完成 oracle 安裝后,我們可以通過命令啟動停止數(shù)據(jù)庫,但是當(dāng)機(jī)器重啟時(shí)并不能隨機(jī)器啟動,這也給我們帶來了一些不便,下面記錄了,如何將 oralce 加入服務(wù)中,并隨機(jī)機(jī)器啟動。

修改配置文件 /etc/oratab

修改 /etc/oratab 的最后一行的最后一個(gè)字符,將 N 修改為 Y。此舉主要是為了使 oracle 的 dbstart 命令能在系統(tǒng)啟動時(shí)能運(yùn)行。如下所示:

[root@oracle ~]# vi /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: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.2.0/dbhome_1:Y

創(chuàng)建 /etc/init.d/oracle

在 /etc/init.d/下創(chuàng)建文件 oracle,此為 oracle 自啟動腳本。內(nèi)容如下:

#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g R2 AutoRun Servimces
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f "$ORACLE_HOME/bin/dbstart" ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# parameter: start, stop, restart
case "$1" in
start)
# Oracle listener and instance startup
su $ORA_OWNR -s /bin/bash $ORACLE_HOME/bin/dbstart $ORACLE_HOME
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -s /bin/bash $ORACLE_HOME/bin/dbshut $ORACLE_HOME
echo "Oracle Stop Succesful!OK."
;;
restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|restart}"
exit 1
esac
exit 0

賦予啟動腳本執(zhí)行權(quán)限并鏈接好:

# chmod 750 /etc/init.d/oracle
# ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle
# ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle

啟動腳本設(shè)置好了之后,可以使用 service 命令來啟動停止 oracle 了,這時(shí)候 oracle 已經(jīng)是系統(tǒng)服務(wù)了。

service oracle start
service oracle stop
service oracle restart

設(shè)置 oracle 服務(wù)為自啟動

# chkconfig --add oracle
# chkconfig --level 345 oracle on

總結(jié)

好了,重啟機(jī)器試試吧。以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流。

您可能感興趣的文章:
  • centos7下安裝oracle11gR2的詳細(xì)步驟
  • Linux下安裝Oracle(CentOS-Oracle 12c)的方法
  • CentOS命令行下裝oracle 12c的方法(命令行模式安裝)
  • CentOS系統(tǒng)上安裝配置Oracle數(shù)據(jù)庫的詳細(xì)教程
  • CentOS下PHP安裝Oracle擴(kuò)展
  • CentOS6.2上安裝Oracle10g報(bào)ins_emdb.mk錯誤處理方法
  • CentOS 6.3下安裝部署Oracle服務(wù)器圖文教程
  • Linux+php+apache+oracle環(huán)境搭建之CentOS下安裝Oracle數(shù)據(jù)庫
  • Linux+php+apache+oracle環(huán)境搭建之CentOS下源碼編譯安裝PHP
  • centos下Oracle11G圖文安裝教程

標(biāo)簽:黃山 衡水 崇左 湖南 銅川 仙桃 湘潭 蘭州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《centos 6.5下安裝oracle 11gR2與Oracle自動啟動的配置》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    广河县| 闻喜县| 桐乡市| 陇南市| 平武县| 喀喇| 缙云县| 合水县| 宜昌市| 富裕县| 高碑店市| 驻马店市| 二连浩特市| 三明市| 高邑县| 巴中市| 乌拉特中旗| 宁城县| 雷山县| 阜城县| 无棣县| 黄梅县| 咸丰县| 永城市| 海阳市| 上犹县| 汶上县| 出国| 大关县| 遂川县| 青阳县| 介休市| 松潘县| 涡阳县| 河西区| 泸州市| 新兴县| 石渠县| 奎屯市| 泰州市| 会昌县|