完整的实验是包括rac+data_guard;
环境:oracle linux 5.8_64
linux.x64_11gR2_databas
linux.x64_11gR2_grid
一、操作系统安装
二、在系统中创建本地的YUM 环境,看个人喜好,以为安装grid 和oracle 需要一些相关的rpm安装包;我这里创建了一个简单的Yum库,方便安装
#vim public-yum-el5.repo
填写下面的内容;
#oracle linux yum.repo
[local]
name=Oracle linux local yum
baseurl=file:///usr/local/yum/Server
gpgcheck=0
enabled=1
三、在Node1节点创建DNS ,创建DNS 为了实现各个节点的名称解析,实现的方法有多种,不搭建DNS也行,直接在/etc/hosts文件中添加也可以;创建过程很简单;贴出配置;
[root@node1 named]# hostname
node1.wenxi.com
[root@node1 named]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
#node1
192.168.75.10 node1.wenxi.com node1
192.168.75.11 node1-vip.wenxi.com node1-vip
192.168.137.10 node1-priv.wenxi.com node1-priv
#node2
192.168.75.20 node2.wenxi.com node2
192.168.75.21 node2-vip.wenxi.com node2-vip
192.168.137.11 node2-priv.wenxi.com node2-priv
#scan ip
192.168.75.30 scan-cluster.wenxi.com scan-cluster
######################################
确保 /etc/hosts文件的环回地址中不包含节点名(node1或 node2)。如果计算机名出现在环回地址条目中,如下所示:
127.0.0.1 node1localhost.localdomain localhost
需要将其删除,如下所示:
127.0.0.1 localhost.localdomain localhost
或者127.0.0.1 localhost 并把ip6信息注释掉,在DNS 的named.conf配置文件中也要把IPV6的相关信息注释掉
[root@node1 ~]# rpm -qa |grep bind
bind-devel-9.3.6-20.P1.el5
bind-utils-9.3.6-20.P1.el5
ypbind-1.19-12.el5_6.1
kdebindings-3.5.4-6.el5
bind-libs-9.3.6-20.P1.el5
bind-chroot-9.3.6-20.P1.el5
bind-9.3.6-20.P1.el5
[root@node1 etc]# pwd
/var/named/chroot/etc
[root@node1 etc]# cp -p named.caching-nameserver.conf named.conf
[root@node1 etc]# ls
localtime named.caching-nameserver.conf named.conf named.rfc1912.zones rndc.key
[root@node1 etc]#
root@node1 named]# ll
total 44
-rw-r----- 1 root named 558 May 9 20:10 75.168.192.in-addr.arpa.zone
drwxrwx--- 2 named named 4096 May 9 20:13 data
-rw-r----- 1 root named 198 Dec 20 2011 localdomain.zone
-rw-r----- 1 root named 195 Dec 20 2011 localhost.zone
-rw-r----- 1 root named 427 Dec 20 2011 named.broadcast
-rw-r----- 1 root named 1892 Dec 20 2011 named.ca
-rw-r----- 1 root named 424 Dec 20 2011 named.ip6.local
-rw-r----- 1 root named 426 Dec 20 2011 named.local
-rw-r----- 1 root named 427 Dec 20 2011 named.zero
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
-rw-r----- 1 root named 350 May 9 20:12 wenxi.com.zone
[root@node1 named]# named-checkconf /var/named/chroot/etc/named.conf
[root@node1 named]# named-checkzone wenxi.com /var/named/chroot/var/named/wenxi.com.zone
zone wenxi.com/IN: loaded serial 42
OK
[root@node1 named]# named-checkzone wenxi.com /var/named/chroot/var/named/75.168.192.in-addr.arpa.zone
zone wenxi.com/IN: loaded serial 1997022700
正向解析
OK
$TTL 86400
@ IN SOA wenxi.com. root.wenxi.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost
localhost IN A 127.0.0.1
node1 IN A 192.168.75.10
node2 IN A 192.168.75.20
scan-cluster IN A 192.168.75.30
反向解析
$TTL 86400
@ IN SOA wenxi.com. root.wenxi.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
10 IN PTR node1.wenxi.com.
20 IN PTR node2.wenxi.com.
30 IN PTR scan-cluster.wenxi.com.
测试都是通过的;
[root@node1 named]# nslookup node1.wenxi.com
Server: 192.168.75.10
Address: 192.168.75.10#53
Name: node1.wenxi.com
Address: 192.168.75.10
[root@node1 named]# nslookup node2.wenxi.com
Server: 192.168.75.10
Address: 192.168.75.10#53
Name: node2.wenxi.com
Address: 192.168.75.20
[root@node1 named]# nslookup 192.168.75.10
Server: 192.168.75.10
Address: 192.168.75.10#53
10.75.168.192.in-addr.arpa name = node1.wenxi.com.
[root@node1 named]# nslookup 192.168.75.20
Server: 192.168.75.10
Address: 192.168.75.10#53
20.75.168.192.in-addr.arpa name = node2.wenxi.com.
四,不要启动节点上的ntpd 时间服务,oracle rac 自带的有时间同步服务
#checkconfig ntpd off
#service ntpd stop
#mv /etc/ntp.conf /etc/ntp.conf.bak
五、建立集群软件、oracle rac的用户、口令和配置文件
1、在oraclerac 节点上为grid infrastructure操作系统组和用户
[root@racnode1 ~]# groupadd -g 1000oinstall
[root@racnode1 ~]# groupadd -g 1200asmadmin
[root@racnode1 ~]# groupadd -g 1201 asmdba
[root@racnode1 ~]# groupadd -g 1202 asmoper
[root@racnode1 ~]# groupadd -g 1300 dba
[root@racnode1 ~]# groupadd -g 1301 oper
[root@racnode1 ~]# useradd -m -u 1100 -goinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c"Grid Infrastructure Owner" grid
[root@racnode1 ~]# id grid
uid=1100(grid) gid=1000(oinstall)groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper)
设置 grid 帐户的口令:
[root@racnode1 ~]# passwd grid
Changing password for user grid.
New UNIX password: xxxxxxxxxxx
Retype new UNIX password: xxxxxxxxxxx
passwd: all authentication tokens updatedsuccessfully
[root@racnode1~]# useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s/bin/bash -c "Oracle Software Owner" oracle
[root@racnode1 ~]# id oracle
uid=1101(oracle) gid=1000(oinstall)groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)
设置 oracle 帐户的口令:
[root@racnode1 ~]# passwd oracle
Changing password for user oracle.
New UNIX password: xxxxxxxxxxx
Retype new UNIX password: xxxxxxxxxxx
passwd: all authentication tokens updatedsuccessfull
2、为grid oracle 用户设置环境变量
RACLE_SID=+ASM1; export ORACLE_SID
ORACLE_BASE=/u01/app/grid; exportORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; exportORACLE_HOME
NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMAT
PATH=$PATH:$HOME/bin
PATH=$ORACLE_HOME/bin:$PATH
export PATH
export TEMP=/tmp
export TMPDIR=/tmp
export
export EDITOR=vi
umask 022
node1》oracle
ORACLE_SID=racdb1; export ORACLE_SID
ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; exportORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;export ORACLE_HOME
NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMAT
PATH=$PATH:$HOME/bin
PATH=$ORACLE_HOME/bin:$PATH
export PATH
export TEMP=/tmp
export TMPDIR=/tmp
export
export EDITOR=vi
umask 022
3、创建目录,及修改权限:需要以 root用户身份在集群的两个 Oracle RAC 节点上完成此任务
[root@node1 ~]# cd /
[root@node1 /]# mkdir -p /u01/app/grid
[root@node1 /]# mkdir -p/u01/app/11.2.0/grid
[root@node1 /]# mkdir -p /u01/app/oracle
[root@node1 /]# chown -R grid:oinstall /u01
[root@node1 /]# chown oracle:oinstall/u01/app/oracle
[root@node1 /]# chmod -R 775 /u01
4、为 Oracle 软件安装用户设置资源限制在每个 Oracle RAC 节点上,在 /etc/security/limits.conf 文件中添加以下几行代码(下面的示例显示软件帐户所有者 oracle 和 grid)
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
5、在每个 Oracle RAC 节点上,在 /etc/pam.d/login 文件中添加或编辑下面一行内容、
session required pam_limits.so
6、根据的 shell 环境,对默认的 shell启动文件进行以下更改,以便更改所有 Oracle 安装所有者的 ulimit 设置(注意这里的示例显示 oracle 和 grid 用户):对于 Bourne、Bash 或 Korn shell,通过运行以下命令将以下行添加到 /etc/profile 文件:
[root@racnode1 ~]# cat >> /etc/profile <<EOF
if [ \$USER = "oracle" ] || [ \$USER = "grid" ];then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
7、配置内核参数
RHEL/OEL 5 上的 OracleDatabase 11g第 2 版需要如下所示的内核参数设置。给出的值都是最小值,因此如果您的系统使用更大的值,则不要更改。
kernel.shmmax = 4294967295
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
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=1048576
fs.aio-max-nr=1048576
RHEL/OEL 5 已经配置了为以下内核参数定义的默认值:
kernel.shmall = 4294967296
kernel.shmmax = 68719476736
如果这些默认值等于或大于必需值,则使用这些默认值。 默认值明显比必须值大,所以绿色的不用填写。
kernel.shmmax= 4294967295
kernel.shmall = 2097152
本文采用 Oracle Enterprise Linux 5 的全新安装,则已经设置了许多必需的内核参数(见上面)。如果是这样,您以root用户身份登录后,只需将以下内容命令复制/粘贴到两个 Oracle RAC 节点中: