oracle  RAC集群系统是oracle公司推出的一套完整数据库集群解决方案。

 

IP地址规化


IP                                                     主机名                   

10.1.15.21                                node-rac-priv1

10.1.15.213                              node-rac-priv2

192.168.15.211                        node-rac1

192.168.15.213                        node-rac2

192.168.15.231                        node-rac-vip1

192.168.15.233                        node-rac-vip2

192.168.15.222                        iscsi-target

 


整个架构所需软件包名:

 

iscsitarget-1.4.20.1.tar.gz                        

oracleasm-support-2.1.4-1.el5.i386.rpm
oracleasm-2.6.18-194.32.1.el5-2.0.5-1.el5.i686.rpm 
oracleasmlib-2.0.4-1.el5.i386.rpm

redhat-release-5-1.0.el5.centos.1.i386.rpm

linux_x86_11gR1_clusterware.zip

linux_11gR1_database_1013.zip

    这些软件包都可以在官网下载

http://www.oracle.com/technetwork/indexes/downloads/index.html

 


 

好了 所有的准备工作完毕之后我们开始架设吧

 一、安装必需的软件包

 

  1. rpm -ivh oracleasm-support-2.1.4-1.el5.i386.rpm oracleasm-2.6.18-194.32.1.el5-2.0.5-1.el5.i686.rpm oracleasmlib-2.0.4-1.el5.i386.rpm redhat-release-5-1.0.el5.centos.1.i386.rpm   
  2.    
  3. yum install -y libaio-devel sysstat unixODBC unixODBC-devel binutils compat-libstdc++    elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libgcc libstdc++ libstdc++-devel make expect 

二、更改oracle完装所需的环境

 vim /etc/hosts 

 

 

  1. 10.1.15.211                node-rac-priv1  
  2. 10.1.15.213                node-rac-priv2    
  3. 192.168.15.211             node-rac1    
  4. 192.168.15.213             node-rac2    
  5. 192.168.15.231             node-rac-vip1    
  6. 192.168.15.233             node-rac-vip2   

 

 vim /etc/sysctl.conf

  1. kernel.shmmax = 2147483648
  2. kernel.shmall = 2097152
  3. kernel.shmmni = 4096 
  4. kernel.sem = 250 32000 100 128  
  5. net.ipv4.ip_local_port_range = 1024 65000  
  6. net.core.rmem_default = 4194304 
  7. net.core.rmem_max = 4194304 
  8. net.core.wmem_default = 262144 
  9. net.core.wmem_max = 262144 

 

vim  /etc/security/limits.conf 

  1. oracle          soft    nproc           2047  
  2. oracle          hard    nproc           16384  
  3. oracle          soft    nofile          1024  
  4. oracle          hard    nofile          65536   

 vim /etc/pam.d/login

  1. session required /lib/security/pam_limits.so  
  2. session required pam_limits.so  

vim /etc/profile

  1. if [ \$USER = "oracle" ];then  
  2.         if [ \$SHELL = "/bin/ksh" ];then  
  3.                 ulimit -p 16384  
  4.                 ulimit -n 65536  
  5.         else  
  6.                 ulimit -u 16384 -n 65536  
  7.         fi  
  8. fi 

vim /etc/modprobe.conf

  1. /sbin/modprobe hangcheck_timer 

vim /etc/rc.d/rc.local

  1. options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180 

添加oracle用户

  1. groupadd -g dba  
  2. groupadd -g oinstall  
  3. useradd -u -g oinstall -G dba oracle 
  4. mkdir -p /u01/oracle/product/11.0.6/rac_db
  5. mkdir -p /app/oracrs/product/11.0.6/crs
  6. chown -R oracle:oinstall /u01/oracle
  7. chown -R oracle:oinstall /app

vim  /home/oracle/.bash_profile

  1. export PATH  
  2. export ORACLE_BASE=/u01/oracle  
  3. export ORACLE_HOME=$ORACLE_BASE/product/11.0.6/rac_db  
  4. export ORA_CRS_HOME=/app/oracrs/product/11.0.6/crs  
  5. export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin  
  6. export ORACLE_SID=racdb1 
  7. export NLS_LANG=AMERICAN_AMERICA.zhs16gbk  
  8. export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS" 
  9. export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin  
  10. export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin  
  11. export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin  
  12. export ORACLE_TERM=xterm 
  13. export TNS_ADMIN=$ORACLE_HOME/network/admin  
  14. export ORA_NLS10=$ORACLE_HOME/nls/data  
  15. export LD_LIBRARY_PATH=$ORACLE_HOME/lib  
  16. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib  
  17. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib  
  18. export CLASSPATH=$ORACLE_HOME/JRE  
  19. export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib  
  20. export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib  
  21. export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib  
  22. export THREADS_FLAG=native 
  23. export TEMP=/tmp  
  24. export TMPDIR=/tmp 

三、配置SSH信任

!!!此步特别注意用oracle用户执行下面命令   并且注意oracle家目录的权限为700,否则会报错

  1. ssh-keygen -t rsa    ####这条命令在两个节点上执行,完成后执以下命令
  2. ssh node-rac1 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys   
  3. ssh node-rac2 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys   
  4. scp authorized_keys node-rac2:/home/oracle/.ssh/ 

四、配置ISCSI共亨存储系统

!!!这步首先保证本机有两块硬盘分别为:/dev/sdb  /dev/sdc  然后执行 

 
  1. tar zxvf iscsitarget-1.4.20.1.tar.gz  
  2. cd iscsitarget-1.4.20.1  
  3. make && make install  
  4.  
  5. vim /etc/iet/ietd.conf 
  6. Target iqn.2012.12.15.com.beth:sdb  
  7. Lun 0 Path=/dev/sdb,Type=fileio  
  8. Target iqn.2012.12.15.com.beth:sdc  
  9. Lun 0 Path=/dev/sdc,Type=fileio 
  10.  
  11. vim /etc/iet/initiators.allow
  12. iqn.2012.12.15.com.beth:sdb 192.168.15.211,192.168.15.213   
  13. iqn.2012.12.15.com.beth:sdc 192.168.15.211,192.168.15.213   
  14.  
  15. /etc/init.d/iscsi-target restart 

 五、安装Oracle Clusterware

从此步开始全以oracle用户身份运行安装 ,基本上全是图形化操作,具体的就不详解。注:在安装前以oracle身份进入到Clusterware解压路径下执行下条命令,测试所配置的环境是否允许安装集群,检测全通过的话,下面就可执相关软件的安装。

 

./runcluvfy.sh stage -pre crsinst -n node-rac1,node-rac2 -verbose

六、安装Oracle  数据库

1、安装Oracle的数据库运行软件

2、设置监听

3、创建Oracle  数据库