rhel7安装Oracle 19C RAC

一、安装环境准备

1.1./dev/shm作为tmpfs挂载

--查看大小
df -h /dev/shm/

--写入/etc/fstab
vi /etc/fstab
tmpfs      /dev/shm       tmpfs     defaults,size=3.9G     0 0

1.2.关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

1.3.关闭selinux

vim /etc/selinux/config
SELINUX=disabled

1.4.关闭avahi-daemon

systemctl stop avahi-daemon.socket
systemctl disable avahi-daemon.socket

1.5.关闭NetworkManager

systemctl stop  NetworkManager.service
systemctl disable NetworkManager.service

1.6.关闭numa

vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet numa=off"

--使更改生效
grub2-mkconfig -o /etc/grub2.cfg

1.7.配置hosts

vi /etc/hosts
192.x.x.1	rac1
192.x.x.2	rac2
10.0.0.1	rac1-priv
10.0.0.2	rac2-priv
192.x.x.3	rac1-vip
192.x.x.4	rac2-vip
192.x.x.5	rac-scan

1.8.配置私有网卡

vi /etc/sysconfig/network-scripts/ifcfg-eth1 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
NAME=eth1
DEVICE=eth1
ONBOOT=yes
IPADDR=10.0.0.1
NETMASK=255.255.255.0

--私有网卡连通测试
[root@localhost ~]# traceroute rac2-priv
traceroute to rac2-priv (10.0.0.2), 30 hops max, 60 byte packets
 1  rac2-priv (10.0.0.2)  1.271 ms  1.153 ms  1.101 ms

[root@localhost ~]# traceroute rac1-priv
traceroute to rac1-priv (10.0.0.1), 30 hops max, 60 byte packets
 1  rac1-priv (10.0.0.1)  1.271 ms  1.153 ms  1.101 ms

1.9.安装所需软件包

--配置yum
vi /etc/yum.repos.d/rhel.repo 
[rhel]
name=rhel
baseurl=file:///mnt
enabled=1
gpgcheck=0

--挂载os镜像文件
mount /dev/sr0 /mnt
或
mount -o loop XXXXX.iso /mnt

--开始安装
echo 'multilib_policy=all' >> /etc/yum.conf
yum install binutils compat-libcap1 compat-libstdc++-33 e2fsprogs e2fsprogs-libs gcc gcc-c++ glibc glibc-devel libaio libaio-devel libX11 libXau libXi libXtst libgcc libstdc++ libstdc++-devel libxcb make nfs-utils smartmontools sysstat net-tools ksh unixODBC unixODBC-devel lsscsi* openssh -y

1.10.内核参数

/etc/sysctl.conf 文件已被弃用

vim /etc/sysctl.d/97-oracle-database-sysctl.conf
kernel.shmmax = XXXXXX
kernel.shmall = XXXXXX
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
fs.aio-max-nr = 4194304
fs.file-max = 6815744
vm.min_free_kbytes=524288
kernel.panic_on_oops = 1
kernel.randomize_va_space=0
net.ipv4.conf.eth1.rp_filter=2

--使修改生效
sysctl -p

1.11.Oracle的shell限制

vi /etc/security/limits.conf
grid                 soft    nofile  1024
grid                 hard    nofile  65536
grid                 hard    stack   32768
grid                 soft    stack   10240
oracle               soft    nofile  1024
oracle               hard    nofile  65536
oracle               hard    stack   32768
oracle               soft    stack   10240
oracle              hard    memlock  3145728
oracle              soft    memlock  3145728

--使上面参数生效
vi /etc/pam.d/login
session    required     pam_limits.so

--rhel7或更高版本修改
vi /etc/security/limits.d/20-nproc.conf
grid                 soft    nproc   2047
grid                 hard    nproc   16384
oracle               soft    nproc   2047
oracle               hard    nproc   16384

vi /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

1.12.设置时间和时区

--时间
date -s "20100405 14:31:00"

--时区
timedatectl set-timezone Asia/Shanghai

--关闭时间同步
systemctl stop chronyd
systemctl disable chronyd
mv /etc/chrony.conf /etc/chrony.conf.ora

1.13.修改主机名

hostnamectl set-hostname rac1
hostnamectl set-hostname rac2

1.14.添加用户组

/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 54331 -g oinstall -G dba,asmdba,asmoper,asmadmin,racdba grid
/usr/sbin/useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,racdba oracle

--修改密码
passwd grid 
passwd oracle

1.15.创建所需安装目录

mkdir -p /u01/app/19.3.0/grid
mkdir -p /u01/app/grid
mkdir -p /u02/app/oracle/product/19.3.0/db_home
chown -R grid:oinstall /u01/
chown -R oracle:oinstall /u02/
chmod -R 775 /u01/ /u02/

1.16.修改环境变量

--grid
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:$HOME/bin:$ORACLE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

--oracle
export ORACLE_SID=orcl1
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=/u02/app/oracle/product/19.3.0/db_home
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

1.17.配置共享磁盘

--生成multipath.conf文件
/sbin/mpathconf --enable

--修改配置文件,注意修改wwid号和别名
vi /etc/multipath.conf
defaults {
       polling_interval        5
       path_grouping_policy    multibus
       prio                    const
       path_checker            directio
       rr_min_io               1000
       rr_weight               uniform
       failback                manual
       no_path_retry           fail
       user_friendly_names     yes
}
 
blacklist { 
        devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
        devnode "^hd[a-z]"
        devnode "^cciss!c[0-9]d[0-9]*"
}

multipaths { 
multipath {
                wwid    1ATA_VBOX_HARDDISK_VBef5230c9-f846239d --磁盘wwid号
                alias   data
                path_grouping_policy multibus
        }
        multipath {
                wwid    1ATA_VBOX_HARDDISK_VBa01c30ba-b337fdcf
                alias   fra
                path_grouping_policy multibus
        }
        multipath {
                wwid    1ATA_VBOX_HARDDISK_VBbe1bb2fa-0727f67c
                alias   ocr
                path_grouping_policy multibus
        }
}

--启动服务
systemctl start multipathd.service
systemctl status multipathd.service
systemctl enable multipathd.service

--查看
multipath -ll

--修改磁盘权限
vi /etc/udev/rules.d/19-asm-oracle.rules
ENV{DM_NAME}=="ocr", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"
ENV{DM_NAME}=="data", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"
ENV{DM_NAME}=="fra", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

--使更改生效
/sbin/udevadm trigger --type=devices --action=change

--查看权限
ls -l /dev/dm-*

1.18.裸设备绑定(可选)

vi /etc/udev/rules.d/19-oracle-asm.rules
ACTION=="add", KERNEL=="sdd", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sde", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdf", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdg", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdh", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdi", RUN+="/bin/raw /dev/raw/raw6 %N"

KERNEL=="raw1", MODE="0660", OWNER:="grid", GROUP:="asmadmin"
KERNEL=="raw2", MODE="0660", OWNER:="grid", GROUP:="asmadmin"
KERNEL=="raw3", MODE="0660", OWNER:="grid", GROUP:="asmadmin"
KERNEL=="raw4", MODE="0660", OWNER:="grid", GROUP:="asmadmin"
KERNEL=="raw5", MODE="0660", OWNER:="grid", GROUP:="asmadmin"
KERNEL=="raw6", MODE="0660", OWNER:="grid", GROUP:="asmadmin"

--使更改生效
systemctl restart systemd-udev-trigger.service

--查看权限
ls -l /dev/raw/*

二、开始安装

2.1.安装GI

su - grid
unzip LINUX.X64_193000_grid_home.zip -d $ORACLE_HOME
cd $ORACLE_HOME
./gridSetup.sh

部分安装截图如下:
rhel7安装Oracle 19C RAC_第1张图片
rhel7安装Oracle 19C RAC_第2张图片
rhel7安装Oracle 19C RAC_第3张图片
rhel7安装Oracle 19C RAC_第4张图片
rhel7安装Oracle 19C RAC_第5张图片
rhel7安装Oracle 19C RAC_第6张图片
rhel7安装Oracle 19C RAC_第7张图片
rhel7安装Oracle 19C RAC_第8张图片
rhel7安装Oracle 19C RAC_第9张图片
rhel7安装Oracle 19C RAC_第10张图片

2.2.创建ASM磁盘组

su - grid
asmca

rhel7安装Oracle 19C RAC_第11张图片

2.3.安装Oracle

su - oracle
unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
cd $ORACLE_HOME
./runInstaller

部分安装截图如下:
rhel7安装Oracle 19C RAC_第12张图片
rhel7安装Oracle 19C RAC_第13张图片
rhel7安装Oracle 19C RAC_第14张图片
rhel7安装Oracle 19C RAC_第15张图片
rhel7安装Oracle 19C RAC_第16张图片
rhel7安装Oracle 19C RAC_第17张图片

2.4.创建数据库

su - oracle
dbca

部分安装截图如下:
rhel7安装Oracle 19C RAC_第18张图片
rhel7安装Oracle 19C RAC_第19张图片
rhel7安装Oracle 19C RAC_第20张图片
rhel7安装Oracle 19C RAC_第21张图片
rhel7安装Oracle 19C RAC_第22张图片
rhel7安装Oracle 19C RAC_第23张图片
rhel7安装Oracle 19C RAC_第24张图片

三、检查集群

[grid@rac1 ~]$ 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.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                   STABLE
      2        ONLINE  ONLINE       rac2                   STABLE
      3        ONLINE  OFFLINE                             STABLE
ora.FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                   STABLE
      2        ONLINE  ONLINE       rac2                   STABLE
      3        ONLINE  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.orcl.db
      1        ONLINE  ONLINE       rac1                   Open,HOME=/u02/app/o
                                                           racle/product/19.3.0
                                                           /db_home,STABLE
      2        ONLINE  ONLINE       rac2                   Open,HOME=/u02/app/o
                                                           racle/product/19.3.0
                                                           /db_home,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 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

[grid@rac1 ~]$ crsctl check ctss
CRS-4701: The Cluster Time Synchronization Service is in Active mode.
CRS-4702: Offset (in msec): 0

你可能感兴趣的:(oracle,Oracle,RAC,安装,数据库)