Oracle 11gR2构建RAC之(1)--配置系统环境
系统环境:
操作系统:RedHat EL5
Cluster: Oracle GI(Grid Infrastructure)
Oracle: Oracle 11.2.0.1.0
如图所示:RAC 系统架构
对于Oracle 11G构建RAC首先需要构建GI(Grid Infrastructure)的架构
一、配置系统环境
1、网络环境(all nodes)
[root@node1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.8.21 node1
192.168.8.23 node1-vip
10.10.10.21 node1-priv
192.168.8.22 node2
192.168.8.24 node2-vip
10.10.10.22 node2-priv
192.168.8.25 rac_scan
--对于11g的RAC可以通过DNS服务器配置SCAN IP的解析,通过客户端连接时,实现负载均衡;如果没有配置DNS服务器,需在hosts文件解析SCAN IP,但不能实现负载均衡效果。
--对于DNS的配置,见另一博文:
http://tiany.blog.51cto.com/513694/1421917
Oracle 11g RAC SCAN ip的原理及配置
2、建立用户和组(all nodes)
[root@node1 ~]# cat user.sh
groupadd -g 200 oinstall
groupadd -g 201 dba
groupadd -g 202 oper
groupadd -g 203 asmadmin
groupadd -g 204 asmoper
groupadd -g 205 asmdba
useradd -u 200 -g oinstall -G dba,asmdba,oper oracle
useradd -u 201 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
--尽量保证每个node上oracle和grid用户的UID一致。
3、配置oracle和grid用户的环境变量(all nodes)
oracle用户:
[grid@node1 ~]$ cat .bash_profile
export EDITOR=vi
export ORACLE_SID=prod1 //node2 为prod2
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
grid用户:
[grid@node1 ~]$ cat .bash_profile
export EDITOR=vi
export ORACLE_SID=+ASM1 //node2 为+ASM2
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/11.2.0/grid
export GRID_HOME=/u01/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export THREADS_FLAG=native
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
4、建立CRS和Oracle软件主目录(all nodes)
[root@node1 ~]# cat mkdir.sh
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory/
chmod -R 775 /u01/app/oraInventory/
mkdir -p /u01/11.2.0/grid
chown -R grid:oinstall /u01/11.2.0/grid/
chmod -R 775 /u01/11.2.0/grid/
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/cfgtoollogs
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
5、配置系统内核参数(all nodes)
[root@node1 ~]# cat /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
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
内核参数修改生效:
[root@node1 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
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
6、建立oracle和grid用户访问系统资源的限制(all nodes)
[root@node1 ~]# cat /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
7、配置用户会话访问资源的限制(all nodes)
[root@node1 ~]# cat /etc/pam.d/login
session required /lib/security/pam_limits.so
8、配置全局shell访问限制
[root@node1 ~]#cat /etc/profile
if [ $USER = "oracle" ]||[ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
9、配置时间同步(all nodes)
在11g的RAC中GI自带了,时间同步的功能,所以不再需要操作系统同步的ntp service,在所有node关闭ntp service。
[root@node1 ~]# chkconfig ntpd off
[root@node1 ~]# mv /etc/ntp.conf /etc/ntp.conf.bak
--未完待续