规划阶段:1、cluster node数 node主机名 3个IP地址

                  2、数据库存储类型(ASM、OCFS、RAW、Other)

                  3、存储空间规划、软件安装位置(oracle、grid)

clusterware软件、                                              $ORACLE_HOME grid

OCR、                                                                 /dev/raw/raw1

Voting disk、                                                      /dev/raw/raw2

Database软件、                                                   $ORACLE_HOME oracle

数据文件、参数文件SPFILE、控制文件、联机日志文件、+DATA

备份文件                                                               +RECOVERY

归档文件                                                                $ORACLE_BASE/arch

参数文件、密码文件                                              $ORACLE_HOME/dbs




实施阶段:1、主机配置

a、网络配置 /etc/hosts [root]

#Public

192.168.56.200 rac1.oracle.com rac1

192.168.56.201 rac2.oracle.com rac2


#Private

10.10.10.100 rac1-priv.oracle.com rac1-priv

10.10.10.101 rac2-priv.oracle.com rac2-priv


#Virtual

192.168.56.202 rac1-vip.oracle.com rac1-vip

192.168.56.203 rac2-vip.oracle.com rac2-vip


#Scan

192.168.56.204 rac-scan.oracle.com rac-scan  

配置  域名服务器 正反解

b、必需的rpm包

内核版本:uname -a

安装的包:rpm -ivh *.rpm 

或者

yum install binutils-2* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-*

yum install gcc-4* gcc-c++-4* glibc-2.* glibc-common-2* glibc-devel-2*

yum install libaio-0* libgcc-4* libstdc++-4* libstdc++-devel* make-3* pdksh-* sysstat-7* libaio-devel-* unixODBC-2* unixODBC-devel-2* 

配置本地yum源 


mount  /dec/hda /mnt

[root@heart ~]# cat /etc/yum.repos.d/hcc.repo

[plus]

name=CentOS-$releasever - plus

baseurl=file:///mnt/Server

gpgcheck=0

enabled=1


配置网络yum源


c、一些系统资源配置

vim /etc/sysctl.conf  --OS kernel配置 sysctl –p立即生效

# oracle

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 8388608

kernel.shmmax = 536870912

kernel.shmmax = 1073741824

kernel.sem = 250 32000 100 128

fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default=262144

net.core.wmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_max=1048576

#end  


Vim /etc/security/limits.conf --设置用户资源限制  ulimit -a查看用户资源限制 依赖pam_limits.so 模块

#oracle,grid

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

#end  


vim /etc/pam.d/login  --添加pam_limits.so 模块

#Oracle

session required pam_limits.so  


Vim /etc/profile    --修改安装所有者在shell 下的ulimit 限制

# oracle

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then

   if [ \$SHELL = "/bin/ksh" ]; then

   ulimit -p 16384

   ulimit -n 65536

  else

   ulimit -u 16384 -n 65536

  fi

   umask 022

fi

#end 


d、配置时间同步服务

一:时间服务器NTP

cat /etc/ntp.conf

server 192.168.0.147 prefer

driftfile /var/lib/ntp/drift

broadcastdelay 0.008

二:没有时间服务器NTP一个节点作为时间服务器

cat /etc/ntp.conf【主节点时间服务器】

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 11

driftfile /var/lib/ntp/drift

broadcastdelay 0.008


/etc/init.d/ntpd start 或 service ntpd start


cat /etc/ntp.conf【客户端】

server 192.168.0.147 prefer

driftfile /var/lib/ntp/drift

broadcastdelay 0.008


三:自带的时间同步服务CTSS

/etc/init.d/ntpd stop

chkconfig ntpd off

mv /etc/ntp.conf /etc/ntp.conf.org 或者rm /etc/ntp.conf  


e、创建oracle用户、grid用户、以及用户组

/usr/sbin/groupadd -g 501 oinstall

/usr/sbin/groupadd -g 502 dba

/usr/sbin/groupadd -g 503 oper

/usr/sbin/groupadd -g 504 asmadmin

/usr/sbin/groupadd -g 505 asmoper

/usr/sbin/groupadd -g 506 asmdba

/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle

/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid


passwd oracle

passwd grid


f、建立目录并赋给相关用户


mkdir -p /u01/app/oracle

chown -R oracle:oinstall /u01/app/oracle

chmod -R 775 /u01/app/oracle


mkdir -p /u01/app/oracle/product/11.2.0/db_1

chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1

chmod -R 775 /u01/app/oracle/product/11.2.0/db_1


mkdir -p /u01/app/grid

chown -R grid.oinstall /u01/app/grid

chmod -R 775 /u01/app/grid


mkdir -p /u01/app/11.2.0/grid

chown -R grid:oinstall /u01/app/11.2.0/grid

chmod -R 775 /u01/app/11.2.0/grid


mkdir -p /u01/app/oraInventory

chown -R grid:oinstall /u01/app/oraInventory

chmod -R 775 /u01/app/oraInventory  


g、 修改grid 用户的.bash_profile 文件

su – grid

export ORACLE_SID=+ASM1

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid

export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"

export TNS_ADMIN=$ORACLE_HOME/network/admin

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

umask 022


修改oracle 用户的.bash_profile 文件   

su – oracle

export ORACLE_SID=rac1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"

export TNS_ADMIN=$ORACLE_HOME/network/admin

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export NLS_LANG='AMERICAN_AMERICA.AL32UTF8'

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib

umask 022


h、建立信任关系

[root@node1 ~]#su – oracle

[oracle@node1~]$ mkdir .ssh

[root@node2 ~]#su – oracle

[oracle@node2~]$ mkdir .ssh

[oracle@node1~]$ ssh-keygen -t rsa

…回车下去…

[oracle@node1~]$ ssh-keygen -t dsa

…回车下去…

[oracle@node2~]$ ssh-keygen -t rsa

…回车下去…

[oracle@node2~]$ ssh-keygen -t dsa

…回车下去…

[oracle@node1~]$ cat .ssh/id_rsa.pub>>.ssh/authorized_keys

[oracle@node1~]$ cat .ssh/id_dsa.pub>>.ssh/authorized_keys

[oracle@node1~]$ ssh node2 cat .ssh/id_rsa.pub>>.ssh/authorized_keys

[oracle@node1~]$ ssh node2 cat .ssh/id_dsa.pub>>.ssh/authorized_keys

[oracle@node1~]$ scp .ssh/authorized_keys node2:~/.ssh

[oracle@node1~]$ ssh node2 date

[oracle@node1~]$ ssh node2-priv date

[oracle@node1~]$ ssh node1 date

[oracle@node1~]$ ssh node1-priv date

同样,在node2也做这些操作

[oracle@node2~]$ ssh node1 date

[oracle@node2~]$ ssh node1-priv date

[oracle@node2~]$ ssh node2 date

[oracle@node2~]$ ssh node2-priv date 


i、配置ASM

fdisk -l

fdisk /dev/sdb

partprobe (扫描分区)

oracleasm configure -i (grid asmadmin y y)

oracleasm createdisk OCR_VOTE1 /dev/sdb1

oracleasm createdisk OCR_VOTE2 /dev/sdb2

oracleasm createdisk OCR_VOTE3 /dev/sdb3

oracleasm createdisk ASM_FLA /dev/sdb5

oracleasm createdisk ASM_DATA /dev/sdb6

oracleasm scandisks

oracleasm listdisks


j、验证配置是否完成

./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose|tee 1.txt


crsctl stat res ora.ctssd -init -t



裸设备配置

一:裸设备服务的配置文件/etc/sysconfig/rawdevices

/dev/raw/raw1 /dev/sdb1

/dev/raw/raw2 /dev/sdb2


二:设置oracle用户对裸设备的访问权限编辑udev  /etc/udev/rules.d/60-raw.rules

ACTION=="add", KERNEL=="/dev/sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"

ACTION=="add", KERNEL=="/dev/sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"


ls -ltr /dev/sdb*

ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"

ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="18",RUN+="/bin/raw /dev/raw/raw2 %M %m"


KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="660"

ls -lrt /dev/raw

raw -aq  

start_udev

service rawdevices restart

chkconfig --list rawdevices


2、安装clusterware

./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose|tee 1.txt


vi /etc/profile

export PATH=$PATH:/u01/app/11.2.0/grid/bin

crsctl check crs

crsctl check ctss

crs_stat -t -v

olsnodes


3、安装oracleware

4、配置listener

5、创建ASM

6、创建database


体验 loadbalance


体验failover