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
好了 所有的准备工作完毕之后我们开始架设吧
一、安装必需的软件包
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 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
- 10.1.15.211 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
vim /etc/sysctl.conf
- kernel.shmmax = 2147483648
- kernel.shmall = 2097152
- kernel.shmmni = 4096
- kernel.sem = 250 32000 100 128
- net.ipv4.ip_local_port_range = 1024 65000
- net.core.rmem_default = 4194304
- net.core.rmem_max = 4194304
- net.core.wmem_default = 262144
- net.core.wmem_max = 262144
vim /etc/security/limits.conf
- oracle soft nproc 2047
- oracle hard nproc 16384
- oracle soft nofile 1024
- oracle hard nofile 65536
vim /etc/pam.d/login
- session required /lib/security/pam_limits.so
- session required pam_limits.so
vim /etc/profile
- if [ \$USER = "oracle" ];then
- if [ \$SHELL = "/bin/ksh" ];then
- ulimit -p 16384
- ulimit -n 65536
- else
- ulimit -u 16384 -n 65536
- fi
- fi
vim /etc/modprobe.conf
- /sbin/modprobe hangcheck_timer
vim /etc/rc.d/rc.local
- options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
添加oracle用户
- groupadd -g dba
- groupadd -g oinstall
- useradd -u -g oinstall -G dba oracle
- mkdir -p /u01/oracle/product/11.0.6/rac_db
- mkdir -p /app/oracrs/product/11.0.6/crs
- chown -R oracle:oinstall /u01/oracle
- chown -R oracle:oinstall /app
vim /home/oracle/.bash_profile
- export PATH
- export ORACLE_BASE=/u01/oracle
- export ORACLE_HOME=$ORACLE_BASE/product/11.0.6/rac_db
- export ORA_CRS_HOME=/app/oracrs/product/11.0.6/crs
- export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
- export ORACLE_SID=racdb1
- export NLS_LANG=AMERICAN_AMERICA.zhs16gbk
- export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
- export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
- export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
- export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
- export ORACLE_TERM=xterm
- export TNS_ADMIN=$ORACLE_HOME/network/admin
- export ORA_NLS10=$ORACLE_HOME/nls/data
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
- export CLASSPATH=$ORACLE_HOME/JRE
- export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
- export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
- export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
- export THREADS_FLAG=native
- export TEMP=/tmp
- export TMPDIR=/tmp
三、配置SSH信任
!!!此步特别注意用oracle用户执行下面命令 并且注意oracle家目录的权限为700,否则会报错
- ssh-keygen -t rsa ####这条命令在两个节点上执行,完成后执以下命令
- ssh node-rac1 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
- ssh node-rac2 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
- scp authorized_keys node-rac2:/home/oracle/.ssh/
四、配置ISCSI共亨存储系统
!!!这步首先保证本机有两块硬盘分别为:/dev/sdb /dev/sdc 然后执行
- tar zxvf iscsitarget-1.4.20.1.tar.gz
- cd iscsitarget-1.4.20.1
- make && make install
- vim /etc/iet/ietd.conf
- Target iqn.2012.12.15.com.beth:sdb
- Lun 0 Path=/dev/sdb,Type=fileio
- Target iqn.2012.12.15.com.beth:sdc
- Lun 0 Path=/dev/sdc,Type=fileio
- vim /etc/iet/initiators.allow
- iqn.2012.12.15.com.beth:sdb 192.168.15.211,192.168.15.213
- iqn.2012.12.15.com.beth:sdc 192.168.15.211,192.168.15.213
- /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 数据库