Oracle RAC部署(一)

第一部分 大概的准备

1、系统环境和oracle rac版本

centos6.7

oracle 11.0.4

2、关闭防火墙,更改安全策略机制

#service itpables stop

#service ip6tables stop

#chkconfig iptables off

#chkconfig ip6tables off

#setenforce 0

 

3、两个节点node1,node2

 

第二部分 部署步骤

一、配置图形界面 node1

在xshell上要配置node1会话的属性

 

在安装GRID的节点上,本文在node1

查询有没有安装图形支持(查看可安装的组件,会有X Window System一项)

# yum grouplist

#yum -y groupinstall "X Window System"

 

下个简单的图形检测工具

#yum -y install xclock

二、创建用户、目录、权限及用户环境变量 node1、node2

#以下内容写在脚本内

# 创建用户、目录、权限

groupadd -g 1000 oinstall

groupadd -g 1020 asmadmin

groupadd -g 1021 asmdba

groupadd -g 1022 asmoper

groupadd -g 1031 dba

groupadd -g 1032 oper

useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid

useradd -u 1101 -g oinstall -G dba,asmdba,oper oracle

mkdir -p /u01/app/11.2.0/grid

mkdir -p /u01/app/grid

chown -R grid:oinstall /u01

mkdir -p /u01/app/oracle

chown oracle:oinstall /u01/app/oracle

chmod -R 775 /u01/

echo 'oracle' | passwd --stdin grid

echo 'oracle' | passwd --stdin oracle

 

 # grid用户和oracle用户的环境变量

cat >> /home/grid/.bash_profile << EOF

# Grid

ORACLE_BASE=/u01/app/grid

ORACLE_HOME=/u01/app/11.2.0/grid

ORACLE_SID=+ASM2

PATH=\$PATH:\$ORACLE_HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

EOF

 

chown grid:oinstall /home/grid/.bash_profile

 

cat >> /home/oracle/.bash_profile << EOF

# Oracle

ORACLE_SID=orcl2

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

GRID_HOME=/u01/app/11.2.0/grid

ORACLE_HOSTNAME=racl2.gisquest.com

ORACLE_UNQNAME=orcl

TNS_ADMIN=\$GRID_HOME/network/admin

LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib

CLASSPATH=\$ORACLE_HOME/jre:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib

PATH=\$PATH:\$ORACLE_HOME/bin:\$GRID_HOME/bin

export ORACLE_SID ORACLE_BASE ORACLE_HOME GRID_HOME ORACLE_HOSTNAME ORACLE_UNQNAME TNS_ADMIN LD_LIBRARY_PATH CLASSPATH

export PATH

EOF

 

chown oracle:oinstall /home/oracle/.bash_profile

 

三、配置节点网络 node1,node2

两个节点都要配置

 

 

四、DNS欺骗 node1、node2

两个节点的/usr/bin目录下的nslookup都要替换掉,执行以下命令

# nslookup

yum install bind-utils -y

mv /usr/bin/nslookup /usr/bin/nslookup.orig ; cp nslookup  /usr/bin/

 

[root@demo GRID_INSTALL]# cat nslookup 

#!/bin/bash

# nslookup

HOSTNAME=$1

if [[ $HOSTNAME = "rac1-vip" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac1-vip"

     echo "Address: 192.168.41.113"

     echo " "

elif [[ $HOSTNAME = "rac2-vip" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac2-vip"

     echo "Address: 192.168.41.114"

     echo " "

elif [[ $HOSTNAME = "rac1-vip.gisquest.com" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac1-vip.gisquest.com"

     echo "Address: 192.168.41.113"

     echo " "

elif [[ $HOSTNAME = "rac2-vip.gisquest.com" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac2-vip.gisquest.com"

     echo "Address: 192.168.41.114"

     echo " "

elif [[ $HOSTNAME = "rac1" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac1"

     echo "Address: 192.168.41.103"

     echo " "

elif [[ $HOSTNAME = "rac2" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac2"

     echo "Address: 192.168.41.104"

     echo " "

elif [[ $HOSTNAME = "rac1.gisquest.com" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac1.gisquest.com"

     echo "Address: 192.168.41.103"

     echo " "

elif [[ $HOSTNAME = "rac2.gisquest.com" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    rac2.gisquest.com"

     echo "Address: 192.168.41.104"

     echo " "

elif [[ $HOSTNAME = "cluster-scan.gisquest.com" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    cluster-scan.gisquest.com"

     echo "Address: 192.168.41.180"

     echo "Address: 192.168.41.181"

     echo "Address: 192.168.41.182"

     echo " "

elif [[ $HOSTNAME = "cluster-scan" ]]

then

     echo "Server:          223.5.5.5"

     echo "Address:         223.5.5.5#53"

     echo " "

     echo "Non-authoritative answer:"

     echo "Name:    cluster-scan"

     echo "Address: 192.168.41.180"

     echo "Address: 192.168.41.181"

     echo "Address: 192.168.41.182"

     echo " "

else

     /usr/bin/nslookup.orig $HOSTNAME

fi 

 

五、内核参数修改 node1、node2

# Kernel

cat >> /etc/sysctl.conf << EOF

# For oracle

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

EOF

 

更改完之后生效:

sysctl -p

 

 

六、用户资源限制 node1、node2

# Limit

cat >> /etc/security/limits.conf << EOF

grid             soft    nofile          1024

grid             hard    nofile          65536

grid             soft    nproc           2047

grid             hard    nproc           16384

grid             soft    stack           10240

grid             hard    stack           32768

oracle           soft    nofile          4096

oracle           hard    nofile          65536

oracle           soft    nproc           2047

oracle           hard    nproc           16384

EOF

 

七、依赖包安装 node1,node2

# Yum

yum install -y binutils compat-libcap1 compat-libstdc++-33 \

gcc gcc-c++ glibc glibc-devel libgcc libstdc++ \

libstdc++-devel libaio libaio-devel \

make sysstat unixODBC unixODBC-devel \

elfutils-libelf-devel

yum install xclock ntp unzip smartmontools libcap-devel libcap -y

yum localinstall pdksh-5.2.14-37.el5_8.1.x86_64.rpm -y

yum localinstall cvuqdisk-1.0.9-1.rpm -y

yum localinstall kmod-oracleasm-2.0.8-6.el6_7.x86_64.rpm oracleasmlib-2.0.4-1.el6.x86_64.rpm oracleasm-support-2.1.8-1.el6.x86_64.rpm -y

 

八、NTP服务 node1,node2

# Ntp

chkconfig ntpd on

echo  > /etc/sysconfig/ntpd

cat >> /etc/sysconfig/ntpd << EOF

OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

SYNC_HWCLOCK=no

NTPDATE_OPTIONS=""

EOF

 

重启ntpd服务:

/etc/init.d/ntpd restart

 

九、SSH节点互相认证 node1,node2

这个很重要,配置分别配置grid、oracle用户在两个节点的互信

#yum -y install openssh-server openssh-clients

[oracle@racl1]$ssh-keygen -t rsa

[grid@racl1]$ssh-keygen -t rsa

[oracle@racl2]$ssh-keygen -t rsa

[grid@racl2]$ssh-keygen -t rsa

 

在两个节点分别以grid和oracle用户执行,这里一个都不能落下,因为第一次连接是需要输入yes or no,会将信息写入~/.ssh/known_hosts

$exec /usr/bin/ssh-agent $SHELL

$ssh-add

$ssh rac1 date

$ssh rac2 date

$ssh rac1-priv date

$ssh rac2-priv date

 

十、ASM共享存储 node1

前期准备iscsi服务,挂载硬盘

# yum install iscsi-initiator-utils

# chkconfig iscsid on

# chkconfig iscsi on

# cat /etc/iscsi/initiatorname.iscsi

#iscsiadm -m discovery -t sendtargets -p 192.168.20.34:3260

 

然后做成ASM存储

#yum localinstall kmod-oracleasm-2.0.8-6.el6_7.x86_64.rpm oracleasmlib-2.0.4-1.el6.x86_64.rpm oracleasm-support-2.1.8-1.el6.x86_64.rpm -y

 

#格式化需要的硬盘,每个盘都要格 node1

#fidsk /dev/sda

# /etc/init.d/oracleasm configure

# /etc/init.d/oracleasm enable

#/etc/init.d/oracleasm createdisk ASM1 /dev/sda1

# /etc/init.d/oracleasm listdisks

其余节点

# /etc/init.d/oracleasm  enable

# /etc/init.d/oracleasm  scandisks

# /etc/init.d/oracleasm  listdisks

你可能感兴趣的:(oracle,rac)