Oracle10.2.0.5数据库 RAC部署(一)

RAC的host信息:
192.168.0.31 ten1
192.168.0.32 ten2
192.168.0.33 ten1-vip
192.168.0.34 ten2-vip
192.168.178.31 ten1-priv
192.168.178.32 ten2-priv

节点1:
ip:192.168.0.31     系统:linux5.7   数据库:oracle10gRAC    sys密码:123456  

节点2:
ip:192.168.0.32    系统:linux5.7   数据库:oracle10gRAC    sys密码:123456
0.安装部署前检查,详情见10g_rac excel表。
1.检查网络,有两个不同的网段,两个静态IP.
ifconfig
网卡1(public ip):vi /etc/sysconfig/network-scripts/ifcfg-ens33     
BOOTPROTO=static
IPADDR=192.168.0.31(填你的ip)                   
NETMASK=255.255.255.0  (填你的掩码值)          
GATEWAY=192.168.0.1    (默认网关)
网卡2(心跳ip):vi /etc/sysconfig/network-scripts/ifcfg-ens34
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.178.31
NETMASK=255.255.255.0

service network restart     //重启网络

2.检查linux系统版本,需求系统为linux5,两台机器的系统要同样的。
 cat /etc/redhat-release
 uname -r

3.检查安装所需的磁盘

4.调整好时区和时间
date 
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -s "2015-6-8 15:36:00"

5.检查iso镜像是否挂上。
mount /dev/sr0 /mnt

1、安装软件包

mount  /dev/cdrom /mnt

vi /etc/yum.repos.d/ol.repo

[local-source]
name=ol
baseurl=file:///mnt/Server
enabled=1
gpgcheck=0

安装rpm依赖包

yum install -y libXau*  libxcb*  libX11* libXext* libICE*  libuuid* libSM*  libXt* libXi* libXtst* libXp* glibc-devel* libaio-devel* libaio* compat-libstdc++* libXpm* libXp-devel* libXpm-devel* compat-libstdc++* compat-libstdc++* compat-libstdc++* gcc-4.4.6* gcc-c++* unixODBC-*
yum install -y libXp.so.6
yum install -y libXt.so.6
yum install -y libXtst.so.6

2、创建用户、组、目录

创建用户、组
groupadd -g 1005 oinstall
groupadd -g 1001 dba
useradd -u 1101 -g oinstall -G dba oracle

创建目录、赋权
mkdir -p  /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01/
passwd oracle

作用          路径
oracle_base /u01/app/oracle
Oracle_home  /u01/app/oracle/product/10.2.0/db_1
ORA_CRS_HOME    /u01/app/oracle/product/10.2.0/crs

3、配置共享磁盘(多路径+udev)-->这里使用虚拟机

切换到vmware安装目录   cd D:\Soft\VMware
cmd  命令
.\vmware-vdiskmanager.exe -c -s 2G -a lsilogic -t 2 "D:\Soft\VMware\Oracle\Shared\10g\OCR1.vmdk"
.\vmware-vdiskmanager.exe -c -s 2G -a lsilogic -t 2 "D:\Soft\VMware\Oracle\Shared\10g\OCR2.vmdk"
.\vmware-vdiskmanager.exe -c -s 20G -a lsilogic -t 2 "D:\Soft\VMware\Oracle\Shared\10g\DATA.vmdk"
分别打开两台虚拟机目录中的vmx文件,在最后一行添加:
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "virtual"

scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.filename = "D:\Soft\VMware\Oracle\Shared\10g\OCR1.vmdk"
scsi1:1.deviceType = "Disk"

scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.filename = "D:\Soft\VMware\Oracle\Shared\10g\OCR2.vmdk"
scsi1:2.deviceType = "Disk"

scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.filename = "D:\Soft\VMware\Oracle\Shared\10g\DATA.vmdk"
scsi1:3.deviceType = "Disk" 

disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"

挂裸盘
fdisk /dev/sdb
fdisk /dev/sdc
fdisk /dev/sdd
n p 1 回车 回车 w

udev规则:

vi /etc/udev/rules.d/60-raw.rules

ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
KERNEL=="raw1", OWNER="oracle", GROUP="oinstall", MODE="660"
KERNEL=="raw2", OWNER="oracle", GROUP="oinstall", MODE="660"
KERNEL=="raw3", OWNER="oracle", GROUP="oinstall", MODE="660"

start_udev

查看是否OK
[root@localhost device-mapper-multipath-0.4.7]#  ls -l /dev/raw
total 0
crw-rw---- 1 root root 162, 1 Oct  5 14:42 raw1
crw-rw---- 1 root root 162, 2 Oct  5 14:42 raw2
crw-rw---- 1 root root 162, 3 Oct  5 14:42 raw3

4配置系统参数

4.1修改主机名

vi /etc/hosts
192.168.0.31 ten1
192.168.0.32 ten2
192.168.0.33 ten1-vip
192.168.0.34 ten2-vip
192.168.178.31 ten1-priv
192.168.178.32 ten2-priv

vi /etc/sysconfig/network  
  ten1   ten2

hostname ten1
hostname ten2

4.2配置系统文件

--/etc/security/limits.conf 是 Linux 资源使用配置文件,用来限制用户对系统资源的使用 
--https://www.cnblogs.com/pzk7788/p/7250723.html

vi /etc/security/limits.conf
添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

vi /etc/pam.d/login 添加:
session required pam_limits.so 

设置内核参数,编辑文件并使之生效,其值不小于如下设置。
以下是参考内容
vi /etc/sysctl.conf

kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 1024  65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.shmall = 2097152
kernel.shmmax = 562511173
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr=3145728

配置生效,在全部节点操作
sysctl -p

vi /etc/profile添加:
if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
       ulimit -u 16384
       ulimit -n 65536
    else
       ulimit -u 16384 -n 65536
    fi
fi

4.3禁用SELinux、防火墙

SELinux建议禁用此功能。
vi /etc/selinux/config
SELINUX=disabled
需要重启。
防火墙禁用:
/etc/init.d/iptables stop
chkconfig iptables off

4.4 oracle用户环境变量配置

oracle用户,2个节点上配置:
vi ~/.bash_profile  编辑后source ~/.bash_profile
export TMP=/tmp 
export TMPDIR=$TMP 
export ORACLE_SID=ten1   #节点1的配置
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs
export TNS_ADMIN=$ORACLE_HOME/network/admin 
export PATH=/usr/sbin:$PATH 
export PATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib 
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 
umask 022

4.5 配置hangcheck-timer内核模块(两台)

[root@node-rac1 ~]# vi /etc/modprobe.conf 后面增加
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
启动hangcheck
[root@node-rac1 ~]# /sbin/modprobe hangcheck_timer
把/sbin/modprobe hangcheck_timer增加到/etc/rc.local自动加载
查看是否成功
[root@node-rac1 ~]# grep hangcheck /var/log/messages | tail -2
Jul 29 20:39:28 node-rac1 kernel: Hangcheck: starting hangcheck timer 0.9.0 (tick is 30 seconds, margin is 180 seconds).
上面显示成功了。

4.6 建立互信

ssh生成公钥/私钥 (oracle用户下)
ssh-keygen -t rsa -P ''
输入内容直接按回车
cd ~/.ssh
vi id_rsa.pub
将2个节点id_rsa.pub的内容,复制出来写入到2个节点的authorized_keys文件中
cd ~/.ssh
vi authorized_keys

4.7修改版本

vi /etc/redhat-release
把5.7改成4.8即可

Related Posts