Oracle Linux 5.5 (64bit)安裝Oracle 11g R2 RAC圖文超詳細教程

來源:互聯網
上載者:User

Oracle Linux 5.5 (64bit)安裝Oracle 11g R2 RAC圖文超詳細教程

1.安裝前的準備:
作業系統:Oracle Linux 5.5 64bit
叢集軟體:GI 11.2.0.1
資料庫:database rdbms 11.2.0.1
 2.資源準備:
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
 oracleasmlib-2.0.4-1.el5.x86_64.rpm
 oracleasm-support-2.1.7-1.el5.x86_64.rpm
 openfiler
 3.作業系統安裝:
DNS server:domain name
 db server:rac1 rac2
 storage server:openfiler
 4.IP地址規劃:
DNS server:192.168.192.168
 db node1:192.168.192.169 public
          192.168.192.171 VIP   
          10.0.0.1 private
 db node2:192.168.192.170 public
          192.168.192.172 VIP
          10.0.0.2 private
 scan: 192.168.192.173
        192.168.192.174
        192.168.192.175
5.我們先配置DNS,DNS是什麼我就不多說了,這裡主要的作用在於引入一個新的特性,11g R2後引入SCAN IP的概念,就是在用戶端和資料庫之間增加一層虛擬網路服務層,即是SCAN IP和SCAP IP Listener。在用戶端的tnsnames.ora設定檔中,只需要配置SCAN IP的配置資訊即可,用戶端通過SCAN IP、SCAN IP Listener來訪問資料庫。同之前各版本的RAC相比,使用SCAN IP的好處就是,當後台RAC資料庫添加、刪除節點時,用戶端配置資訊無需修改。可以通過配置DNS伺服器或GNS來配置SCAN,我們這裡以DNS為例來進行配置。
6.安裝DNS伺服器
# rpm -ivh bind-9.3.6-4.P1.el5_4.2.x86_64.rpm
# rpm -ivh bind-chroot-9.3.6-4.P1.el5_4.2.x86_64.rpm
# rpm -ivh caching-nameserver-9.3.6-4.P1.el5_4.2.x86_64.rpm
配置主地區
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory      "/var/named";
        dump-file      "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";


        allow-query    { any; };
        allow-query-cache { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.zones";
};
配置Zone檔案,修改/var/named/chroot/etc/named.rfc1912.zones檔案
添加如下:
zone "192.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.192.in-addr.arpa";
        allow-update { none; };
};


再配置DNS正反向解析檔案
/var/named/chroot/var/named 目錄下
 vi localdomain.zone ,配置為
$TTL    86400
@              IN SOA  localhost root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M            ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS          localhost
localhost      IN A            127.0.0.1
scan-cluster    IN A            192.168.192.173(這裡是配置scan-ip)

vi 192.168.168.in-addr-arpa(這個自己產生一個就行)
$TTL    86400
@      IN      SOA    localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      localhost.
1      IN      PTR    localhost.
173    IN      PTR    scan-cluster.localdomain.(這裡配置san IP)
啟動DNS服務
[root@dns named]# /etc/init.d/named status
number of zones: 1
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
named (pid  18907) is running..
再對rac的兩個節點分別修改/etc/resolv.conf
search localdomain
nameserver 192.168.192.168
我們完成DNS的配置了!!!!

7.配置hosts檔案在兩個節點上配置
[root@rac1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1              localhost.localdomain localhost
192.168.192.169        rac1.xupeng.com rac1
192.168.192.170        rac2.xupeng.com rac2
10.0.0.1                rac1-priv.xupeng.com rac1-priv
10.0.0.2                rac2-priv.xupeng.com rac2-priv
192.168.192.171        rac1-vip.xupeng.com rac1-vip
192.168.192.172        rac2-vip.xupeng.com rac2-vip

8.安裝oracle 11g所需要的環境包
這個看你自己怎麼裝了,有的人選擇全包安裝(在裝作業系統的時候),有的喜歡手動安裝oracle 需要的包,這個就無所謂了,我這裡用YUM源,哈哈。。。。
此操作在兩個節點上進行
[root@rac1 ~]# vi /etc/yum.repos.d/my.repo
[Oracle]
name=OEL-$releasever - Media
baseurl=file:///mnt/Server
gpgcheck=0
enable=1
[root@rac1 ~]# yum -y install compat-libstdc++-33 elfutils-libelf-devel gcc  gcc-c++ glibc-devel glibc-headers libaio-devel  libstdc++-devel  sysstat  unixODBC unixODBC-devel

9.參數配置
以下操作需在兩個節點上進行配置
[root@rac1 ~]# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 4294967295
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
使核心參數生效,sysctl -p 這些配置都和安裝單一實例是一樣的

[root@rac1 ~]# vi /etc/security/limits.conf
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384

[root@rac1 ~]# vi /etc/pam.d/login
session    required    /lib64/security/pam_limits.so

10.添加使用者和組以及oracle、grid使用者ssh的對等性
以下操作需要兩個節點同樣進行
groupadd -g 1000 oinstall
groupadd -g 1300 dba
groupadd -g 1301 oper
groupadd -g 1201 asmdba
groupadd -g 1200 asmadmin
groupadd -g 1202 asmoper
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid
passwd grid
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
passwd oracle
設定互信關係,這裡記住oracle和grid使用者都要設定互信
su - grid
mkdir ~/.ssh
 ssh-keygen -t rsa
 ssh-keygen -t dsa
以下操作在一個節點上執行即可
cat ~/.ssh/id_rsa.pub>>./.ssh/authorized_keys  --公開金鑰存在authorized_keys檔案中,寫到本機
cat ~/.ssh/id_dsa.pub>>./.ssh/authorized_keys
 ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys  --第二個節點的公開金鑰寫到本機
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
 scp ~/.ssh/authorized_keys secdb2:~/.ssh/authorized_keys
兩個節點上分別驗證
ssh rac1 date
 ssh rac2 date
 ssh rac1-priv date
 ssh rac2-priv date

 11.建立目錄和授權
 以下操作需要在兩個節點同樣進行
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

 12.環境變數
 如下操作也需要在兩個節點上同樣進行,這裡需要注意的是grid使用者的SID和oracle使用者的SID,是不一樣的,這裡大家明白原理的話就不會出錯
[root@rac1 ~]# su - grid
 [grid@rac1 ~]$ less .bash_profile
 # .bash_profile
 # Get the aliases and functions
 if [ -f ~/.bashrc ]; then
        . ~/.bashrc
 fi
 # User specific environment and startup programs
 PATH=$PATH:$HOME/bin
 ORACLE_SID=+ASM1; export ORACLE_SID
 JAVA_HOME=/usr/local/java;export JAVA_HOME
 ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
 ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
 ORACLE_PATH=/u01/app/oracle/common/oracle/sql; export ORACLE_PATH
 ORACLE_TERM=xterm;export ORACLE_TERM
 NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";export NLS_DATE_FORMAT
 TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
 ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
 PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
 PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
 PATH=${PATH}:/u01/app/common/oracle/bin
 export PATH
 LD_LIBRARY_PATH=$ORACLE_HOME/lib
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
 export LD_LIBRARY_PATH
 CLASSPATH=$ORACLE_HOME/JRE
 CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
 CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
 CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
 export CLASSPATH
 THREADS_FLAG=native; export THREADS_FLAG
 export TEMP=/tmp
 export TMPDIR=/tmp
 export NLS_LANG=american_america.ZHS16GBK
 alias sqlplus="rlwrap sqlplus"
 umask 022

 [grid@rac1 ~]$ su - oracle
 Password:
 [oracle@rac1 ~]$ less .bash_profile
 # .bash_profile
 # Get the aliases and functions
 if [ -f ~/.bashrc ]; then
        . ~/.bashrc
 fi
 # User specific environment and startup programs
 PATH=$PATH:$HOME/bin
 ORACLE_SID=test1; export ORACLE_SID
 ORACLE_UNQNAME=test; export ORACLE_UNQNAME
 JAVA_HOME=/usr/local/java; export JAVA_HOME
 ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
 ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
 ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH
 ORACLE_TERM=xterm; export ORACLE_TERM
 NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
 TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
 ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
 PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
 PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
 PATH=${PATH}:/u01/app/common/oracle/bin
 export PATH
 LD_LIBRARY_PATH=$ORACLE_HOME/lib
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
 export LD_LIBRARY_PATH
 CLASSPATH=$ORACLE_HOME/JRE
 CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
 CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
 CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
 export CLASSPATH
 THREADS_FLAG=native; export THREADS_FLAG
 export TEMP=/tmp
 export TMPDIR=/tmp
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 umask 022

 13.openfiler來劃分儲存空間
 這個軟體挺好用的,在vmware環境下安裝,其實就是個linux系統,我們建立vmdisk就行了。配置登陸一個網頁https://ip:446

我這裡已經劃分好了,看圖就行了,至於openfiler的配置大家應該可以自學一下,非常簡單屬於看圖點滑鼠的那種,英文稍微好點的同學能搞定

14.分別在兩個rac節點上配置ISCSI
 [root@rac1 ~]# yum -y install iscsi-initiator-utils
 [root@rac1 ~]#  service iscsid start
[root@rac1 ~]# chkconfig iscsid on
[root@rac1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.192.111
添加iscsi磁碟:
[root@rac1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.4849d1d582bc -p 192.168.192.111 –l
以下操作rac其中一個節點進行:
[root@rac1 ~]# fdisk /dev/sdb 以此類推我這裡需要格式化3個磁碟!!!
 完成後我們查看一下,通過fdisk -l
 [root@rac1 ~]# fdisk -l
 Disk /dev/sda: 32.2 GB, 32212254720 bytes
 255 heads, 63 sectors/track, 3916 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start        End      Blocks  Id  System
 /dev/sda1  *          1          25      200781  83  Linux
 /dev/sda2              26        547    4192965  82  Linux swap / Solaris
 /dev/sda3            548        3916    27061492+  83  Linux
 Disk /dev/sdb: 2113 MB, 2113929216 bytes
 66 heads, 62 sectors/track, 1008 cylinders
 Units = cylinders of 4092 * 512 = 2095104 bytes

    Device Boot      Start        End      Blocks  Id  System
 /dev/sdb1              10        1008    2043954  83  Linux

 Disk /dev/sdc: 2113 MB, 2113929216 bytes
 66 heads, 62 sectors/track, 1008 cylinders
 Units = cylinders of 4092 * 512 = 2095104 bytes

    Device Boot      Start        End      Blocks  Id  System
 /dev/sdc1              10        1008    2043954  83  Linux

 Disk /dev/sdd: 8556 MB, 8556380160 bytes
 64 heads, 32 sectors/track, 8160 cylinders
 Units = cylinders of 2048 * 512 = 1048576 bytes

    Device Boot      Start        End      Blocks  Id  System
 /dev/sdd1              10        8160    8346624  83  Linux
到另一個節點上
 輸入partprobe即可,查看fdisk -l和其它節點的一致!!

更多詳情見請繼續閱讀下一頁的精彩內容:

  • 1
  • 2
  • 3
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.