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

Oracle Linux 5.5 (64bit)安装Oracle 11g R2 RAC图文超详细教

我这里已经划分好了,看图就行了,至于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和其它节点的一致!!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/47b39b38eb025631b7f187542576766a.html