Oracle 12c RAC On linux Using VMwate Workstation(安装笔记-图解)一

Oracle 12c RAC On linux Using VMwate Workstation(安装笔记-图解)一

OS版本:[红帽企业Linux.6.4.服务器版].rhel-server-6.4-x86_64

 VMware Workstation版本:VMware Workstation 10
database 版本:12.1.0.2

一、系统安装及基本配置

创建虚拟机--略

(配置网卡与共享磁盘) 











搭建RAC 磁盘必须选择立即分配所有磁盘空间,否则节点2执行root脚本过不去

根据自己需求添加盘的个数






添加的盘,加设备节点以1:0 依次向下

在vmware安装目录住找到配置文件

 

 

添加以下内容

 

disk.locking = "FALSE"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.dataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize = "4096"

diskLib.maxUnsyncedWrites = "0"

 

scsi1.present = "TRUE"

scsi1.virtualDev = "lsilogic"

scsi1.sharedBus = "VIRTUAL"

 

scsi1:0.present = "TRUE"

scsi1:0.mode = "independent-persistent"

scsi1:0.deviceType = "plainDisk"

scsi1:0.redo = ""

 

scsi1:1.present = "TRUE"

scsi1:1.mode = "independent-persistent"

scsi1:1.deviceType = "plainDisk"

scsi1:1.redo = ""

修改主机名

修改/etc/sysconfig/network中的hostname

配置IP地址

节点1:

 

Cp eth0 到 eth1 并修改



通过vmare配置查看网卡的hwaddr

 

节点2:


Cp eth0 到 eth1 并修改



关闭防火墙与selinux

[root@rac1 ~]# service iptables stop        –关闭防火墙服务
iptables: Flushing firewall rules: [  OK  ]
iptables: Setting chains to policy ACCEPT: filter [  OK  ]
iptables: Unloading modules: [  OK  ]
[root@rac1 ~]# chkconfig iptables off       –关闭下次开机自动启动

关闭selinux

A 不需要重启Linux:

[root@localhost ~]# setenforce 0

B 需要重启Linux:

vi /etc/selinux/config 将SELINUX=enforcing 改成SELINUX=disabled

service network restart (重启网络服务)


以下2个节点都需要配置--

DNS 识别IP

[root@localhost ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.133.12   12crac1

192.168.133.14   12crac1-vip

10.10.10.1       12crac1-priv

192.168.133.13   12crac2

192.168.133.15   12crac2-vip

10.10.10.2       12crac2-priv

192.168.133.8    scan-rac

~

 

 

二、检查服务器硬件和内存配置

--确定物理RAM大小

[root@localhost ~]# grep MemTotal /proc/meminfo

MemTotal:        1914688 kB

[root@localhost ~]#

 

--确定交换空间的大小

[root@localhost ~]# grep SwapTotal /proc/meminfo

SwapTotal:       4095992 kB

[root@localhost ~]#



--确认空闲磁盘空间大小

[root@localhost ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3              36G  2.3G   32G   7% /

tmpfs                 935M  228K  935M   1% /dev/shm

/dev/sda1             291M   37M  240M  14% /boot

[root@localhost ~]#

 

--确认系统版本及平台

[root@localhost ~]# uname -a

Linux yangzai 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]#

 

--确认磁盘空间

[root@localhost Packages]# df -k

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda3             36949700   6298512  28774248  18% /

tmpfs                   957344       224    957120   1% /dev/shm

/dev/sda1               297485     37263    244862  14% /boot

/dev/sr0                 49064     49064         0 100% /media/CDROM

/dev/sr1               3632776   3632776         0 100% /media/RHEL_6.4 x86_64 Disc 1

/dev/sr1               3632776   3632776         0 100% /mnt/cdrom

 

/dev/shm 空间为达到要求

[root@yangzai ~]# vi /etc/fstab

 

#

# /etc/fstab

# Created by anaconda on Thu Jan 15 08:37:10 2015

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=471d7630-2b2e-4245-bd6c-2e011d9b5ba9 /                       ext4    defaults        1 1

UUID=8480ac25-785c-4baa-8a30-27ab477bb5d8 /boot                   ext4    defaults        1 2

UUID=d5affd28-84db-4de5-937e-c841c758c937 swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults,size=1140850688        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

~

重新挂载

mount -o remount /dev/shm

 

 

[root@yangzai ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3              36G   19G   16G  56% /

tmpfs                 1.1G  635M  454M  59% /dev/shm

/dev/sda1             291M   37M  240M  14% /boot

 

三、检查系统软件包是否安装齐全

The following packages (or later versions) must be installed:

binutils-2.20.51.0.2-5.11.el6 (x86_64)

compat-libcap1-1.10-1 (x86_64)

compat-libstdc++-33-3.2.3-69.el6 (x86_64)

compat-libstdc++-33-3.2.3-69.el6 (i686)

gcc-4.4.4-13.el6 (x86_64)

gcc-c++-4.4.4-13.el6 (x86_64)

glibc-2.12-1.7.el6 (i686)

glibc-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6 (i686)

ksh

libgcc-4.4.4-13.el6 (i686)

libgcc-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6 (i686)

libstdc++-devel-4.4.4-13.el6 (x86_64)

libstdc++-devel-4.4.4-13.el6 (i686)

libaio-0.3.107-10.el6 (x86_64)

libaio-0.3.107-10.el6 (i686)

libaio-devel-0.3.107-10.el6 (x86_64)

libaio-devel-0.3.107-10.el6 (i686)

libXext-1.1 (x86_64)

libXext-1.1 (i686)

libXtst-1.0.99.2 (x86_64)

libXtst-1.0.99.2 (i686)

libX11-1.3 (x86_64)

libX11-1.3 (i686)

libXau-1.0.5 (x86_64)

libXau-1.0.5 (i686)

libxcb-1.5 (x86_64)

libxcb-1.5 (i686)

libXi-1.3 (x86_64)

libXi-1.3 (i686)

make-3.81-19.el6

sysstat-9.0.4-11.el6 (x86_64)

 

 

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \

compat-libcap1 \

compat-libstdc++ \

gcc \

gcc-c++ \

glibc \

glibc-devel \

ksh \

libgcc \

libstdc++ \

libstdc++-devel \

libaio \

libaio-devel \

libXext \

libXtst \

libX11 \

libXau \

libxcb \

libXi \

make \

sysstat

 

 

binutils-2.20.51.0.2-5.36.el6 (x86_64)

package compat-libcap1 is not installed

package compat-libstdc++ is not installed

gcc-4.4.7-3.el6 (x86_64)

package gcc-c++ is not installed

glibc-2.12-1.107.el6 (x86_64)

glibc-devel-2.12-1.107.el6 (x86_64)

package ksh is not installed

libgcc-4.4.7-3.el6 (x86_64)

libstdc++-4.4.7-3.el6 (x86_64)

package libstdc++-devel is not installed

libaio-0.3.107-10.el6 (x86_64)

package libaio-devel is not installed

libXext-1.3.1-2.el6 (x86_64)

libXtst-1.2.1-2.el6 (x86_64)

libX11-1.5.0-4.el6 (x86_64)

libXau-1.0.6-4.el6 (x86_64)

libxcb-1.8.1-1.el6 (x86_64)

libXi-1.6.1-3.el6 (x86_64)

make-3.81-20.el6 (x86_64)

sysstat-9.0.4-20.el6 (x86_64)

 

--挂载安装光盘 配置yum

 

[root@localhost ~]# mount -t iso9660 /dev/sr1  /mnt/cdrom

[root@localhost ~]# mkdir -p /rh6/cdrom

[root@localhost ~]# cp -r /mnt/cdrom   /rh6/cdrom/

 

配置yum

[root@localhost RHEL_6.4 x86_64 Disc 1]# cd /etc/yum.repos.d/

 [root@localhost yum.repos.d]# vi public-yum-o16.repo

 

[el6_base]

name=Red Hat Enterprise Linux 6.4

baseurl=file:///rh6/cdrom/cdrom/Packages/

gpgcheck=0

enabled=1

#gpgkey=file:/rh6/cdrom/cdrom/RPM-GPG-KEY-redhat-beta

 

 

[root@yangzai ~]# cd /rh6/cdrom/cdrom/Packages

[root@yangzai Packages]# createrepo .

-bash: createrepo: command not found

缺少createrepo-包

[root@yangzai Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing...                ########################################### [100%]

   1:deltarpm               ########################################### [100%]

[root@yangzai Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing...                ########################################### [100%]

   1:python-deltarpm        ########################################### [100%]

[root@yangzai Packages]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm

warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing...                ########################################### [100%]

   1:createrepo             ########################################### [100%]

[root@yangzai Packages]#

[root@yangzai Packages]# createrepo .

Spawning worker 0 with 3720 pkgs

Workers Finished

Gathering worker results

 

Saving Primary metadata

Saving file lists metadata

Saving other metadata

Generating sqlite DBs

Sqlite DBs complete

[root@yangzai Packages]#

 

--安装缺少的包

[root@yangzai Packages]# yum install compat-libcap1*

[root@yangzai Packages]# yum install compat-libstdc++*

[root@yangzai Packages]# yum install gcc-c++*

[root@yangzai Packages]# yum install ksh*

[root@yangzai Packages]# yum install libstdc++*

[root@yangzai Packages]# yum install libaio-*

[root@yangzai Packages]# yum install libXext-1.3.1-2*

[root@yangzai Packages]# yum install libXtst-1.2.1-2*

[root@yangzai Packages]#yum install nfs-utils-1.2.3-36.el6.x86_64.rpm

--再次检查

[root@localhost yum.repos.d]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel libXext libXtst libX11 libXau libxcb libXi make sysstat

binutils-2.20.51.0.2-5.36.el6 (x86_64)

compat-libcap1-1.10-1 (x86_64)

compat-libcap1-1.10-1 (i686)

compat-libstdc++-33-3.2.3-69.el6 (i686)

compat-libstdc++-33-3.2.3-69.el6 (x86_64)

gcc-4.4.7-3.el6 (x86_64)

gcc-c++-4.4.7-3.el6 (x86_64)

glibc-2.12-1.107.el6 (x86_64)

glibc-2.12-1.107.el6 (i686)

glibc-devel-2.12-1.107.el6 (x86_64)

glibc-devel-2.12-1.107.el6 (i686)

ksh-20100621-19.el6 (x86_64)

libgcc-4.4.7-3.el6 (x86_64)

libgcc-4.4.7-3.el6 (i686)

libstdc++-4.4.7-3.el6 (x86_64)

libstdc++-4.4.7-3.el6 (i686)

libstdc++-devel-4.4.7-3.el6 (x86_64)

libstdc++-devel-4.4.7-3.el6 (i686)

libaio-0.3.107-10.el6 (x86_64)

libaio-0.3.107-10.el6 (i686)

libaio-devel-0.3.107-10.el6 (x86_64)

libaio-devel-0.3.107-10.el6 (i686)

libXext-1.3.1-2.el6 (x86_64)

libXext-1.3.1-2.el6 (i686)

libXtst-1.2.1-2.el6 (x86_64)

libXtst-1.2.1-2.el6 (i686)

libX11-1.5.0-4.el6 (x86_64)

libX11-1.5.0-4.el6 (i686)

libXau-1.0.6-4.el6 (x86_64)

libXau-1.0.6-4.el6 (i686)

libxcb-1.8.1-1.el6 (x86_64)

libxcb-1.8.1-1.el6 (i686)

libXi-1.6.1-3.el6 (x86_64)

libXi-1.6.1-3.el6 (i686)

make-3.81-20.el6 (x86_64)

sysstat-9.0.4-20.el6 (x86_64)

[root@localhost yum.repos.d]#

四、创建用户与组

/usr/sbin/groupadd -g 400 oinstall

/usr/sbin/groupadd -g 401 dba

/usr/sbin/groupadd -g 402 asmadmin

/usr/sbin/groupadd -g 403 asmdba

/usr/sbin/groupadd -g 404 asmoper

/usr/sbin/groupadd -g 405 oper

 

 

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

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

 

#passwd oracle

#passwd grid

 

 

五、配置内核参数和资源限制

Parameter

Value

File

semmsl

semmns

semopm

semmni

250

32000

100

128

/proc/sys/kernel/sem

shmall

2097152

/proc/sys/kernel/shmall

shmmax

Half the size of physical memory (in bytes)

/proc/sys/kernel/shmmax

shmmni

4096

/proc/sys/kernel/shmmni

file-max

6815744

/proc/sys/fs/file-max

ip_local_port_range

Minimum:9000

Maximum: 65500

/proc/sys/net/ipv4/ip_local_port_range

rmem_default

262144

/proc/sys/net/core/rmem_default

rmem_max

4194304

/proc/sys/net/core/rmem_max

wmem_default

262144

/proc/sys/net/core/wmem_default

wmem_max

1048576

/proc/sys/net/core/wmem_max

aio-max-nr

1048576

/proc/sys/fs/aio-max-nr

 

 

 

--编辑/etc/sysctl.conf添加

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 1073741824

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

kernel.panic_on_oops = 1

 

使参数生效

/sbin/sysctl -p

 

注意: SUSE系统上,必须输入oinstall组的GID为参数的值/proc/sys/vm/hugetlb_shm_group

 

echo 501 > /proc/sys/vm/hugetlb_shm_group

 

编辑/etc/sysctl.conf 添加

vm.hugetlb_shm_group=501

 

设置读取/etc/sysctl.conf时重启

/sbin/chkconfig boot.sysctl on

 

六、添加软件安装用户资源限制

--编辑/etc/security/limits.conf 添加

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

 

 

--编辑/etc/pam.d/login 添加

session required pam_limits.so

 

-- Bourne,Bash或Korn shell在/etc/profile文件添加

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

 

 

--若为C shell(csh或tcsh的),添加以下几行到/ etc / csh.login

if ( $USER == "oracle" ) then

        limit maxproc 16384

        limit descriptors 65536

endif

 

 

七、配置软件所有者的目录及环境

--创建目录

[root@yangzai ~]# mkdir -p /oracle/app/oracle

[root@yangzai ~]# chown -R oracle:oinstall /oracle/app/oracle

[root@yangzai ~]# chmod -R 775 /oracle/app/oracle

[root@yangzai ~]# mkdir -p /oracle/app/oracle/product/12.1.0

[root@yangzai ~]# chown -R oracle:oinstall /oracle/app/oracle/product/12.1.0/

[root@yangzai ~]# chmod -R 775 /oracle/app/oracle/product/12.1.0/

 

[root@yangzai ~]# mkdir -p /grid/app/grid

[root@yangzai ~]# chown -R grid:oinstall /grid/app/grid

[root@yangzai ~]# chmod -R 775 /grid/app/grid

[root@yangzai ~]# mkdir -p /grid/app/grid/12.1.0

[root@yangzai ~]# chown -R grid:oinstall /grid/app/grid/12.1.0/

[root@yangzai ~]# chmod -R 775 /grid/app/grid/12.1.0/

 

--设置环境变量

节点1:

[oracle@yangzai ~]$ vi .bash_profile

 

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=/oracle/app/oracle/product/12.1.0

export ORACLE_SID=qiudb1

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch

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

export DISPLAY=192.168.133.1:0.0

 

~

 

 

Grid

 

export ORACLE_BASE=/grid/app/grid

export ORACLE_HOME=/grid/app/grid/12.1.0

export ORACLE_SID=+ASM1

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch

export DISPLAY=192.168.133.1:0.0

 

节点2:

[oracle@yangzai ~]$ vi .bash_profile

 

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=/oracle/app/oracle/product/12.1.0

export ORACLE_SID=qiudb2

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch

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

export DISPLAY=192.168.133.1:0.0

 

~

 

 

Grid

 

export ORACLE_BASE=/grid/app/grid

export ORACLE_HOME=/grid/app/grid/12.1.0

export ORACLE_SID=+ASM2

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch

export DISPLAY=192.168.133.1:0.0

 

八、使用udev绑定磁盘代替ASMLIB

--在vmware 中修改配置文件 添加

disk.EnableUUID="TRUE"

--重启系统

[root@yangzai ~]# reboot

 

Broadcast message from root@yangzai

        (/dev/pts/0) at 22:23 ...

 

The system is going down for reboot NOW!

[root@yangzai ~]#

 

 

--获取UUID 并绑定 (节点2同样需求配置)

 

[root@12crac1dev]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

36000c299a122373974d0976ff6ab876e

[root@12crac1 dev]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc

36000c29eca9b807acad3e76806635408

 

[root@12crac1 ~]# cd /etc/udev/rules.d/

[root@12crac1 rules.d]# ls

60-fprint-autosuspend.rules  70-persistent-cd.rules   90-hal.rules               99-fuse.rules

60-pcmcia.rules              70-persistent-net.rules  97-bluetooth-serial.rules  99-vmware-scsi-udev.rules

60-raw.rules                 90-alsa.rules            98-kexec.rules

[root@yangzai rules.d]# vi 99-oracle-asmdevices.rules

 

KERNEL=="sdb", BUS=="scsi",PROGRAM=="//sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c299a122373974d0976ff6ab876e",NAME="asm-disk1",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="sdc", BUS=="scsi",PROGRAM=="//sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29eca9b807acad3e76806635408",NAME="asm-disk2",OWNER="grid",GROUP="asmadmin",MODE="0660"

[root@yangzai rules.d]# vi /etc/scsi_id.config

options=-g

~

--启动udev

[root@12crac1 rules.d]# start_udev

Starting udev: [  OK  ]

[root@yangzai rules.d]#

 

--检验

[root@12crac1 dev]# ls -ltr /dev/asm*

brw-rw---- 1 grid asmadmin 8, 32 Jan 14 19:07 /dev/asm-disk2

brw-rw---- 1 grid asmadmin 8, 16 Jan 14 19:17 /dev/asm-disk1

[root@12crac1 dev]#

posted @ 2020-05-01 11:10  耀阳居士  阅读(178)  评论(0编辑  收藏  举报