Oracle 12c RAC On linux Using VMwate Workstation(安裝筆記-圖解)一

邱東陽發表於2015-01-30

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]#


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29532781/viewspace-1420850/,如需轉載,請註明出處,否則將追究法律責任。

相關文章