Oracle 19c RAC Linux 7.9 Install

最新学习Oracle 19c RAC的知识,照着Oracle Base等文档过了一下安装过程,留个记录。

一、先决条件--主机配置--两台主机都操作

1、设置主机名和映射--双网卡,生成唯一id:linux 命令uuidgen 需要公有网卡和私用网卡各一块

vi /etc/hosts

127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4

::1        localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.137.31 rac1

192.168.222.180 rac1-priv

192.168.137.33 rac1-vip

192.168.137.32 rac2

192.168.222.181 rac2-priv

192.168.137.34 rac2-vip

192.168.137.35 rac-scan

hostnamectl set-hostname rac1

hostnamectl --static set-hostname rac1

hostnamectl set-hostname rac2

hostnamectl --static set-hostname rac2

more  /etc/hostname

[root@rac1 network-scripts]# ifconfig

ens33: flags=4163  mtu 1500

        inet 192.168.137.31  netmask 255.255.255.0  broadcast 192.168.137.255

        inet6 fe80::98df:e726:8bbc:a3d8  prefixlen 64  scopeid 0x20

        ether 00:0c:29:a8:11:a6  txqueuelen 1000  (Ethernet)

        RX packets 1489  bytes 126187 (123.2 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 954  bytes 153488 (149.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens39: flags=4163  mtu 1500

        inet 192.168.222.180  netmask 255.255.255.0  broadcast 192.168.222.255

        inet6 fe80::7807:cc0f:1959:2fc3  prefixlen 64  scopeid 0x20

        ether 00:0c:29:a8:11:b0  txqueuelen 1000  (Ethernet)

        RX packets 85  bytes 5272 (5.1 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 26  bytes 1948 (1.9 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 5  bytes 448 (448.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 5  bytes 448 (448.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2、新建账号和组

/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,oper oracle

/usr/sbin/useradd -u 54322 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,asmoper,asmadmin,racdba grid

echo "oracle" | passwd --stdin oracle

echo "grid" | passwd --stdin grid

3、关闭防火墙和selinux

防火墙:

[root@rac1 ~]# systemctl stop firewalld.service

[root@rac1 ~]# systemctl disable firewalld.service

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@rac1 ~]#

关闭SELINUX:

[root@rac1 ~]# sed -i  "s/SELINUX=enforcing/SELINUX=disabled/"  /etc/selinux/config

[root@rac1 ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#    enforcing - SELinux security policy is enforced.

#    permissive - SELinux prints warnings instead of enforcing.

#    disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of three values:

#    targeted - Targeted processes are protected,

#    minimum - Modification of targeted policy. Only selected processes are protected.

#    mls - Multi Level Security protection.

SELINUXTYPE=targeted

4、关闭禁用透明大页--Oracle Linux 默认已经关闭了THP,可以不用再进行关闭

[root@localhost network-scripts]# cat /sys/kernel/mm/transparent_hugepage/enabled

[always] madvise never

Linux 7.4 中关闭透明大页:https://www.cndba.cn/dave/article/2673

Linux 7.x 中 Oracle hugepage 大页配置脚本:https://www.cndba.cn/dave/article/2672

5、关闭时钟同步

[root@rac1 ~]# systemctl stop chronyd

[root@rac1 ~]# systemctl disable chronyd

Removed symlink /etc/systemd/system/multi-user.target.wants/chronyd.service.

[root@rac1 ~]#

移除chrony配置文件:(必须移除,否则校验NTP失败)

[root@rac1 software]# mv /etc/chrony.conf /etc/chrony.conf.bak

6、关闭avahi-daemon

[root@rac1 ~]# systemctl stop avahi-daemon

Warning: Stopping avahi-daemon.service, but it can still be activated by:

  avahi-daemon.socket

[root@rac1 ~]# systemctl disable avahi-daemon

Removed symlink /etc/systemd/system/multi-user.target.wants/avahi-daemon.service.

Removed symlink /etc/systemd/system/sockets.target.wants/avahi-daemon.socket.

Removed symlink /etc/systemd/system/dbus-org.freedesktop.Avahi.service.

[root@rac1 ~]#

7、创建目录

mkdir -p /u01/app/19.3.0/grid

mkdir -p /u01/app/grid

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

chown -R grid:oinstall /u01

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

chmod -R 775 /u01/

设置环境变量

cat /home/oracle/.bash_profile

ORACLE_SID=cndba1;export ORACLE_SID

ORACLE_UNQNAME=cndba;export ORACLE_UNQNAME

JAVA_HOME=/usr/local/java; export JAVA_HOME

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1; export ORACLE_HOME

ORACLE_TERM=xterm; export ORACLE_TERM

NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"; export NLS_DATE_FORMAT

NLS_LANG=american_america.ZHS16GBK; export NLS_LANG

TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11

PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin

PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export CLASSPATH

THREADS_FLAG=native; export THREADS_FLAG

export TEMP=/tmp

export TMPDIR=/tmp

umask 022

cat /home/grid/.bash_profile

PATH=$PATH:$HOME/bin

export ORACLE_SID=+ASM1 

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/19.3.0/grid

export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.

export TEMP=/tmp

export TMP=/tmp

export TMPDIR=/tmp

umask 022

export PATH

8、修改资源限制:/etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf or /etc/security/limits.conf

[root@rac1 ~]# cat >> /etc/security/limits.conf <

grid  soft  nproc  2047

grid  hard  nproc  16384

grid  soft  nofile  1024

grid  hard  nofile  65536

grid  soft  stack  10240

grid  hard  stack  32768

oracle  soft  nproc  2047

oracle  hard  nproc  16384

oracle  soft  nofile  1024

oracle  hard  nofile  65536

oracle  soft  stack  10240

oracle  hard  stack  32768

oracle soft memlock 3145728

oracle hard memlock 3145728

EOF

9、设置 PAM和NOZEROCONF

[root@rac1 ~]# cat >> /etc/pam.d/login <

session required pam_limits.so

EOF

vi /etc/sysconfig/network增加以下内容

NOZEROCONF=yes

也可以直接执行如下语法完成修改:

echo "NOZEROCONF=yes"  >>/etc/sysconfig/network

10、修改内核参数:/etc/sysctl.d/sysctl.conf or /etc/sysctl.d/98-oracle.conf

[root@rac1 ~]# cat >> /etc/sysctl.d/sysctl.conf <

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmall = 1073741824

kernel.shmmax = 4398046511104

kernel.panic_on_oops = 1

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

net.ipv4.conf.all.rp_filter = 2

net.ipv4.conf.default.rp_filter = 2

fs.aio-max-nr = 1048576

net.ipv4.ip_local_port_range = 9000 65500

EOF

[root@rac1 ~]# sysctl -p

or

[root@rac1 ~]/sbin/sysctl -p /etc/sysctl.d/98-oracle.conf

11、安装必须要的包

yum install -y oracle-database-preinstall-19c -y

yum update -y

yum install binutils -y

yum install compat-libstdc++-33 -y

yum install compat-libstdc++-33.i686 -y

yum install gcc -y

yum install gcc-c++ -y

yum install glibc -y

yum install glibc.i686 -y

yum install glibc-devel -y

yum install glibc-devel.i686 -y

yum install ksh -y

yum install libgcc -y

yum install libgcc.i686 -y

yum install libstdc++ -y

yum install libstdc++.i686 -y

yum install libstdc++-devel -y

yum install libstdc++-devel.i686 -y

yum install libaio -y

yum install libaio.i686 -y

yum install libaio-devel -y

yum install libaio-devel.i686 -y

yum install libXext -y

yum install libXext.i686 -y

yum install libXtst -y

yum install libXtst.i686 -y

yum install libX11 -y

yum install libX11.i686 -y

yum install libXau -y

yum install libXau.i686 -y

yum install libxcb -y

yum install libxcb.i686 -y

yum install libXi -y

yum install libXi.i686 -y

yum install make -y

yum install sysstat -y

yum install unixODBC -y

yum install unixODBC-devel -y

yum install zlib-devel -y

yum install zlib-devel.i686 -y

非Oracle Linux 设置

【[root@rac1 yum.repos.d]# yum clean all

[root@rac1 yum.repos.d]#

[root@rac1 yum.repos.d]# mount /dev/cdrom /mnt

[root@rac1 yum.repos.d]# yum install binutils  compat-libstdc++-33  gcc  gcc-c++  glibc  glibc.i686  glibc-devel  ksh  libgcc.i686  libstdc++-devel  libaio  libaio.i686  libaio-devel  libaio-devel.i686  libXext  libXext.i686  libXtst  libXtst.i686  libX11  libX11.i686  libXau  libXau.i686  libxcb  libxcb.i686  libXi  libXi.i686  make  sysstat  unixODBC  unixODBC-devel  zlib-devel  zlib-devel.i686 compat-libcap1 -y

[root@rac1 software]# rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm

warning: compat-libstdc++-33-3.2.3-61.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY

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

Updating / installing...

  1:compat-libstdc++-33-3.2.3-61    ################################# [100%]

[root@rac1 software]#】

一、VM共享存储

硬盘配制如下:

/dev/sda 本地磁盘      80G

/dev/ocr_vote01 共享磁盘存放ocr文件        15G

/dev/asm_data01 共享磁盘,用asm管理,存储oracle数据库文件    40G

VMWARE虚拟机创建共享磁盘

1.创建共享磁盘

在虚拟机软件的安装目录下,有个vmware-vdiskmanager.exe文件(老版本用plainmaker.exe),把它复制到共享磁盘柜目录下,创建共享磁盘(老版本共享磁盘文件的扩展名为.pln)

D:\Study\database\Oracle new\Oracle19cRAC\sharewm>vmware-vdiskmanager.exe -c -s 40Gb -a lsilogic -t 2 sharedisk.vmdk

D:\Study\database\Oracle new\Oracle19cRAC\sharewm>vmware-vdiskmanager.exe -c -s 15Gb -a lsilogic -t 2 ahareorc.vmdk

创建完毕后,目录下有六个新文件

sharedisk-flat.vmdk

sharedisk.vmdk

ahareorc-flat.vmdk

ahareorc.vmdk

2.把磁盘加载到虚拟机中

在虚拟机器界面选择“Edit virtual machine settings”

添加硬盘,选“Use a existing virtual disk”,分别添加sharedisk.vmdk、ahareorc.vmdk

双击新加的磁盘,在弹出的磁盘属性窗选“advance”,

为新加的硬盘选择虚拟设备节点:

sharedisk.vmdk选定“SCSI 2:1”。如图所示:

分别打开两台虚拟机目录中的vmx文件,在最后一行添加:

disk.locking = "false"

diskLib.dataCacheMaxSize = "0"

scsi1:1.fileName = "D:\Study\database\Oracle new\Oracle19cRAC\sharewm\sharedisk.vmdk"

scsi1:1.present = "TRUE"

scsi2:1.fileName = "D:\Study\database\Oracle new\Oracle19cRAC\sharewm\ahareorc.vmdk"

scsi2:1.present = "TRUE"

scsi1:1.SharedBus="Virtual"

scsi2:1.SharedBus="Virtual"

disk.EnableUUID ="TRUE"

其中/dev/sdb  对应 quoocr.vmdk,

/dev/sdc  对应 quovote.vmdk,

/dev/sdd 对应  sharedisk.vmdk


3.把ocr,vote作为裸设备,做映射

在rac1上

1>分区

fdisk -l

fdisk /dev/sdd  -->/dev/sdd1

disk /dev/sde  -->/dev/sde1

2>同步节点信息

/usr/lib/udev/scsi_id -g -u -d /dev/sdd1

/usr/lib/udev/scsi_id -g -u -d /dev/sde1

3>使用udev配置Asm磁盘

[root@rac2 ~]# vi asm.sh  //编辑脚本

#!/bin/bash

for i in  d e;

do

echo "KERNEL==\"sd*\",ENV{DEVTYPE}==\"disk\",SUBSYSTEM==\"block\",PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d \$devnode\",RESULT==\"`/usr/lib/udev/scsi_id -g -u /dev/sd$i`\", RUN+=\"/bin/sh -c 'mknod /dev/asmdisk$i b  \$major \$minor; chown grid:asmadmin /dev/asmdisk$i; chmod 0660 /dev/asmdisk$i'\""

done

[root@rac1 ~]# ./asm.sh  //运行脚本

KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29956af3b75a5628174e0a7470c", RUN+="/bin/sh -c 'mknod /dev/asmdiskd b  $major $minor; chown grid:asmadmin /dev/asmdiskd; chmod 0660 /dev/asmdiskd'"

KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29171c9477925dbb6a38aff3fcf", RUN+="/bin/sh -c 'mknod /dev/asmdiske b  $major $minor; chown grid:asmadmin /dev/asmdiske; chmod 0660 /dev/asmdiske'"

[root@rac1 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules //把上面的脚本内容复制到这个规则 

[root@rac1 ~]# udevadm control --reload  //udevadm配置重载生效

[root@rac1 ~]# udevadm trigger

[root@rac1 ~]#  ll /dev/asm*    //查看宿主和组用户,这里必须要先创建用户和组之后才会显示正确

brw-rw----. 1 grid asmadmin 8, 48 May  4 01:11 /dev/asmdiskd

brw-rw----. 1 grid asmadmin 8, 48 May  4 01:11 /dev/asmdiske

12、重启 reboot

三、上传介质,开始安装:

1、上传解压介质

[root@localhost opt]# ll

total 5809664

-rwxr-xr-x. 1 root root        323 May  4 01:09 asm.sh

-rw-r--r--. 1 root root    195388 Mar 14  2015 compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

-rw-r--r--. 1 root root 3059705302 May  4 01:31 LINUX.X64_193000_db_home.zip

-rw-r--r--. 1 root root 2889184573 May  4 01:30 LINUX.X64_193000_grid_home.zip

从Oracle 12cR2开始,软件直接解压缩到GRID_HOME 或者ORACLE_HOME,而不是在安装时复制过去。 该操作只需要在节点1上完成解压缩即可。

我们这里是安装GRID,用grid用户来解压缩GI:

[grid@rac1 software]# unzip -d /u01/app/19.3.0/grid LINUX.X64_193000_grid_home.zip

2、安装cvuqdisk 两个节点都安装

[root@localhost opt]# cd /u01/app/19.3.0/grid/cv/rpm

[root@localhost rpm]#

[root@localhost rpm]#

[root@localhost rpm]# ll

total 12

-rw-r--r--. 1 oracle oinstall 11412 Mar 13  2019 cvuqdisk-1.0.10-1.rpm

[root@localhost rpm]# rpm -ivh cvuqdisk-1.0.10-1.rpm

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

Using default group oinstall to install package

Updating / installing...

  1:cvuqdisk-1.0.10-1                ################################# [100%]

[root@localhost rpm]#

3、运行安装脚本gridSetup.sh

在节点1,进入grid集群软件目录执行GI安装。

[root@localhost rpm]# chown -R grid:oinstall /u01/app/19.3.0/grid

[root@localhost rpm]# su - grid

[grid@rac1 ~]$ cd /u01/app/19.3.0/grid

[grid@rac1 grid]$ ls

addnode    clone  dbjava    diagnostics  gpnp          install        jdbc  lib      OPatch  ords  perl    qos      rhp            rootupgrade.sh  sqlpatch  tomcat  welcome.html  xdk

assistants  crs    dbs        dmu          gridSetup.sh  instantclient  jdk  md      opmn    oss  plsql    racg      root.sh        runcluvfy.sh    sqlplus  ucp    wlm

bin        css    deinstall  env.ora      has          inventory      jlib  network  oracore  oui  precomp  rdbms    root.sh.old    sdk            srvm      usm    wwg

cha        cv    demo      evm          hs            javavm        ldap  nls      ord      owm  QOpatch  relnotes  root.sh.old.1  slax            suptools  utl    xag

[grid@rac1 grid]$

DISPLAY=:0.0; export DISPLAY

export DISPLAY=192.168.137.1:0.0

[grid@rac1 grid]$ ./gridSetup.sh

Launching Oracle Grid Infrastructure Setup Wizard...

The response file for this session can be found at:

/u01/app/19.3.0/grid/install/response/grid_2021-05-04_05-21-31AM.rsp

You can find the log of this install session at:

/tmp/GridSetupActions2021-05-04_05-21-31AM/gridSetupActions2021-05-04_05-21-31AM.log

Moved the install session logs to:

/u01/app/oraInventory/logs/GridSetupActions2021-05-04_05-21-31AM

[grid@rac1 grid]$ crsctl stat res -t

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

Name          Target  State        Server                  State details     

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

Local Resources

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

ora.LISTENER.lsnr

              ONLINE  ONLINE      rac1                    STABLE

              ONLINE  ONLINE      rac2                    STABLE

ora.chad

              ONLINE  ONLINE      rac1                    STABLE

              ONLINE  ONLINE      rac2                    STABLE

ora.net1.network

              ONLINE  ONLINE      rac1                    STABLE

              ONLINE  ONLINE      rac2                    STABLE

ora.ons

              ONLINE  ONLINE      rac1                    STABLE

              ONLINE  ONLINE      rac2                    STABLE

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

Cluster Resources

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

ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)

      1        ONLINE  ONLINE      rac1                    STABLE

      2        ONLINE  ONLINE      rac2                    STABLE

      3        OFFLINE OFFLINE                              STABLE

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE      rac1                    STABLE

ora.OCR.dg(ora.asmgroup)

      1        ONLINE  ONLINE      rac1                    STABLE

      2        ONLINE  ONLINE      rac2                    STABLE

      3        OFFLINE OFFLINE                              STABLE

ora.asm(ora.asmgroup)

      1        ONLINE  ONLINE      rac1                    Started,STABLE

      2        ONLINE  ONLINE      rac2                    Started,STABLE

      3        OFFLINE OFFLINE                              STABLE

ora.asmnet1.asmnetwork(ora.asmgroup)

      1        ONLINE  ONLINE      rac1                    STABLE

      2        ONLINE  ONLINE      rac2                    STABLE

      3        OFFLINE OFFLINE                              STABLE

ora.cvu

      1        ONLINE  ONLINE      rac1                    STABLE

ora.qosmserver

      1        ONLINE  ONLINE      rac1                    STABLE

ora.rac1.vip

      1        ONLINE  ONLINE      rac1                    STABLE

ora.rac2.vip

      1        ONLINE  ONLINE      rac2                    STABLE

ora.scan1.vip

      1        ONLINE  ONLINE      rac1                    STABLE

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

[grid@rac1 grid]$

[grid@rac1 grid]$

[grid@rac1 grid]$ asmca

四、上传介质,安装数据库

4 安装DB

与grid操作相同,用oracle 用户解压缩到ORACLE_HOME。 该操作只需要在节点1上完成解压缩即可。

DISPLAY=:0.0; export DISPLAY

# Unzip software.

cd $ORACLE_HOME

unzip -oq /path/to/software/LINUX.X64_193000_db_home.zip

# Interactive mode.

./runInstaller

As a root user, execute the following script(s):

        1. /u01/app/oraInventory/orainstRoot.sh

        2. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh

参考文档:https://blog.csdn.net/weixin_36065860/article/details/105772692

                  https://www.cndba.cn/dave/article/4073

                  https://oracle-base.com/articles/19c/oracle-db-19c-rac-installation-on-oracle-linux-7-using-virtualbox

你可能感兴趣的:(Oracle 19c RAC Linux 7.9 Install)