这个专题说的是如何搭建Oracle 11.2.0.4 RAC 环境
这一节接着上一节udev的配置,说如何将配置rac的环境,包括grid和oracle
注意:我们是无需手动设定两节点间的互信的,安装程序会自动建立,将在下节介绍
这期代码较多,手机可能会显示错乱,可使用PC客户端查看,谢谢
以下所有操作都需在两节点都操作
注意:redhat 6.7 不支持grid 11.2.0.1版本。
下载地址:https://pan.baidu.com/s/1i5aEFYX
密码请关注公众号回复密码即可
两节点相同
[root@rac1 grid]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# RAC1
10.65.204.210 rac1
192.168.25.101 rac1-priv
10.65.204.211 rac1-vip
#RAC2
10.65.204.212 rac2
192.168.25.102 rac2-priv
10.65.204.213 rac2-vip
# RAC-SCAN
10.65.204.214 rac-scan
两节点相同
groupadd -g 501 oinstall
groupadd -g 505 asmdba
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 506 asmoper
useradd -u 502 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash grid
useradd -u 501 -g oinstall -G asmdba,dba,oper -d /home/oracle -s /bin/bash oracle
两节点相同
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R grid:oinstall /u01
chmod -R 775 /u01
chown -R oracle:oinstall /u01/app/oracle
RAC1节点
[oracle@rac1 ~]$ vim ~/.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
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl1
export NLS_LANG=american_america.al32utf8
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
[grid@rac1 oracle]$ vim ~/.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
export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_SID=+ASM1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export ORACLE_TERM=xterm
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export TNS_ADMIN=$ORACLE_HOME/network/admin
RAC2节点
[oracle@rac2 ~]$ vim ~/.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
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl2
export NLS_LANG=american_america.al32utf8
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
[grid@rac2 ~]$ vim ~/.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
export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_SID=+ASM2
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export ORACLE_TERM=xterm
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export TNS_ADMIN=$ORACLE_HOME/network/admin
两节点相同
关闭防火墙
service iptables stop
chkconfig iptables off
service ip6tables stop
chkconfig ip6tables off
关闭Selinux
[root@rac2 grid]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
两节点相同
shmmax和shmall的设置 shmmax指的是单个内存段的最大值,单位为bytes shmall指的是Orale能使用的最大内存大小,单位为pages, pages大小可通过 getconf PAGE_SIZE 命令查询,一般操作系统page大小为4096bytes 如操作系统内存为8G,给80%给Oracle使用,则 kernel.shmmax=(8*0.8*1024 * 1024 * 1024 )=6871947673 kernel.shmall=kernel.shmmax/4096=1677721
修改/etc/sysctl.conf文件
如默认大于如下数值,请不要更改
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 4194304
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
修改后使其生效
/sbin/sysctl -p
两节点相同
添加如下一行
vim /etc/pam.d/login
session required pam_limits.so
两节点相同
[grid@lixora01 ~]$ more /etc/security/limits.conf
grid soft nproc 4096
grid hard nproc 16384
grid soft nofile 2048
grid hard nofile 65536
oracle soft nproc 4096
oracle hard nproc 16384
oracle soft nofile 2048
oracle hard nofile 65536
两节点相同
[root@rac1 udev]#/sbin/service ntpd stop
[root@rac1 udev]#chkconfig ntpd off
[root@rac1 udev]#mv /etc/ntp.conf /etc/ntp.conf.original
[root@rac1 udev]#rm /var/run/ntpd.pid
两节点相同
安装cvuqdisk包
该包在grid安装文件rpm目录
rpm -ivh cvuqdisk-1.0.7-1.rpm
安装pdksh包
该包在上面的下载链接中
rpm -ivh pdksh-5.2.14-30.x86_64.rpm
安装其他包
以下包都在Redhat 系统镜像Package内,可直接运行安装
rpm -ivh binutils-2.20.51.0.2-5.43.el6.x86_64.rpm
rpm -ivh binutils-devel-2.20.51.0.2-5.43.el6.x86_64.rpm
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
rpm -ivh elfutils-libelf-0.161-3.el6.x86_64.rpm
rpm -ivh glibc-2.12-1.166.el6.x86_64.rpm
rpm -ivh glibc-common-2.12-1.166.el6.x86_64.rpm
rpm -ivh glibc-devel-2.12-1.166.el6.x86_64.rpm
rpm -ivh gcc-4.4.7-16.el6.x86_64.rpm
rpm -ivh gcc-c++-4.4.7-16.el6.x86_64.rpm
rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
rpm -ivh libaio-devel-0.3.107-10.el6.x86_64.rpm
rpm -ivh libgcc-4.4.7-16.el6.x86_64.rpm
rpm -ivh libstdc++-4.4.7-16.el6.x86_64.rpm
rpm -ivh libstdc++-devel-4.4.7-16.el6.x86_64.rpm
rpm -ivh make-3.81-20.el6.x86_64.rpm
rpm -ivh sysstat-9.0.4-27.el6.x86_64.rpm
rpm -ivh unixODBC-2.2.14-14.el6.x86_64.rpm
rpm -ivh unixODBC-devel-2.2.14-14.el6.x86_64.rpm
rpm -ivh libcap-2.16-5.5.el6.x86_64.rpm
rpm -ivh libcap-devel-2.16-5.5.el6.x86_64.rpm
rpm -ivh compat-libcap1-1.10-1.x86_64.rpm
rpm -ivh libcap-devel-2.16-5.5.el6.x86_64.rpm
rpm -ivh libcap-ng-0.6.4-3.el6_0.1.x86_64.rpm
rpm -ivh libcap-ng-devel-0.6.4-3.el6_0.1.x86_64.rpm
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
rpm -ivh ksh-20120801-28.el6.x86_64.rpm
rpm -ivh cpp-4.4.7-16.el6.x86_64.rpm
rpm -ivh glibc-headers-2.12-1.166.el6.x86_64.rpm
rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm