os:CentOS 6.6
hostname:rac11g03,rac11g04
IP: rac11g03 192.108.56.103 192.108.96.103 192.108.26.103
rac11g04 192.108.56.104 192.108.96.104 192.108.26.104
Oracle:11.2.0.4
storage:openfiler 192.108.26.100:3260
说明:
1.centos 6.6已经做了basic安装,ip和主机名已设置.
2.oracle安装文件p13390677_112040_Linux-x86-64_1of7.zip,p13390677_112040_Linux-x86-64_2of7.zip,p13390677_112040_Linux-x86-64_3of7.zip放在rac11g03的/root下,pdksh-5.2.14-30.x86_64.rpm包放在rac11g03的/root下.
3.密码都用的selectshen,可根据自己的需要修改
4.三个网段,192.108.56.0:public,192.108.96.0:private,192.108.26.0:storage
5.以下脚本可以在健壮性和通用性上做一些调整,以用来在开发测试环境中快速部署RAC.
实施:
#################################步骤一#################################
###################rac11g04_init.sh,以下内容放到一个文件中,在rac11g04下sh执行即可:
#!/bin/bash
##此处用于加载光驱为之后安装缺少的包,也可改为网络方式.
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
mv /etc/yum.repos.d/*.repo /root/
cat > /etc/yum.repos.d/CentOS-Media.repo << EOF
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/cdrom/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
EOF
yum clean all
yum makecache
#调整hosts文件
cat >> /etc/hosts << EOF
192.108.56.103 rac11g03
192.108.56.104 rac11g04
192.108.56.203 rac11g03-vip
192.108.56.204 rac11g04-vip
192.108.56.205 rac11g-scan
192.108.96.103 rac11g03-priv
192.108.96.104 rac11g04-priv
EOF
#关闭防火墙,selinux
chkconfig iptables off
service iptables stop
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#网络参数调整
cat >> /etc/sysctl.conf << EOF
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
sysctl -p
#资源限制参数调整
cat >> /etc/security/limits.conf << EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
EOF
#登陆参数调整
cat >> /etc/pam.d/login << EOF
session required /lib64/security/pam_limits.so
EOF
#安装缺少的包
yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel unixODBC unixODBC-devel
yum -y install expect
ln -s /lib64/libcap.so.2.16 /lib64/libcap.so.1
#清除NTP服务
service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.bak
mv /var/run/ntpd.pid /var/run/ntpd.pid.bak
##创建配置grid,oracle用户
groupadd -g 1000 oinstall
groupadd -g 1100 asmadmin
groupadd -g 1200 dba
groupadd -g 1300 asmdba
useradd -u 1100 -d /home/oracle -g oinstall -G dba,asmdba oracle
useradd -u 1101 -d /home/grid -g oinstall -G asmadmin,asmdba grid
echo "selectshen"|passwd --stdin oracle
echo "selectshen"|passwd --stdin grid
cat >> /home/grid/.bash_profile << EOF
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export GRID_HOME=/u01/app/11.2.0/grid
export ORACLE_SID=+ASM1
export ORACLE_TERM=xterm
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
ulimit -u 16384 -n 65536
umask 022
EOF
. /home/grid/.bash_profile
cat >> /home/oracle/.bash_profile << EOF
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=rac11g
export ORACLE_TERM=xterm
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
ulimit -u 16384 -n 65536
umask 022
EOF
. /home/oracle/.bash_profile