在Centos 6.5上安裝Oracle Database 11g Release 2 (11.2.0.4.0) RAC

djnh發表於2016-05-20

 


1   簡介

Oracle 11g rac 基本結構如下圖所示:

 

2   Oracle安裝前準備工作

執行自動設定或手動設定完成基本的先決條件。完成所有安裝所需的附加設定。

 

2.1 準備軟體包

Oracle 11g Release 2 (11.2.0.4) Software (64 bit)

2.2 自動設定(需要網際網路)

 

按照http://public-yum.oracle.com 的說明安裝Oracle  yum庫,然後執行下面的命令。

 

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

2.3 手動設定

2.3.1    Centos 6.5的安裝光碟上安裝以下包

# From Centos 6 DVD

cd /media/cdrom/Server/Packages

#rpm -Uvh binutils-2.*

#rpm -Uvh compat-libstdc++-33*

#rpm -Uvh elfutils-libelf-0.*

#rpm -Uvh libaio-0.*

rpm -Uvh libaio-devel-0.*

#rpm -Uvh sysstat-9.*

#rpm -Uvh glibc-2.*

#rpm -Uvh glibc-common-2.*

#rpm -Uvh glibc-devel-2.* glibc-headers-2.*

rpm -Uvh ksh-2*

#rpm -Uvh make-3.*

#rpm -Uvh libgcc-4.*

#rpm -Uvh libstdc++-4.*

rpm -Uvh libstdc++-4.*.i686*

#rpm -Uvh libstdc++-devel-4.*

#rpm -Uvh gcc-4.*x86_64*

#rpm -Uvh gcc-c++-4.*x86_64*

#rpm -Uvh --allfiles elfutils-libelf-0*x86_64* elfutils-libelf-devel-0*x86_64*

rpm -Uvh elfutils-libelf-0*i686* elfutils-libelf-devel-0*i686*

rpm -Uvh libtool-ltdl*i686*

rpm -Uvh ncurses*i686*

rpm -Uvh readline*i686*

rpm -Uvh unixODBC*

cd /

eject

 

2.3.2     "/etc/sysctl.conf" 檔案中增加:

fs.aio-max-nr = 1048576

fs.file-max = 6815744

#kernel.shmall = 2097152

#kernel.shmmax = 1054504960

kernel.shmmni = 4096

# semaphores: semmsl, semmns, semopm, semmni

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048586

 

2.3.3    執行命令使核心引數生效

/sbin/sysctl –p

 

2.3.4     "/etc/security/limits.conf" 檔案中增加:

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  4096

oracle              hard    nofile  65536

oracle              soft    stack   10240

 

grid              soft    nproc   2047

grid              hard    nproc   16384

grid              soft    nofile  4096

grid              hard    nofile  65536

grid              soft    stack   10240

 "/etc/pam.d/login" 檔案中增加:

session    required     pam_limits.so

2.3.5    建立使用者和組:

groupadd -g 54321 oinstall

groupadd -g 54322 dba

useradd -u 54321 -g oinstall -G dba oracle

useradd -u 54322 -g oinstall -G dba grid

2.4 額外的設定

2.4.1    設定 "oracle" 使用者的密碼.

passwd oracle

2.4.2    設定 "grid" 使用者的密碼.

passwd grid

 

2.4.3    oracle安裝介質上安裝rpm

cd /your/path/to/grid/rpm

rpm -Uvh cvuqdisk*

 

2.4.4    修改hostname

編輯"/etc/sysconfig/network" 檔案,第二個節點改成rac-node2

NETWORKING=yes

HOSTNAME=rac-node1

輸入命令

hostname rac-node1

 

2.4.5    如果沒有DNS"/etc/hosts" 檔案中增加:

127.0.0.1       localhost.localdomain   localhost

# Public

10.115.1.165   rac-node1

10.115.1.166   rac-node2

# Private

192.168.1.111   rac-node1-priv

192.168.1.112   rac-node2-priv

# Virtual

10.115.1.213   rac-node1-vip

10.115.1.214   rac-node2-vip

# SCAN

10.115.1.215   rac-scan

10.115.1.216   rac-scan

10.115.1.217   rac-scan

 

2.4.6    關閉 SELinux, 修改 "/etc/selinux/config" 檔案

SELINUX=disabled

2.4.7    關閉防火牆

# service iptables stop

# chkconfig iptables off

 

2.4.8    關閉ntp服務

# service ntpd stop

Shutting down ntpd:                                        [  OK  ]

# chkconfig ntpd off

# mv /etc/ntp.conf /etc/ntp.conf.orig

# rm /var/run/ntpd.pid

 

2.4.9    建立安裝目錄

mkdir -p /g01/app/orabase

mkdir -p /g01/app/grid/product/11.2.0/grid_1

mkdir -p /u01/app/oracle/product/11.2.0/db_1

chown -R oracle:oinstall /u01

chown -R grid:oinstall /g01

chmod -R 775 /u01

 

2.4.10  登入grid使用者,修改 "/home/grid/.bash_profile" 檔案

# grid

ORACLE_BASE=/g01/app/orabase; export ORACLE_BASE

ORACLE_HOME=/g01/app/grid/product/11.2.0/grid_1; export ORACLE_HOME

ORACLE_SID=+ASM1; export ORACLE_SID  #+ASM1第二個節點改成+ASM2

PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH

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

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

ulimit -u 16384 -n 65536

 

 

 

2.4.11  登入oracle使用者,修改 "/home/oracle/.bash_profile" 檔案

# oracle

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME

ORACLE_SID=ODS1; export ORACLE_SID   # ODS1第二個節點改成ODS2

PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH

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

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

ulimit -u 16384 -n 65536

 

2.4.12  檢視有幾塊共享磁碟

# cd /dev

# ls sd*

sda  sda1  sda2  sdb  sdc  sdd  sde  sdf

#

 

2.4.13  配置UDEV配置檔案繫結磁碟

for i in b c d e f;

do

echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"dba\", MODE=\"0660\""      >> /etc/udev/rules.d/99-oracle-asmdevices.rules

done

# /sbin/start_udev

2.4.14  檢視繫結後的磁碟

# ls -al /dev/asm*

 

2.4.15  測試網路

ping -c 3 rac-node1

ping -c 3 rac-node1-priv

ping -c 3 rac-node2

ping -c 3 rac-node2-priv

 

3   安裝 Grid Infrastructure

$ unzip grid.zip

$ cd grid

$ ./runInstaller

選擇 "Skip software updates" 選項, 然後點選 "Next" 按鈕.

選擇 "Install and Configure Oracle Grid Infrastructure for a Cluster" 選項, 然後點選 "Next" 按鈕.

選擇 "Typical Installation" 選項, 然後點選 "Next" 按鈕.

 "Specify Cluster Configuration" 介面, 輸入ods-scan 然後點選 "Add" 按鈕.

輸入第二個節點的資訊, 然後點 "OK" 按鈕.

點選 "SSH Connectivity..." 按鈕 然後輸入"grid" 使用者的密碼. 點選 "Setup" 按鈕配置 SSH connectivity,然後點選 "Test"測試.

點選 "Identify network interfaces..." 按鈕然後檢查 public and private 網路是正確的.

輸入 ASM 密碼, 選擇 "dba" 組然後點選 "Next" 按鈕.

設定 redundancy  "External", 點選 "Change Discovery Path" 按鈕然後設定路徑為 "/dev/asm*". 返回主視窗選擇所有盤然後點選 "Next" 按鈕.

選擇預設的 inventory directory 然後點選 "Next" 按鈕.

先等待檢查完成。如果有任何問題,修正或選中 "Ignore All" 核取方塊並單擊“Next”按鈕。

點選 "Install" 按鈕.

等待安裝完成.

當提示時,在每個節點上用root使用者執行配置指令碼.

執行 "orainstRoot.sh" 指令碼。

# cd /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.sh" 指令碼。

第一個節點

# ./root.sh
Performing root user operation for Oracle 11g 
 
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/11.2.0/grid
 
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 script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
OLR initialization - successful
  root wallet
  root wallet cert
  root cert export
  peer wallet
  profile reader wallet
  pa wallet
  peer wallet keys
  pa wallet keys
  peer cert request
  pa cert request
  peer cert
  pa cert
  peer root cert TP
  profile reader root cert TP
  pa root cert TP
  peer pa cert TP
  pa peer cert TP
  profile reader pa cert TP
  profile reader peer cert TP
  peer user cert
  pa user cert
Adding Clusterware entries to upstart
CRS-2672: Attempting to start 'ora.mdnsd' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.mdnsd' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.gpnpd' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'ol6-112-rac1'
CRS-2672: Attempting to start 'ora.gipcd' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.cssdmonitor' on 'ol6-112-rac1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'ol6-112-rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.diskmon' on 'ol6-112-rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'ol6-112-rac1' succeeded
 
ASM created and started successfully.
 
Disk Group DATA created successfully.
 
clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 0a287fd11ac74f59bf2edb0bd6d260e5.
Successfully replaced voting disk group with +DATA.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   0a287fd11ac74f59bf2edb0bd6d260e5 (/dev/asm-disk1) [DATA]
Located 1 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.asm' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.DATA.dg' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.DATA.dg' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.registry.acfs' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.registry.acfs' on 'ol6-112-rac1' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
#

 

第二個節點

# ./root.sh
Performing root user operation for Oracle 11g 
 
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/11.2.0/grid
 
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 script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
OLR initialization - successful
Adding Clusterware entries to upstart
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node ol6-112-rac1, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
#

 

執行完指令碼, 返回 "Execute Configuration Scripts" 介面然後點選 "OK" 按鈕.

等待 configuration assistants 完成.

 

如果沒有DNS, 驗證階段會報SCAN的失敗與錯誤.

INFO: Checking Single Client Access Name (SCAN)...

INFO: Checking name resolution setup for "rac-scan.localdomain"...

INFO: ERROR:

INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan.localdomain"

INFO: ERROR:

INFO: PRVF-4657 : Name resolution setup check for "rac-scan.localdomain" (IP address: 192.168.2.201) failed

INFO: ERROR:

INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan.localdomain"

INFO: Verification of SCAN VIP and Listener setup failed

忽略這些錯誤然後點選 "Next" 按鈕.

點選 "Close" 按鈕退出安裝程式.

grid infrastructure 安裝完成.

4   安裝 Database

$ unzip database.zip

$ cd database

$ ./runInstaller

取消勾選檢查安全更新核取方塊並單擊 "Next" 按鈕,警告對話方塊選擇 "Yes"

選擇 "Skip software updates" 核取方塊,並單擊 "Next" 按鈕。

選擇“Create and configure a database”選項然後單擊 "Next" 按鈕。

選擇 "Server Class" 選項然後單擊 "Next" 按鈕.

確保兩個節點被選中,然後單擊 "Next" 按鈕。

選擇 "Typical install" 選項然後點選 "Next" 按鈕。

 

儲存型別應設定為 "Automatic Storage Manager" 。輸入相應的密碼和資料庫名稱。

等待檢查完成。如果有任何問題,修復他們,或選中 "Ignore All" 核取方塊並單擊 "Next" 按鈕。

 

點選 "Install" 按鈕.

等待安裝完成。

Once 軟體安裝完成將自動進入資料庫建立介面。

當資料庫建立完成點選 "OK" 按鈕.

當提示執行指令碼時,在每個節點上用root使用者執行root.sh指令碼,然後單擊 "OK" 按鈕。

點選 "Close" 按鈕退出安裝程式。

RAC database 建立完成。

5   檢查 RAC 狀態

oracle使用者下輸入一下命令來檢查資料庫狀態。

$ srvctl config database -d RAC

Database unique name: RAC

Database name: RAC

Oracle home: /u01/app/oracle/product/11.2.0.3/db_1

Oracle user: oracle

Spfile: +DATA/RAC/spfileRAC.ora

Domain: localdomain

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Server pools: RAC

Database instances: RAC2,RAC1

Disk Groups: DATA

Mount point paths:

Services:

Type: RAC

Database is administrator managed

$

 

$ srvctl status database -d RAC

Instance RAC1 is running on node ol6-112-rac1

Instance RAC2 is running on node ol6-112-rac2

$

 

 

 

 

 

本文件只作為快捷安裝指導,進一步的內容,請查閱oracle官方文件。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12252168/viewspace-2103923/,如需轉載,請註明出處,否則將追究法律責任。

相關文章