配置11gR2 RAC需要安装Oracle Grid Infrastructure软件、Oracle数据库软件,其中Grid软件等同于Oracle 10g的Clusterware集群件。Oracle建议以不同的用户分别安装Grid Infrastructure软件、Oracle数据库软件,我们这里以grid用户安装Grid Infrastructure,oracle用户安装Oracle数据库软件。并且grid、oracle用户需要属于不同的用户组。在配置RAC时,还要求这两个用户在RAC的不同节点上uid、gid要一致。用户、组的对应信息见下表:
Group Name |
Group ID |
Group Info |
Oracle User(1100) |
Grid User(1101) |
oinstall |
1000 |
Inventory Group |
Y |
Y |
dba |
1300 |
OSDBA Group |
Y |
|
oper |
1301 |
OSOPER Group |
Y |
|
asmadmin |
1200 |
OSASM |
Y |
|
asmdba |
1201 |
OSDBA for ASM |
Y |
Y |
asmoper |
1202 |
OSOPER for ASM |
Y |
1.创建用户和组
groupadd -g 1000 oinstall groupadd -g 1200 asmadmin groupadd -g 1300 dba useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "grid Infrastructure Owner" grid useradd -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle |
测试
[[email protected] shell]# id grid uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper) [[email protected] shell]# id oracle uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper) [[email protected] shell]# |
说明:在节点node2上执行该脚本时,需要将grid用户环境变量ORACLE_SID修改为+ASM2,oracle用户环境变量ORACLE_SID修改为devdb2,ORACLE_HOSTNAME环境变量修改为node2.localdomain
2.建路径、改权限
关于grid、oracle用户的环境变量配置信息,见下述表格。
Environment Variable |
Grid User |
Oracle User |
ORACLE_BASE |
/u01/app/grid |
/u01/app/oracle |
ORACLE_HOME |
/u01/app/11.2.0/grid |
/u01/app/oracle/product/11.2.0/db_1 |
ORACLE_SID [node1] |
+ASM1 |
devdb1 |
ORACLE_SID [node2] |
+ASM2 |
devdb2 |
mkdir -p /u01/app/grid mkdir -p /u01/app/11.2.0/grid mkdir -p /u01/app/oracle chown -R oracle:oinstall /u01 chown -R grid:oinstall /u01/app/grid chmod -R 775 /u01 [[email protected] shell]# cd /u01/app/ [[email protected] app]# ll total 12 drwxrwxr-x 3 grid oinstall 4096 Apr 24 10:06 11.2.0 drwxrwxr-x 2 grid oinstall 4096 Apr 24 10:06 grid drwxrwxr-x 2 oracle oinstall 4096 Apr 24 10:06 oracle [[email protected] app]# |
3. 修改/etc/security/limits.conf,配置oracle、grid用户的shell限制
cp /etc/security/limits.conf /etc/security/limits.conf.bak echo "oracle soft nproc 2047" >>/etc/security/limits.conf echo "oracle hard nproc 16384" >>/etc/security/limits.conf echo "oracle soft nofile 1024" >>/etc/security/limits.conf echo "oracle hard nofile 65536" >>/etc/security/limits.conf echo "grid soft nproc 2047" >>/etc/security/limits.conf echo "grid hard nproc 16384" >>/etc/security/limits.conf echo "grid soft nofile 1024" >>/etc/security/limits.conf echo "grid hard nofile 65536" >>/etc/security/limits.conf |
4. 修改/etc/pam.d/login配置文件
cp /etc/pam.d/login /etc/pam.d/login.bak echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login echo "session required pam_limits.so" >>/etc/pam.d/login |
5. 修改/etc/profile文件
cp /etc/profile /etc/profile.bak echo ‘if [ $USER = "oracle" ]||[ $USER = "grid" ]; then‘ >> /etc/profile echo ‘if [ $SHELL = "/bin/ksh" ]; then‘ >> /etc/profile echo ‘ulimit -p 16384‘ >> /etc/profile echo ‘ulimit -n 65536‘ >> /etc/profile echo ‘else‘ >> /etc/profile echo ‘ulimit -u 16384 -n 65536‘ >> /etc/profile echo ‘fi‘ >> /etc/profile echo ‘fi‘ >> /etc/profile |
6.修改内核配置文件
cp /etc/sysctl.conf /etc/sysctl.conf.bak echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf echo "fs.file-max = 6815744" >> /etc/sysctl.conf echo "kernel.shmall = 2097152" >> /etc/sysctl.conf echo "kernel.shmmax = 1054472192" >> /etc/sysctl.conf echo "kernel.shmmni = 4096" >> /etc/sysctl.conf echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf echo "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.conf echo "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.conf |
7. 停止ntp服务,11gR2新增的检查项
[[email protected] ~]# service ntpd status ntpd is stopped [[email protected] ~]# chkconfig ntpd off [[email protected] ~]# cat /etc/ntp ntp/ ntp.conf [[email protected] ~]# cp /etc/ntp.conf /etc/ntp.conf.bak [[email protected] ~]# rm -rf /etc/ntp.conf [[email protected] ~]# |
8. node2准备工作
我们已经在node1完成基本准备配置工作,在node2上重复上述1到7中准备工作,以完成节点2的准备工作。