Oracle RAC部署过程

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle RAC部署过程相关的知识,希望对你有一定的参考价值。

Oracle RAC部署过程



lsb_release -a

vmware-vdiskmanager.exe -c -s 20000Mb -a lsilogic -t 2 D:\Oracle_RAC\ocr.vmdk

vmware-vdiskmanager.exe -c -s 20000Mb -a lsilogic -t 2 D:\Oracle_RAC\ocr2.vmdk

vmware-vdiskmanager.exe -c -s 20000Mb -a lsilogic -t 2 D:\Oracle_RAC\votingdisk.vmdk

vmware-vdiskmanager.exe -c -s 30000Mb -a lsilogic -t 2 D:\Oracle_RAC\data.vmdk

vmware-vdiskmanager.exe -c -s 20000Mb -a lsilogic -t 2 D:\Oracle_RAC\backup.vmdk

RAC1

-----------------------------------------------

配置虚拟机RAC1 RAC2目录下的vmx虚拟机配置文件,在行最后添加如下:

scsi1.present = "TRUE"

scsi1.virtualDev = "lsilogic"

scsi1.sharedBus = "virtual"

scsi1:1.present = "TRUE"

scsi1:1.mode = "independent-persistent"

scsi1:1.filename = "D:\Oracle_RAC\ocr.vmdk"

scsi1:1.deviceType = "plainDisk"

scsi1:2.present = "TRUE"

scsi1:2.mode = "independent-persistent"

scsi1:2.filename = "D:\Oracle_RAC\votingdisk.vmdk"

scsi1:2.deviceType = "plainDisk"

scsi1:3.present = "TRUE"

scsi1:3.mode = "independent-persistent"

scsi1:3.filename = "D:\Oracle_RAC\data.vmdk"

scsi1:3.deviceType = "plainDisk"

scsi1:4.present = "TRUE"

scsi1:4.mode = "independent-persistent"

scsi1:4.filename = "D:\Oracle_RAC\backup.vmdk"

scsi1:4.deviceType = "plainDisk"

scsi1:5.present = "TRUE"

scsi1:5.mode = "independent-persistent"

scsi1:5.filename = "D:\Oracle_RAC\ocr2.vmdk"

scsi1:5.deviceType = "plainDisk"

disk.locking = "false"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.DataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize = "4096"

diskLib.maxUnsyncedWrites = "0"

-----------------------------------------------

关闭selinux

setenforce 0   

[[email protected] ~]# vi /etc/selinux/config

SELINUX=disabled

关闭防火墙

service iptables stop

chkconfig iptables off

卸载NTP服务

[[email protected] ~]# rpm -qa |grep ntp

[[email protected] ~]# rpm -e --nodeps  ntp-4.2.6p5-1.el6.centos.x86_64

[[email protected] ~]# rpm -e --nodeps  ntpdate-4.2.6p5-1.el6.centos.x86_64

[[email protected] ~]#mv /etc/ntp.conf /etc/ntp.conf.bak

---------------------------------------------------

hostname rac1

hostname rac2

RAC1

eth0 192.168.100.103

eht1 10.10.10.100

RAC2

eth0 192.168.100.104

eth1 10.10.10.101

vi /etc/sysconfig/network

------------------------------------

vi /etc/hosts

192.168.100.103 rac1

192.168.100.104 rac2

192.168.100.105 rac1-vip

192.168.100.108 rac2-vip

10.10.10.100   rac1-priv

10.10.10.101   rac2-priv

192.168.100.88  scan-ip

----------------------------------

创建相关用户:

groupadd -g 1300 dba

groupadd -g 1301 oper

groupadd -g 1000 oinstall

groupadd -g 1200 asmadmin

groupadd -g 1201 asmdba

groupadd -g 1202 asmoper

useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -s /bin/bash grid  

useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -s /bin/bash oracle

设置相关账户密码:

passwd oracle  passwd grid

RAC1 RAC2相互配置ssh免秘钥登陆

在用户root oracle grid执行以下2行命令:

RAC1、RAC2:

ssh-keygen -t rsa

ssh-keygen -t dsa

切换用户配置以下ssh命令:

su - oracle

su - grid

RAC1

[[email protected] ~]$

ssh rac1 cat ~/.ssh/id_rsa.pub >> authorized_keys

ssh rac2 cat ~/.ssh/id_rsa.pub >> authorized_keys

ssh rac1 cat ~/.ssh/id_dsa.pub >> authorized_keys

ssh rac2 cat ~/.ssh/id_dsa.pub >> authorized_keys

[[email protected] .ssh]$ scp authorized_keys rac2:~/.ssh/

[[email protected] .ssh]$ chmod 600 authorized_keys

RAC2:

[[email protected] ~]$

ssh rac2 cat ~/.ssh/id_rsa.pub >> authorized_keys

ssh rac1 cat ~/.ssh/id_rsa.pub >> authorized_keys

ssh rac2 cat ~/.ssh/id_dsa.pub >> authorized_keys

ssh rac1 cat ~/.ssh/id_dsa.pub >> authorized_keys

[[email protected] .ssh]$ scp authorized_keys rac1:~/.ssh/

[[email protected] .ssh]$ chmod 600 authorized_keys

ssh rac1 date

ssh rac2 date

ssh rac1-priv date

ssh rac2-priv date

---------------------------------------------------

配置目录

mkdir -p  /u01/app/11.2.0/grid

mkdir -p /u01/app/grid

mkdir -p /u01/app/oracle

chown -R grid:oinstall /u01

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

chown grid:oinstall /u01/app/grid

chown oracle:oinstall /u01/app/oracle

chmod -R 775 /u01/

--------------------------------------------------

设置内核文件:

vi /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4398046511104

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 = 1048586

net.ipv4.tcp_wmem = 262144 262144 262144

net.ipv4.tcp_rmem = 4194304 4194304 4194304

参考值:

kernel.shmmax =1054472192 (参考值)

sysctl -p 立即生效

----------------------------------------------

配置系统文件

vi /etc/security/limits.conf

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

-------------------------------------------------

配置grid和oracle用户环境变量

su - oracle

ORACLE环境变量

vi .bash_profile

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_SID=orcl1  # RAC1

export ORACLE_SID=orcl2  # RAC2

export ORACLE_UNQNAME=orcl

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export TNS_ADMIN=$ORACLE_HOME/network/admin

export PATH=/usr/sbin:$PATH

export PATH=$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

使配置文件生效 source .bash_profile

GRID环境变量

su - grid

vi .bash_profile

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_SID=+ASM1  # RAC1

# export ORACLE_SID=+ASM2  # RAC2 配置一个即可

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid

export PATH=/usr/sbin:$PATH

export PATH=$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

使配置文件生效 source .bash_profile

配置login

[[email protected] ~]# vi /etc/pam.d/login

session required pam_limits.so

-------------------------------------

配置裸盘:

查看未格式化的磁盘

fdisk -l

ls /dev/sd*

fdisk格式化命令:

fdisk /dev/sdb

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

最后 w 命令保存更改

Command (m for help): w

依次执行:

fdisk /dev/sdb

fdisk /dev/sdd

fdisk /dev/sdc

fdisk /dev/sdf

fdisk /dev/sde

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

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

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

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

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

ACTION=="add",KERNEL=="/dev/sdd1",RUN+='/bin/raw /dev/raw/raw3 %N"

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

ACTION=="add",KERNEL=="/dev/sde1",RUN+='/bin/raw /dev/raw/raw4 %N"

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

ACTION=="add",KERNEL=="/dev/sdf1",RUN+='/bin/raw /dev/raw/raw5 %N"

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

ACTION=="add",KERNEL=="raw[1-5]",OWNER="grid",GROUP="asmadmin",MODE="660"

在RAC1和RAC2执行下同步命令:partprobe

执行这个命令查看下:ll /dev/raw/raw*

查看裸盘信息:

[[email protected] ~]# lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda      8:0    0   40G  0 disk

├─sda1   8:1    0 1000M  0 part /boot

├─sda2   8:2    0  3.9G  0 part [SWAP]

└─sda3   8:3    0 35.1G  0 part /

sdb      8:16   0 19.5G  0 disk

└─sdb1   8:17   0 19.5G  0 part

sdc      8:32   0 19.5G  0 disk

└─sdc1   8:33   0 19.5G  0 part

sdd      8:48   0 29.3G  0 disk

└─sdd1   8:49   0 29.3G  0 part

sde      8:64   0 19.5G  0 disk

└─sde1   8:65   0 19.5G  0 part

sdf      8:80   0 19.5G  0 disk

└─sdf1   8:81   0 19.5G  0 part

sr0     11:0    1  4.2G  0 rom  

挂载光驱

mount /dev/sr0 /media/CentOS_6.5_Final (参考命令:mount /dev/cdrom /mnt/cdrom/ )

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

[dvd]

name=dvd

baseurl=file:///media/CentOS_6.5_Final

gpgcheck=0

enabled=1

:wq!

安装依赖包:

[[email protected] ~]# yum clean all

[[email protected] ~]# yum makecache

[[email protected] ~]# yum install gcc gcc-c++ glibc* glibc-devel* ksh libgcc* libstdc++* libstdc++-devel* make sysstat

yum install binutils-2* compat-libcap1-1* compat-libstdc* gcc-4* gcc-c++-4* glibc-2* glibc-devel-2* libgcc-4* libstdc++-4* libstdc++-devel-4* libaio-0* libaio-devel-0* make-3* sysstat-9* -y

mv /etc/yum.repos.d/CentOS-Base.repo  /root

mv /etc/yum.repos.d/CentOS-Debuginfo.repo  /root

mv /etc/yum.repos.d/CentOS-Media.repo  /root

mv /etc/yum.repos.d/CentOS-Vault.repo  /root

cp /root/CentOS-Base.repo /etc/yum.repos.d

cp /root/CentOS-Debuginfo.rep /etc/yum.repos.d

cp /root/CentOS-Media.repo /etc/yum.repos.d

cp /root/CentOS-Vault.repo /etc/yum.repos.d

yum install -y glibc-devel-2.12-1.209.el6_9.2.i686

yum install -y libstdc++-4.4.7-18.el6.i686

yum install -y glibc.i686  glibc.x86_64

yum install -y elfutils-libelf-devel.i686

yum install -y elfutils-libelf*

进grid下面安装

cvuqdisk包

xhost +  #使所有用户都能访问图形桌面,这步需要在图形界面操作

date -s 18:00:00

/u01/app/oraInventory/orainstRoot.sh

/u01/app/11.2.0/grid/root.sh

---------------------------------------------------------

/u01/app/11.2.0/grid/crs/install/crsconfig_params

[[email protected] grid]# /u01/app/11.2.0/grid/root.sh

Running Oracle 11g root.sh script...

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)

[n]: y

   Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)

[n]: y

   Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)

[n]: y

y   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

2017-08-03 18:31:49: Parsing the host name

2017-08-03 18:31:49: Checking for super user privileges

2017-08-03 18:31:49: User has super user privileges

Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

CRS is already configured on this node for crshome=0

Cannot configure two CRS instances on the same cluster.

Please deconfigure before proceeding with the configuration of new home.

[[email protected] grid]#

卸载命令

$GRID_HOME/crs/install/roothas.pl -delete -force -verbose

/u01/app/11.2.0/grid/crs/install/rootcrs.pl -delete -force -verbose

Existing OCR configuration found, aborting the configuration. Rerun configuration setup after deinstall at /u01/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 10302.

确定RAC是否OK

su  - grid

crsctl status resource -t



以上是关于Oracle RAC部署过程的主要内容,如果未能解决你的问题,请参考以下文章

Oracle RAC部署过程

Goldengate 部署oracle10g在 rac asm环境,完整教程

oracle11g-rac安装部署

Oracle RAC安装部署文档

oracle 集群RAC搭建--grid部署

ORACLE RAC部署实录:ORACLE ASMLIB