RHEL 7.6 安裝 Oracle 18c RAC

 

RHEL 7.6 安裝 Oracle 18c RAC

 

第一部分 安裝規劃python

虛擬環境linux

VirtualBox 6.0ios

OS 版本c++

Red Hat Enterprise Linux Server release 7.6 (Maipo)shell

數據庫版本數據庫

18.3.0.0.0bash

安裝介質網絡

LINUX.X64_180000_db_home.zipsession

LINUX.X64_180000_grid_home.ziporacle

軟件安裝目錄

grid: /u01/app/18.0.0/grid

oracle: /u01/app/oracle/product/18.0.0/db_1

用戶和組

grid: oinstall,asmadmin,asmdba,racdba,asmoper

oracle: oinstall, dba,asmdba,backupdba,dgdba,kmdba,racdba,oper

網絡規劃

192.168.56.11  rac1     #一節點public ip

192.168.56.12  rac2     #二節點public ip

 

192.168.56.13  rac1-vip  #一節點virtual ip

192.168.56.14  rac2-vip  #二節點virtual ip

 

172.16.56.11  rac1-priv  #一節點private ip

172.16.56.12  rac2-priv  #二節點private ip

 

192.168.56.15 rac-scan   # scan ip

ASM磁盤組

OCRVT: 2G * 3

MGMT: 40G * 1

DATA: 8G * 1

ARCH: 5G * 1

 

安裝操做系統,添加ASM共享磁盤省略

 

第二分部 操做系統環境配置

 

2.1 更改IO調度爲deadline,關閉numa和透明大頁

 

 

(1).vi /etc/default/grub(編輯 /etc/default/grub 文件,在GRUB_CMDLINE_LINUX 條目後面添加"elevator=deadline","transparent_hugepage=never" 和」numa=off」,

執行grub2-mkconfig -o /boot/grub2/grub.cfg 最後重啓操做系統)

 

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet elevator=deadline transparent_hugepage=never numa=off net.ifnames=0 biosdevname=0"

 

grub2-mkconfig -o /boot/grub2/grub.cfg

 

(2). 重啓操做系統使配置生效.

 

2.2 使用CTSS時鐘同步

/sbin/service ntpd stop

chkconfig ntpd off

mv /etc/ntp.conf /etc/ntp.conf.org

 

systemctl stop chronyd

systemctl disable chronyd

 

2.3 配置/etc/hosts解析表

 

vi  /etc/hosts添加

#config for 18c RAC

 

192.168.56.11 rac1

192.168.56.12 rac2

 

192.168.56.13 rac1-vip

192.168.56.14 rac2-vip

 

172.16.56.11  rac1-priv

172.16.56.12  rac2-priv

 

192.168.56.15 rac-scan

 

2.4 關閉防火牆

systemctl disable firewalld.service

systemctl stop firewalld.service

 

2.5 關閉selinux

 

vi  /etc/selinux/config

 

SELINUX=disabled

 

2.6 關閉NetworkManager

 

systemctl disable NetworkManager

systemctl stop NetworkManager

 

2.7 中止avahi-daemon

systemctl stop avahi-daemon.socket avahi-daemon.service

systemctl disable avahi-daemon.socket avahi-daemon.service

 

2.8 配置NOZEROCONF

vi  /etc/sysconfig/network  添加

 

NOZEROCONF=yes

 

2.9 內核參數修改

vi /etc/sysctl.conf

 

#kernel configuration for oracle 18c

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 268435456

kernel.shmmax = 549755813760

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

 

是配置生效

 

sysctl -p

 

 

2.10 添加用戶和組

/usr/sbin/groupadd -g 54321 oinstall

/usr/sbin/groupadd -g 54322 dba

/usr/sbin/groupadd -g 54323 oper

/usr/sbin/groupadd -g 54324 backupdba

/usr/sbin/groupadd -g 54325 dgdba

/usr/sbin/groupadd -g 54326 kmdba

/usr/sbin/groupadd -g 54327 asmdba

/usr/sbin/groupadd -g 54328 asmoper

/usr/sbin/groupadd -g 54329 asmadmin

/usr/sbin/groupadd -g 54330 racdba

 

/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle

/usr/sbin/useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba,asmoper grid

 

echo oracle | passwd --stdin oracle

echo oracle | passwd --stdin grid

 

2.11 建立軟件安裝目錄

mkdir -p /u01/app/18.0.0/grid

mkdir -p /u01/app/grid

mkdir -p /u01/app/oracle/product/18.0.0/db_1

chown -R grid:oinstall /u01

chown -R oracle:oinstall /u01/app/oracle

chmod -R 775 /u01/

 

2.12 用戶環境變量配置

#爲grid用戶添加環境變量

vi  /home/grid/.bash_profile EOF

export ORACLE_BASE=/u01/app/grid

export ORACLE_SID=+ASM1 (節點2改成+ASM2)

export ORACLE_HOME=/u01/app/18.0.0/grid

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

EOF

source /home/grid/.bash_profile

 

#爲oracle用戶添加環境變量

vi  /home/oracle/.bash_profile

export ORACLE_BASE=/u01/app/oracle

export ORACLE_SID=racdb1(節點2改成racdb2)

export ORACLE_HOME=$ORACLE_BASE/product/18.0.0/db_1

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

EOF

source /home/oracle/.bash_profile

2.13 配置用戶資源限制

vi /etc/security/limits.conf 添加

 

oracle    soft    nproc   2047

oracle    hard    nproc   16384

oracle    soft    nofile  1024

oracle    hard    nofile  65536

oracle    soft    stack   10240

oracle    hard  memlock  3145728

oracle    soft  memlock  3145728

 

grid    soft    nproc   2047

grid    hard    nproc   16384

grid    soft    nofile  1024

grid    hard    nofile  65536

grid    soft    stack   10240

grid    hard  memlock  3145728

grid    soft  memlock  3145728

 

 

vi /etc/pam.d/login  添加

 

#this is for oracle user

session    required     pam_limits.so

 

2.14 配置全局profile 

vi  /etc/profile 添加

 

#this is for oracle user

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

 

2.15 安裝rpm依賴包

yum -y install bc \

binutils \

compat-libcap1 \

compat-libstdc++-33.i686 \

compat-libstdc++-33.x86_64 \

glibc.i686 \

glibc.x86_64 \

glibc-devel.i686 \

glibc-devel.x86_64 \

ksh \

libaio.i686 \

libaio.x86_64 \

libaio-devel.i686 \

libaio-devel.x86_64 \

libX11.i686 \

libX11.x86_64 \

libXau.i686 \

libXau.x86_64 \

libXi.i686 \

libXi.x86_64 \

libXtst.i686 \

libXtst.x86_64 \

libXrender-devel.i686 \

libXrender-devel.x86_64 \

libXrender.i686 \

libXrender.x86_64 \

libgcc.i686 \

libgcc.x86_64 \

libstdc++.i686 \

libstdc++.x86_64 \

libstdc++-devel.i686 \

libstdc++-devel.x86_64 \

libxcb.i686 \

libxcb.x86_64 \

make \

nfs-utils.x86_64 \

net-tools \

python \

python-configshell \

python-rtslib \

python-six \

smartmontools \

sysstat \

targetcli \

unixODBC \

unixODBC-devel \

unzip

 

 

 

CVUQDISK_GRP=oinstall; export CVUQDISK_GRP

rpm -iv /u01/app/18.0.0/grid/cvuqdisk-1.0.10-1.rpm   (需先解壓grid安裝包到/u01/app/18.0.0/grid)

 

 

2.16 共享存儲配置

 

(1).多路徑方式安裝配置

 

yum -y install device-mapper*

 

 

--生成默認配置文件

 

mpathconf --enable

 

vi /etc/multipath.conf 修改

 

find_multipaths no

 

multipaths {

       multipath {

               wwid                    14f504e46494c455257374a5968312d784f45542d54754171

               alias                   OCR1

       }

       multipath {

               wwid                    14f504e46494c455257374a5968312d784f45542d54754172

               alias                   OCR2

       }

       multipath {

               wwid                    14f504e46494c455257374a5968312d784f45542d54754173

               alias                   OCR3

       } 

       multipath {

               wwid                    14f504e46494c455257374a5968312d784f45542d54754174

               alias                   MGMT

       }                  

       multipath {

               wwid                    14f504e46494c4552325354736c632d783567742d47557662

               alias                   DATA

       }

              multipath {

               wwid                    14f504e46494c45526a62644c70392d65744b562d38524967

               alias                   ARCH

       }

}

 

multipath -F

 

systemctl restart multipathd.service

multipath -v3

 

vi  /etc/udev/rules.d/99-oracle-asmdevices.rules

 

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754171",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754172",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754173",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754174",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c4552325354736c632d783567742d47557662",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c45526a62644c70392d65744b562d38524967",OWNER="grid",GROUP="asmadmin",MODE="0660"

 

udevadm trigger

udevadm control -R

systemctl restart systemd-udevd.service

 

 

(2).不使用多路徑的方式,僅需配置以下文件(本次安裝是測試環境,磁盤沒有多條路徑,無需使用多路徑方式)

 

vi  /etc/udev/rules.d/99-oracle-asmdevices.rules

 

KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB5643659c-65a9d79a",SYMLINK+="asm-diskb",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB603d9ec9-7c3a2db0",SYMLINK+="asm-diskc",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBc74f578a-aa1a566c",SYMLINK+="asm-diskd",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBcje8jg2a-ff4e14d3",SYMLINK+="asm-diske",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBcaeggcdb-3gv5hnc6",SYMLINK+="asm-diskf",OWNER="grid",GROUP="asmadmin",MODE="0660"

KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBccbd112b-egdgrkr5",SYMLINK+="asm-diskg",OWNER="grid",GROUP="asmadmin",MODE="0660"

 

#使udev策略配置生效

 

udevadm trigger

udevadm control -R

systemctl restart systemd-udevd.service

 

 

[root@rac1 ~]# ll /dev/asm*

lrwxrwxrwx 1 root root       3 Mar 25 14:53 /dev/asm-diskb -> sdb

lrwxrwxrwx 1 root root       3 Mar 25 14:53 /dev/asm-diskc -> sdc

lrwxrwxrwx 1 root root       3 Mar 25 15:06 /dev/asm-diskd -> sdd

lrwxrwxrwx 1 root root       3 Mar 25 15:06 /dev/asm-diske -> sde

lrwxrwxrwx 1 root root       3 Mar 25 15:06 /dev/asm-diskf -> sdf

 

[root@rac1 ~]# ll /dev/sd*

brw-rw---- 1 grid asmadmin 8, 16 Mar 25 15:07 /dev/sdb

brw-rw---- 1 grid asmadmin 8, 32 Mar 25 15:07 /dev/sdc

brw-rw---- 1 grid asmadmin 8, 48 Mar 25 15:07 /dev/sdd

brw-rw---- 1 grid asmadmin 8, 64 Mar 25 15:07 /dev/sde

brw-rw---- 1 grid asmadmin 8, 80 Mar 25 15:07 /dev/sdf

 

 

 

第三部分 安裝GRID軟件

 

3.1 解壓軟件

 

unzip LINUX.X64_180000_grid_home.zip -d /u01/app/18.0.0/grid

 

3.2 配置用戶ssh對等性(方便檢查rac2節點配置,也能夠OUI界面配置)

su - grid

cd /u01/app/18.0.0/grid/oui/prov/resources/scripts

./sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced –noPromptPassphrase

 

3.3 安裝前環境預檢查

su - grid

cd /u01/app/18.0.0/grid

./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup –verbose

 

3.4 開始安裝grid軟件

export DISPLAY=192.168.56.1:0.0

cd /u01/app/18.0.0/grid

./gridSetup.sh

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

分別在rac1,rac2執行上面2個腳本

 

 

執行完成後,點擊OK繼續完成安裝。

 

 

INS-20802 報錯能夠忽略

 

 

至此grid軟件安裝完成。

 

 

第四部分 建立ASM磁盤組

 

su - grid

export DISPLAY=192.168.56.1:0.0

asmca

 

建立DATA和ARCH磁盤組

 

 

 

 

 

第五部分 安裝database軟件

 

5.1 解壓db軟件

 

su - oracle

unzip /soft/LINUX.X64_180000_db_home.zip –d /u01/app/oracle/product/18.0.0/db_1

 

5.2 開始安裝db軟件

su - oracle

export DISPLAY=192.168.56.1:0.0

cd /u01/app/oracle/product/18.0.0/db_1

./runInstaller

 

 

 

 若是前面沒有配置oracle用戶的ssh對等性,則輸入oracle用戶密碼,點擊setup進行配置

 

 

 

 

 

 

 

 

 

 

分別在rac1,rac2節點執行/u01/app/oracle/product/18.0.0/db_1/root.sh腳本

 

 

至此database軟件安裝完成。

 

 

第六部分 建立數據庫

su - oracle

export DISPLAY=192.168.56.1:0.0

dbca

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

至此dbca建立數據庫完成。

相關文章
相關標籤/搜索