Centos6.5 + Oracle 11g r2 + nfs搭建RAC环境一

前端之家收集整理的这篇文章主要介绍了Centos6.5 + Oracle 11g r2 + nfs搭建RAC环境一前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  • 环境要求:

1.2台系统为Centos6.5的机器,其中 1台做nfs(硬盘大小至少4T)

2. 每台机器至少2块网卡

3. 准备5个可用的IP地址(一个为scan,二台配置各配置public和private地址)

4. 内存至少2G以下内存,建议使用4G或者更高


  • 地址规划:

第一台主机:rac1 网卡eth0IP地址:172.16.0.1/24 网卡eth1地址: 192.168.1.192/24

第一台主机:rac1 网卡eth0IP地址172.16.0.2/24 网卡eth1: 192.168.1.193/24

虚拟IP地址:192.168.1.200


  • 关闭ntp 并配置yum的本地源

关闭服务
#/etc/init.d/ntpdstop
#chkconfigntpdoff
#mv/etc/ntp.conf/etc/ntp.conf.org

#mkdir/mnt/cdrom/
#mount/dev/cdrom/mnt/cdrom/

#vim/etc/yum.repos.d/CentOS-Media.repo
name=CentOS-$releasever-Media
baseurl=file:///mnt/cdrom/
gpgcheck=0
enabled=1
  • 安装依赖软件包

#yum-yinstallbinutils-2*.rpm\
compat-libstdc++-33*.rpm\
elfutils-libelf-0.*.rpm\
elfutils-libelf-devel-*.rpm\
gcc-4*.rpm\
gcc-c++-4*.rpm\
glibc-2.*.rpm\
glibc-common-2*.rpm\
glibc-devel-2*.rpm\
libaio-0*.rpmlibgcc-4*.rpm\
libstdc++-4*.rpm\
libstdc++-devel*.rpm\
make-3*.rpm\
pdksh-*.rpm\
sysstat-7*.rpm\
libaio-devel-*.rpm\
unixODBC-2*.rpm\
unixODBC-devel-2*.rpm\
#vim/etc/hosts
#Public
172.16.0.1rac1-priv
172.16.0.2rac2-priv
#Virtual
192.168.1.194rac1-vip
192.168.1.195rac2-vip
#Scan
192.168.1.200rac-scan
#NAS
192.168.1.194nas1
#vim/etc/sysctl.conf在最后面添加
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmall=2097152
kernel.shmmax=536870912
kernel.shmmni=4096
kernel.sem=25032000100128
net.ipv4.ip_local_port_range=900065500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576

#sysctl-p
#vi/etc/security/limits.conf
oraclesoftnproc2047
oraclehardnproc16384
oraclesoftnofile1024
oraclehardnofile65536
gridsoftnproc2047
gridhardnproc16384
gridsoftnofile1024
gridhardnofile65536
vim/etc/pam.d/login在最后添加

sessionrequiredpam_limits.so
#vim/etc/profile在最后添加
if[$USER="oracle"]||[$USER="grid"];then
if[$SHELL="/bin/ksh"];then
ulimit-p16384
ulimit-n65536
else
ulimit-u16384-n65536
fi
umask022
fi
  • 创建用户和组并创建相应的密码

#/usr/sbin/groupadd-g501oinstall
#/usr/sbin/groupadd-g502dba
#/usr/sbin/groupadd-g503oper
#/usr/sbin/groupadd-g504asmadmin
#/usr/sbin/groupadd-g505asmoper
#/usr/sbin/groupadd-g506asmdba
#/usr/sbin/useradd-goinstall-Gdba,asmdba,operoracle
#/usr/sbin/useradd-goinstall-Gasmadmin,asmoper,oper,dbagrid
#passwdoracle
#passwdgrid

创建目录并设置相应权限

#mkdir-p/u01/app/oracle
#chown-Roracle:oinstall/u01/app/oracle
#chmod-R775/u01/app/oracle
#mkdir-p/u01/app/oracle/product/11.2.0/db_1
#chown-Roracle:oinstall/u01/app/oracle/product/11.2.0/db_1
#chmod-R775/u01/app/oracle/product/11.2.0/db_1
#mkdir-p/u01/app/grid
#chown-Rgrid.oinstall/u01/app/grid
#chmod-R775/u01/app/grid
#mkdir-p/u01/app/11.2.0/grid
#chown-Rgrid:oinstall/u01/app/11.2.0/grid
#chmod-R775/u01/app/11.2.0/grid
#mkdir-p/u01/app/oraInventory
#chown-Rgrid:oinstall/u01/app/oraInventory
#chmod-R775/u01/app/oraInventory
#mkdir-p/u01/oradata
#mkdir-p/u01/shared_config
#chown-Roracle:oinstall/u01/oradata
#chown-Rgrid:oinstall/u01/shared_config
#chmod-R775/u01/oradata/u01/shared_config
#su-grid
$vim/home/zkyg/.bash_profile
aliasdf='df-h'
aliasdu='du-sh'
aliasla='ls-lha'
ORACLE_SID=NFS1;exportORACLE_SID
JAVA_HOME=/usr/local/java;exportJAVA_HOME
ORACLE_BASE=/u01/app/grid;exportORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid;exportORACLE_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql;exportORACLE_PATH
ORACLE_TERM=xterm;exportORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS";exportNLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin;exportTNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data;exportORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/app/common/oracle/bin
exportPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
exportLD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
exportCLASSPATH
THREADS_FLAG=native;exportTHREADS_FLAG
exportTEMP=/tmp
exportTMPDIR=/tmp
umask022
aliasdf='df-h'
aliasdu='du-sh'
aliasla='ls-lha'
ORACLE_SID=racdb1;exportORACLE_SID
ORACLE_UNQNAME=racdb;exportORACLE_UNQNAME
JAVA_HOME=/usr/local/java;exportJAVA_HOME
ORACLE_BASE=/u01/app/oracle;exportORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;exportORACLE_HOME
ORACLE_PATH=/u01/app/common/oracle/sql;exportORACLE_PATH
ORACLE_TERM=xterm;exportORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS";exportNLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin;exportTNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data;exportORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/app/common/oracle/bin
exportPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
exportLD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
exportCLASSPATH
THREADS_FLAG=native;exportTHREADS_FLAG
exportTEMP=/tmp
exportTMPDIR=/tmp
umask022
  • 配置ssh双机信任(girdoracle用户下都要配置)以oracle为例子

$ssh-keygen-trsa
$ssh-keygen-tdsa

$ssh-keygen-trsa
$ssh-keygen-tdsa

$cat.ssh/id_rsa.pub>>.ssh/authorized_keys
$cat.ssh/id_dsa.pub>>.ssh/authorized_keys
$sshrac2cat.ssh/id_rsa.pub>>.ssh/authorized_keys
$sshrac2cat.ssh/id_dsa.pub>>.ssh/authorized_keys
$scp.ssh/authorized_keysrac2:.ssh/authorized_keys
  • 在二台机器测试是否正常

$sshrac1date
$sshrac2date

以上操作需要在二台机器都要操作


  • 配置nfs

Rac1上使用fdisk/dev/sdb分2个区sdb1、sdb2并进行格式化
#mkfs.ext3/dev/sdb1
#mkfs.ext3/dev/sdb2

rac1上创建共享目录
#mkdir-p/shared_config
#mkdir-p/shared_data

#vi/etc/fstab添加以下:
/dev/sdb1/shared_configext3defaults00
/dev/sdb2/shared_dataext3defaults00

#vi/etc/exports设置共享
/shared_config*(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_data*(rw,no_root_squash)

#chkconfignfson开启nfs服务
#servicenfsrestart

#vi/etc/fstab添加以下开机挂载共享目录
nas1:/shared_config/u01/shared_confignfsrw,bg,hard,nointr,noac,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=000
nas1:/shared_data/u01/oradatanfsrw,actimeo=000

挂载相应的目录
#mount/u01/shared_config
#mount/u01/oradata
#chowngrid:oinstall/u01/shared_config
#chownoracle:oinstall/u01/oradata
#chmod775/u01/oradata
#chmod775/u01/app/11.2.0/grid
  • 安装grid软件

unzipgrid-XXX.zip
在root下输入xhost+
#su�Cgrid
$cdgrid-XXX
$./runcluvfy.shstage-precrsinst-nrac1,rac2-fixup-verbose|teecheck_grid.txt
如果最后提示:集群服务设置的预检查成功.可以开始去安装grid否则请查看失败在什么地方解决后再次执行该命令行来检查.


运行安装目录下的runInstaller
$./runInstaller

猜你在找的CentOS相关文章