环境信息
主机名 |
victorrhel701 |
victorrhel702 |
IP |
192.168.1.71 |
192.168.1.72 |
操作系统 |
redhat Linux 7.7 |
redhat Linux 7.7 |
是否虚拟机 |
是 |
是 |
DB版本 |
19.3 |
19.3 |
DBRU |
19.22.0.0.240116 |
19.22.0.0.240116 |
GI 版本 |
19.3 |
19.3 |
GIRU |
19.22.0.0.240116 |
19.22.0.0.240116 |
内存 |
16G |
16G |
CPUs |
2 |
2 |
平台认证
使用support.oracle.com的Certifications查看数据库的认证平台:
Database 19c目前认证的Oracle Enterprise Linux/Red Hat Enterprise Linux平台版本包括 redhat Linux 7。
安装前准备
数据库规范化
GI/RDBMS资源配置规范
RAM |
至少12GB。 |
/tmp |
至少1GB。 |
SWAP |
至少4GB RAM < 16GB, SWAP = RAM大小。 RAC >=16GB, SWAP = 16GB。 |
Run Level |
3/5 |
Cluster Name |
小于等于15个字符,可使用字母,数字和横线(-),以字母开头,建议使用小写字母。 |
GRID HOME + RDBMS HOME |
建议大于等于100GB。 |
OCR磁盘组 |
建议使用normal冗余,每个磁盘5GB。 |
MGMT磁盘组 |
如果选择安装MGMT,外部冗余至少40GB。 |
RAM |
至少12GB。 |
/tmp |
至少1GB。 |
用户及组管理规范
用户组配置规范说明:用户配置规范说明:
oinstall |
gid=54421,用于安装Oracle数据库软件 |
*必建* |
dba |
gid=54322,用于管理Oracle数据库 |
*必建* |
oper |
gid=54323,用于对Oracle数据库做维护操作 |
*必建* |
backupdba |
gid=54324,用于管理Oracle数据库备份 |
*数据库版本是19c,需要创建* |
dgdba |
gid=54325,用于管理Dtataguard数据库 |
*数据库版本是19c,需要创建* |
kmdba |
gid=54326,用于管理数据库密钥 |
*数据库版本是19c,需要创建* |
asmdba |
gid=54327,用于管理ASM实例 |
*如果使用ASM,需要创建* |
asmoper |
gid=54328,用于操作ASM实例 |
*如果使用ASM,需要创建* |
asmadmin |
gid=54329,用于安装ASM软件 |
*如果使用ASM,需要创建* |
racdba |
gid=54330,用于管理群集数据库 |
*数据库版本是19c,需要创建* |
oinstall |
gid=54421,用于安装Oracle数据库软件 |
*必建* |
用户配置规范说明:
Name |
UID |
Prim Group |
Auxiliary group |
oracle |
54321 |
oinstall |
dba,oper,asmdba,backupdba,dgdba,kmdba,racdba |
grid |
54322 |
oinstall |
asmoper,asmadmin,asmdba,racdba |
软件介质使用规范
安装前需准备以下安装介质:
GRID安装介质:LINUX.X64_193000_grid_home.zip
RDBMS安装介质:LINUX.X64_193000_db_home.zip
下载地址:https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#19c
验证介质包完整性:
sha256sum LINUX.X64_193000_db_home.zip
sha256sum LINUX.X64_193000_grid_home.zip
Patch:
- p6880880_190000_Linux-x86-64.zip (OPatch)
- RU(GI和RDBMS季度补丁)。
- OJVM (OJVM补丁)
官网sha256sum值:
https://www.oracle.com/hk/database/technologies/oracle19c-linux-downloads.html
- LINUX.X64_193000_db_home.zip
- Oracle Database 19c (19.3) for Linux x86-64
sha256sum - ba8329c757133da313ed3b6d7f86c5ac42cd9970a28bf2e6233f3235233aa8d8
- LINUX.X64_193000_grid_home.zip
- Oracle Database 19c Grid Infrastructure (19.3) for Linux x86-64
sha256sum - d668002664d9399cf61eb03c0d1e3687121fc890b1ddd50b35dcbe13c5307d2e
注意:
- 确保下载的安装介质和官方网站上的sha256sum值对应,以确保安装包的完整性和安全性。
安装目录规范
安装目录规划原则:
- 根据用户规范创建用于Oracle数据库软件安装的目录
目录具体规划如下:
- 基于本地存储上,新建文件系统,大小:100GB
- RAC要求各节点目录名一致
Oracle Base目录:/oracle/app/oracle
Oracle Grid目录:/oracle/app/19.0.0/grid
Oracle Home目录:/oracle/app/oracle/product/19.0.0/dbhome_1
磁盘组配置规范
ASM磁盘名称 |
ASM磁盘容量/GB |
ASM磁盘组个数 |
用户与组属性 |
用途说明 |
OCR |
10 |
3 |
grid:asmadmin |
用于存放OCR和Voting Disk |
DATA |
100 |
1 |
grid:asmadmi |
用于存放数据库数据文件 |
ARCH |
100 |
1 |
grid:asmadmi |
用于存放归档日志文件 |
MGMT |
100 |
1 |
grid:asmadmi |
用于存放MGMT数据库数据文件 |
网络配置规范
Identity |
Node Name |
Type |
IP Address |
Resolved By |
Node 1 Public |
victorrhel701 |
Public |
192.168.1.71 |
hosts file |
Node 1 Private |
victorrhel701priv |
Private |
10.10.10.71 |
hosts file |
Node 1 VIP |
victorrhel701vip |
Virtual |
192.168.1.73 |
hosts file |
Node 2 Public |
victorrhel702 |
Public |
10.20.3.141 |
hosts file |
Node 2 Private |
victorrhel702priv |
Private |
10.10.10.72 |
hosts file |
Node 2 VIP |
victorrhel702vip |
Virtual |
192.168.1.74 |
hosts file |
SCAN IP |
victoroelscan |
Virtual |
192.168.1.75 |
hosts file |
所有节点上网卡名和对应关系必须一致
数据库配置规范
选项 |
描述 |
数据库版本 |
19.3.0.0 |
数据库监听端口 |
1521 |
数据库字符集 |
AL32UTF8 |
国家语言字符集 |
AL16UTF16 |
数据库块大小 |
8K |
检查OS版本及内核版本
检查各个节点的OS版本和内核版本,确保满足19c的认证平台版本。而且,两个RAC的各个节点要保持一致的OS版本。
# cat /etc/system-release
Red Hat Enterprise Linux Server release 7.7 (Maipo)
# uname -a
Linux victorrhel701 3.10.0-1062.el7.x86_64 #1 SMP Thu Jul 18 20:25:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
检查OS运行级别
OS需要运行在3/5级别。
victorrhel701:~ # runlevel
N 5
victorrhel702:~ # runlevel
N 5
关闭防火墙
- 在2 个节点上关闭/禁用防火墙
# systemctl stop firewalld
# systemctl disable firewalld
检查防火墙状态
# systemctl status firewalld
# systemctl is-enabled firewalld
Selinux 禁用
- 在2 个节点上修改
#vi /etc/selinux/config
修改SELINUX=disabled
主机名配置
设置主机名,注意:主机名以字母为首。
# hostnamectl set-hostname victorrhel701
# hostnamectl set-hostname victorrhel702
通过hostnamectl status命令查看主机名信息。
[root@victorrhel701 ~]# hostnamectl status
Static hostname: victorrhel701
Icon name: computer-vm
Chassis: vm
Machine ID: d855ae0a451849a6971d913ecc91bed3
Boot ID: 7cce7ea1c5e3417fac5f9b7da62fb51c
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.7 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.7:GA:server
Kernel: Linux 3.10.0-1062.el7.x86_64
Architecture: x86-64
[root@victorrhel702 ~]# hostnamectl status
Static hostname: victorrhel702
Icon name: computer-vm
Chassis: vm
Machine ID: ac12df556b014b45a28060b4ab487a42
Boot ID: 20f41606a12e449983d518c3681a8a9b
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.7 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.7:GA:server
Kernel: Linux 3.10.0-1062.el7.x86_64
Architecture: x86-64
配置/etc/hosts
- 在2 个节点上修改/etc/hosts
# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#public ip
192.168.1.71 victorrhel701
192.168.1.72 victorrhel702
# private ip
10.10.10.71 victorrhel701priv
10.10.10.72 victorrhel702priv
# vip
192.168.1.73 victorrhel701vip
192.168.1.74 victorrhel702vip
# scan ip
192.168.1.75 victoroelscan
设置OS时区
在安装GRID之前,一定要先修改好OS时区,否则GRID将引用一个错误的OS时区,导致DB的时区,监听的时区等不正确。
- 修改OS时区:
[root@victorrhel701 ~]# timedatectl set-timezone "Asia/Shanghai"
[root@victorrhel702 ~]# timedatectl set-timezone "Asia/Shanghai"
- 查看OS时区:
[root@victorrhel701 ~]# timedatectl status
Local time: 六 2024-01-13 00:55:41 CST
Universal time: 五 2024-01-12 16:55:41 UTC
RTC time: 五 2024-01-12 16:55:41
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
[root@victorrhel702 ~]# timedatectl status
Local time: 六 2024-01-13 00:54:04 CST
Universal time: 五 2024-01-12 16:54:04 UTC
RTC time: 五 2024-01-12 16:54:04
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
检查内存和SWAP大小
配置 Swap分区
使用 fallocate 命令快速分配 16 GB 的文件作为交换空间。
[root@victorrhel701 ~]# fallocate -l 16G /swapfile
出于安全考虑,交换文件的权限应该限制为只有 root 用户才能访问。
[root@victorrhel701 ~]# chmod 600 /swapfile
将创建的文件设置为交换空间。
[root@victorrhel701 ~]# mkswap /swapfile
正在设置交换空间版本 1,大小 = 16 GiB (17179865088 个字节)
启用交换空间
[root@victorrhel701 ~]# swapon /swapfile
使交换空间永久有效
为了在系统重启后交换空间依然有效,需要将其添加到 /etc/fstab 文件中。
[root@victorrhel701 ~]# echo '/swapfile none swap sw 0 0' |tee -a /etc/fstab
节点 2 重复以上步骤。
可以通过/proc/meminfo或free命令查看OS当前的可用内存和Swap信息。
确保满足资源配置规范
[root@victorrhel701 ~]# egrep 'Mem|Swap' /proc/meminfo
MemTotal: 15867524 kB
MemFree: 7829496 kB
MemAvailable: 14216300 kB
SwapCached: 0 kB
SwapTotal: 16777212 kB
SwapFree: 16777212 kB
[root@victorrhel702 ~]# egrep 'Mem|Swap' /proc/meminfo
MemTotal: 15867524 kB
MemFree: 14698640 kB
MemAvailable: 14847780 kB
SwapCached: 0 kB
SwapTotal: 16777212 kB
SwapFree: 16777212 kB
检查安装目录及共享段大小
确保满足资源配置规范
[root@victorrhel701 ~] # df -h /oracle /tmp /dev/shm
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-oraclelv 98G 61M 97G 1% /oracle
/dev/mapper/ol-root 67G 22G 46G 32% /
tmpfs 7.6G 0 7.6G 0% /dev/shm
[root@victorrhel702 ~] # df -h /oracle /tmp /dev/shm
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-oraclelv 98G 61M 97G 1% /oracle
/dev/mapper/ol-root 67G 22G 46G 32% /
tmpfs 7.6G 0 7.6G 0% /dev/shm
关闭透明大页
ALERT: Disable Transparent HugePages on SLES11, RHEL6, RHEL7, RHEL8, OL6, OL7, OL8 and UEK2 and above (文档 ID 1557478.1)
- 修改rc.local 在最后面追加以下命令,并重启服务器生效
[root@victorrhel701 ~]# vi /etc/rc.d/rc.localif
test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
- 重启后,使用以下命令确认透明大页已被禁用。
[root@victorrhel701 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@victorrhel701 ~]# cat /sys/kernel/mm/transparent_hugepage/defrag
always defer defer+madvise madvise [never]
[root@victorrhel702 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@victorrhel702 ~]# cat /sys/kernel/mm/transparent_hugepage/defrag
always defer defer+madvise madvise [never]
这些命令的输出应该是 never。
检查磁盘I/O调度
为了有更好的性能,调整I/O调度策略为deadline,可以帮助提高对 I/O 请求的响应时间,特别是在数据库等 I/O 密集型应用中。
- 编辑grub
[root@victorrhel701 ~]# vi /etc/default/grub
[root@victorrhel702 ~]# vi /etc/default/grub
- 在 GRUB_CMDLINE_LINUX 字符串中添加 elevator=deadline。例如:
GRUB_CMDLINE_LINUX="crashkernel=1G-64G:448M,64G-:512M rd.lvm.lv=ol/root rhgb quiet elevator=deadlin"
- 更新 grub配置
[root@victorrhel701 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
[root@victorrhel702 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
- 使用以下命令查看I/O调度策略。
[root@victorrhel701 ~]# for i in b c d e f g;do
> cat /sys/block/sd${i}/queue/scheduler
> done
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
[root@victorrhel702 ~]# for i in b c d e f g;do
> cat /sys/block/sd${i}/queue/scheduler
> done
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
noop deadline [cfq]
配置SSH timeout
为了防止在在"AttachHome"操作期间,SSH连接中断,配置SSH daemon的超时时间为unlimited。
[root@victorrhel701 ~]# vi /etc/ssh/sshd_config
LoginGraceTime 0
[root@victorrhel702 ~]# vi /etc/ssh/sshd_config
LoginGraceTime 0
[root@victorrhel701 ~]# systemctl restart sshd
[root@victorrhel702 ~]# systemctl restart sshd
检查需求软件包
参考文档:
- Oracle Document Install Guide for Linux
- Requirements for Installing Oracle Database 19c on OL7 or RHEL7 64-bit (x86-64) (Doc ID 2551169.1)
在OL9 or RHEL9 64-bit,需要安装以下软件包或更高版本:
bc
bc
binutils
compat-libcap1
compat-libstdc++-33
elfutils-libelf
elfutils-libelf-devel
fontconfig-devel
glibc
glibc-devel
ksh
libaio
libaio-devel
libX11
libXau
libXi
libXtst
libXrender
libXrender-devel
libgcc
librdmacm-devel
libstdc++
libstdc++-devel
libxcb
make
net-tools (for Oracle RAC and Oracle Clusterware)
nfs-utils (for Oracle ACFS)
python (for Oracle ACFS Remote)
python-configshell (for Oracle ACFS Remote)
python-rtslib (for Oracle ACFS Remote)
python-six (for Oracle ACFS Remote)
targetcli (for Oracle ACFS Remote)
smartmontools
sysstat
Note:
If you intend to use 32-bit client applications to access 64-bit servers, then you must also install the latest 32-bit versions of the packages listed in this table.
- 使用以下命令进行软件包检查:
[root@victorrhel701 ~]# rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" \
bc \
binutils \
compat-openssl11 \
elfutils-libelf \
fontconfig \
glibc \
glibc-devel \
ksh \
libaio \
libasan \
liblsan \
libX11 \
libXau \
libXi \
libXrender \
libXtst \
libxcrypt-compat \
libgcc \
libibverbs \
libnsl \
librdmacm \
libstdc++ \
libxcb \
libvirt-libs \
make \
policycoreutils \
policycoreutils-python-utils \
smartmontools \
sysstat | grep 'not installed'
- 配置yum源
- 挂载ISO 镜像
[root@victorrhel701 ~]# mkdir /mnt/oracleiso
[root@victorrhel701 ~]# mount /dev/sr0 /mnt/oracleiso
mount: /mnt/oracleiso: WARNING: source write-protected, mounted read-only.
- 创建新的 repo 文件
[root@victorrhel701 ~]# vi /etc/yum.repos.d/oracleiso.repo
[server]
name=OEL7
baseurl=file:///mnt/oracleiso/
enable=1
gpgcheck=0
- 使用 yum安装所需 rpm 包
yum install -y bc \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
fontconfig-devel \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
libgcc \
gcc-c++ \
librdmacm-devel \
libstdc++ \
libstdc++-devel \
libxcb \
make \
net-tools \
nfs-utils \
python \
python-configshell \
python-rtslib \
python-six \
targetcli \
smartmontools \
sysstat
- compat-libstdc-可以手动上传
[root@victorrhel701 ~]# rpm -ivh compat-libstdc-33-3.2.3-72.el7.x86_64.rpm
warning: compat-libstdc-33-3.2.3-72.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:compat-libstdc++-33-3.2.3-72.el7 ################################# [100%]
- 节点 2 重复上述操作
NUMA设置
在LINUX7.X中,官方文档已说明开启NUMA对系统有影响。
官方文档:Requirements for Installing Oracle Database 19c on OL7 or RHEL7 64-bit (x86-64) (Doc ID 2551169.1)
It is observed there are hang issues in RHEL 7 with many CPU cores and more RAM, due NUMA was enabled. As a work around it is recommended to turn off NUMA.
It is also strongly advised to disable NUMA Balancing Feature,in /etc/sysctl.conf
kernel.numa_balancing = 0
Note - This is already implemented in UEK 4.1.12-117.el7uek.x86_64 & later
# rpm -q --changelog kernel-uek-4.1.12-117.el7uek.x86_64 | grep 26798697
- uek-rpm: disable CONFIG_NUMA_BALANCING_DEFAULT_ENABLED (Fred Herard)
[Orabug: 26798697]
# sysctl kernel.numa_balancing
kernel.numa_balancing = 0
除非主机明确要开启NUMA,一般建议关闭。
从LINUX8.X开始,官方文档说明开启NUMA对系统无影响.
NUMA can be turned ON.No issues reported on OL/RHEL 9 when NUMA is ON.
官方文档:Requirements for Installing Oracle Database/Client 19c (19.19 or higher) on OL9 or RHEL9 64-bit (x86-64) (Doc ID 2982833.1)
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
禁用avahi-daemon
avahi-daemon 是 Linux 系统上的一个服务,它实现了 Zeroconf 网络配置协议,也称为 Bonjour。它允许计算机在没有手动网络配置的情况下自动发现网络中的服务和主机。然而,在 Oracle Real Application Clusters (RAC) 环境中,通过发送和监听网络上的 mDNS (Multicast DNS) 包来工作。这可能会干扰 Oracle RAC 使用的网络,尤其是在集群互连网络中。
已知avahi-daemon会导致RAC的节点重启,在最新的CVU里面已经加入了对avahi-daemon的校验。
# 查看avahi-daemon状态,如果为active,则关闭。
# systemctl status avahi-daemon
● avahi-dnsconfd.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
# systemctl status avahi-daemon
● avahi-daemon.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
# 关闭avahi-daemon服务命令。
# systemctl stop avahi-daemon
# systemctl disable avahi-daemon
禁用ASLR
可以通过以下命令确认ASLR是否使用:
[root@victorrhel701 ~]# /sbin/sysctl -a | grep randomize
kernel.randomize_va_space = 2
如果结果显示为非0的值,说明ASLR正在使用,建议按照以下方式关闭ASLR并重启生效:
echo 0 > /proc/sys/kernel/randomize_va_space
sysctl -p
You need to reboot for kernel.exec-shield parameter to take effect.
设置NOZEROCONF
On each node within the Oracle RAC Database cluster, set the value of NOZEROCONF to yes
within the /etc/sysconfig/network file. Setting NOZEROCONF ensures that the route 169.254.0.0/16
is not added to the routing table.
NOZEROCONF=yes
设置NOZEROCONF以确保路由169.254.0.0/16不会被添加到路由表中。
cat /etc/sysconfig/network
cat >> /etc/sysconfig/network /etc/pam.d/xdm
# echo "session required pam_limits.so" >> /etc/pam.d/su
两个节点root执行
解压软件包(仅在节点1上执行)
分别使用grid和oracle用户解压GI和DB的软件包到GRID_HOME和ORACLE_HOME目录
su - grid
unzip LINUX.X64_193000_grid_home.zip -d $ORACLE_HOME
su - oracle
unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
配置用户互信
分别使用grid和oracle用户调用sshUserSetup.sh脚本配置SSH connectivity,根据提示输入密码。
grid用户:
[grid@victorrhel701:/home/grid +ASM1]$ cd $ORACLE_HOME/oui/prov/resources/scripts
[grid@victorrhel701:/oracle/app/19.0.0/grid/oui/prov/resources/scripts +ASM1]$ ./sshUserSetup.sh -user grid -hosts "victorrhel701 victorrhel702" -advanced -confirm -noPromptPassphrase
oracle用户:
[oracle@victorrhel701:/home/oracle victordb1]$ cd $ORACLE_HOME/oui/prov/resources/scripts
[oracle@victorrhel701:/oracle/app/oracle/product/19.0.0/dbhome_1/oui/prov/resources/scripts victordb1]$ ./sshUserSetup.sh -user oracle -hosts "victorrhel701 victorrhel702" -advanced -confirm -noPromptPassphrase
分别使用grid和oracle用户验证SSH connectivity:
[grid@victorrhel701:/home/oracle victordb1]$ for h in victorrhel701 victorrhel701priv victorrhel702 victorrhel702priv;do
ssh -l grid -o StrictHostKeyChecking=no $h date;
done
[oracle@victorrhel701:/home/grid +ASM1]$ for h in victorrhel701 victorrhel701priv victorrhel702 victorrhel702priv;do
ssh -l oracle -o StrictHostKeyChecking=no $h date;
done
配置ASM磁盘udev规则
-
- 供ASM使用的磁盘为sdd - sdi,可以使用lsblk命令查看磁盘信息:
[root@victorrhel701:/root ]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 4.2G 0 rom /mnt/oracleiso
nvme0n1 259:0 0 200G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
├─nvme0n1p2 259:2 0 116G 0 part
│ ├─rhel-swap 253:0 0 16G 0 lvm [SWAP]
│ └─rhel-oracle 253:1 0 100G 0 lvm /oracle
└─nvme0n1p3 259:3 0 83G 0 part /
-
- 使用以下命令配置ASM disk udev, 并将生成的配置文件拷贝到其它节点。
for i in a b c d e f; do
echo "KERNEL==\"sd*\", SUBSYSTEM==\"block\", PROGRAM==\"/lib/udev/scsi_id -g -u -d /dev/\$name\", RESULT==\"$(/lib/udev/scsi_id -g -u -d /dev/sd$i)\", SYMLINK+=\"asmdisks/asmdisk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done > /etc/udev/rules.d/99-oracle-asmdisks.rules
-
- 重载udev规则并触发udev生效:
# udevadm control --reload-rules
# udevadm trigger
# ls -l /dev/asmdisks/
[root@victorrhel701:/root ]# ls -l /dev/asmdisks/
lrwxrwxrwx 1 root root 6 1月 18 15:51 asmdiska -> ../sda
lrwxrwxrwx 1 root root 6 1月 18 15:51 asmdiskb -> ../sdb
lrwxrwxrwx 1 root root 6 1月 18 15:51 asmdiskc -> ../sdc
lrwxrwxrwx 1 root root 6 1月 18 15:51 asmdiskd -> ../sdd
lrwxrwxrwx 1 root root 6 1月 18 15:51 asmdiske -> ../sde
lrwxrwxrwx 1 root root 6 1月 18 15:51 asmdiskf -> ../sdf
[root@victorrhel701:/root ]# ll /dev/sd*
brw-rw---- 1 grid asmadmin 8, 0 1月 18 15:51 /dev/sda
brw-rw---- 1 grid asmadmin 8, 16 1月 18 15:51 /dev/sdb
brw-rw---- 1 grid asmadmin 8, 32 1月 18 15:51 /dev/sdc
brw-rw---- 1 grid asmadmin 8, 48 1月 18 15:51 /dev/sdd
brw-rw---- 1 grid asmadmin 8, 64 1月 18 15:51 /dev/sde
brw-rw---- 1 grid asmadmin 8, 80 1月 18 15:51 /dev/sdf
在各节点安装CVU RPM包
[root@victorrhel701:/root ]# cd /oracle/app/19.0.0/grid/cv/rpm
[root@victorrhel701:/oracle/app/19.0.0/grid/cv/rpm ]# export CVUQDISK_GRP=oinstall
[root@victorrhel701:/oracle/app/19.0.0/grid/cv/rpm ]# rpm -ivh cvuqdisk-1.0.10-1.rpm
Preparing... ################################# [100%]
Updating / installing...
1:cvuqdisk-1.0.10-1 ################################# [100%]
[root@victorrhel701:/oracle/app/19.0.0/grid/cv/rpm ]# scp cvuqdisk-1.0.10-1.rpm victorrhel702:/root
[root@victorrhel702:/root ]# 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%]
GRID配置安装
GIMR数据库说明:
在19c中,不再强制安装GIMR数据库,可以在安装阶段选择不安装GIMR,在安装完成后再创建GIMR数据库,以加快整个安装的进度。
检查所有节点的配置文件/etc/oraInst.loc、/etc/oratab是否存在相关配置,若有,则删除之。
-
- 使用root用户登录所有节点,执行:
[root@victorrhel702:/root ]# rm -rf /etc/oracle /tmp/.oracle /var/tmp/.oracle /oracle/app/oraInventory /oracle/app/grid/* /tmp/GridSetupActions*
-
- 使用 grid 用户安装 grid:
[grid@victorrhel701:/home/grid +ASM1]$ cd /oracle/app/19.0.0/grid/
[grid@victorrhel701:/oracle/app/19.0.0/grid +ASM1]$ ./gridSetup.sh
Launching Oracle Grid Infrastructure Setup Wizard...
应用GI RU
[grid@victorrhel701:/psu +ASM1]$ ll
total 3345240
-rw-r--r-- 1 grid oinstall 3297891272 Jan 23 16:44 p36031453_190000_Linux-x86-64.zip
-rw-r--r-- 1 grid oinstall 127629034 Jan 23 16:27 p6880880_122010_Linux-x86-64.zip
更新 OPatch
[grid@victorrhel701:/oracle/app/19.0.0/grid +ASM1]$ mv OPatch OPatch_bak
[grid@victorrhel701:/oracle/app/19.0.0/grid +ASM1]$ unzip /psu/p6880880_122010_Linux-x86-64.zip -d ./
[grid@victorrhel701:/oracle/app/19.0.0/grid +ASM1]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.41
OPatch succeeded.
[grid@victorrhel701:/oracle/app/19.0.0/grid +ASM1]$ ./gridSetup.sh -applyRU /psu/36031453/35940989
Preparing the home to patch...
Applying the patch /psu/36031453/35940989...
Successfully applied the patch.
The log can be found at: /tmp/GridSetupActions2024-01-23_05-26-14PM/installerPatchActions_2024-01-23_05-26-14PM.log
Launching Oracle Grid Infrastructure Setup Wizard...
-
- 因为前面已经手动配置了互信,这里直接选择 Test
-
- 在 2 个节点上,root 用户执行脚本
[root@victorrhel701:/root ]# /oracle/app/oraInventory/orainstRoot.sh
[root@victorrhel702:/root ]# /oracle/app/oraInventory/orainstRoot.sh
[root@victorrhel701:/root ]# /oracle/app/19.0.0/grid/root.sh
[root@victorrhel702:/root ]# /oracle/app/19.0.0/grid/root.sh
安装后检查
-
- 检查集群资源
[grid@victorrhel701:/home/grid +ASM1]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.chad
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.net1.network
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.ons
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.proxy_advm
OFFLINE OFFLINE victorrhel701 STABLE
OFFLINE OFFLINE victorrhel702 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE victorrhel701 STABLE
ora.OCR.dg(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.asm(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 Started,STABLE
2 ONLINE ONLINE victorrhel702 Started,STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.cvu
1 ONLINE ONLINE victorrhel701 STABLE
ora.qosmserver
1 ONLINE ONLINE victorrhel701 STABLE
ora.scan1.vip
1 ONLINE ONLINE victorrhel701 STABLE
ora.victorrhel701.vip
1 ONLINE ONLINE victorrhel701 STABLE
ora.victorrhel702.vip
1 ONLINE ONLINE victorrhel702 STABLE
--------------------------------------------------------------------------------
-
- 检查补丁
[grid@victorrhel701:/home/grid +ASM1]$ $ORACLE_HOME/OPatch/opatch lspatches
36115038;TOMCAT RELEASE UPDATE 19.0.0.0.0 (36115038)
35967489;OCW RELEASE UPDATE 19.22.0.0.0 (35967489)
35956421;ACFS RELEASE UPDATE 19.22.0.0.0 (35956421)
35943157;Database Release Update : 19.22.0.0.240116 (35943157)
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
OPatch succeeded.
[grid@victorrhel702:/home/grid +ASM2]$ $ORACLE_HOME/OPatch/opatch lspatches
36115038;TOMCAT RELEASE UPDATE 19.0.0.0.0 (36115038)
35967489;OCW RELEASE UPDATE 19.22.0.0.0 (35967489)
35956421;ACFS RELEASE UPDATE 19.22.0.0.0 (35956421)
35943157;Database Release Update : 19.22.0.0.240116 (35943157)
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
OPatch succeeded.
ASMCA创建磁盘组
在创建数据库之前,首先使用grid用户调用asmca创建必要的磁盘组,用于存放数据库文件。
创建2个磁盘组:
-
- MGMT : 存放GIMR。
- DATA : 存放数据文件等。
- ARCH : 存放归档日志和镜像的ONLINE LOGFILE。
[grid@victorrhel701:/home/grid +ASM1]$ asmca
RDBMS配置安装
.应用DB RU
-
- 更新 OPatch
- 更新 OPatch
[oracle@victorrhel701:/oracle/app/oracle/product/19.0.0/dbhome_1 victordb1]$ mv OPatch OPatch_bak
[oracle@victorrhel701:/oracle/app/oracle/product/19.0.0/dbhome_1 victordb1]$ unzip /psu/p6880880_122010_Linux-x86-64.zip -d ./
[oracle@victorrhel701:/oracle/app/oracle/product/19.0.0/dbhome_1 victordb1]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.41
OPatch succeeded.
[oracle@victorrhel701:/oracle/app/oracle/product/19.0.0/dbhome_1 victordb1]$ ./runInstaller -applyRU /psu/36031453/35940989
-
- 2 个节点上 root 执行脚本
[root@victorrhel701:/oracle ]# /oracle/app/oracle/product/19.0.0/dbhome_1/root.sh
[root@victorrhel702:/root ]# /oracle/app/oracle/product/19.0.0/dbhome_1/root.sh
安装后检查
-
- 检查补丁
[oracle@victorrhel701:/home/oracle victordb1]$ $ORACLE_HOME/OPatch/opatch lspatches
35967489;OCW RELEASE UPDATE 19.22.0.0.0 (35967489)
35943157;Database Release Update : 19.22.0.0.240116 (35943157)
OPatch succeeded.
DBCA创建数据库
-
- 使用oracle用户执行dbca命令创建数据库。
- 使用oracle用户执行dbca命令创建数据库。
[oracle@victorrhel701:/home/oracle victordb1]$ dbca
-
- SGA+PGA等于物理内存的 70-80%
安装后检查
-
- 检查集群资源
[grid@victorrhel701:/home/grid +ASM1]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.chad
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.net1.network
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.ons
ONLINE ONLINE victorrhel701 STABLE
ONLINE ONLINE victorrhel702 STABLE
ora.proxy_advm
OFFLINE OFFLINE victorrhel701 STABLE
OFFLINE OFFLINE victorrhel702 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ARCH.dg(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.DATA.dg(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE victorrhel701 STABLE
ora.MGMT.dg(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.OCR.dg(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.asm(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 Started,STABLE
2 ONLINE ONLINE victorrhel702 Started,STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
1 ONLINE ONLINE victorrhel701 STABLE
2 ONLINE ONLINE victorrhel702 STABLE
ora.cvu
1 ONLINE ONLINE victorrhel701 STABLE
ora.qosmserver
1 ONLINE ONLINE victorrhel701 STABLE
ora.scan1.vip
1 ONLINE ONLINE victorrhel701 STABLE
ora.victordb.db
1 ONLINE ONLINE victorrhel701 Open,HOME=/oracle/ap
p/oracle/product/19.
0.0/dbhome_1,STABLE
2 ONLINE ONLINE victorrhel702 Open,HOME=/oracle/ap
p/oracle/product/19.
0.0/dbhome_1,STABLE
ora.victorrhel701.vip
1 ONLINE ONLINE victorrhel701 STABLE
ora.victorrhel702.vip
1 ONLINE ONLINE victorrhel702 STABLE
--------------------------------------------------------------------------------
-
- 点击Close按钮,结束数据库的创建。
- 登录数据库检查sqlpatch信息:
[oracle@victorrhel701:/home/oracle victordb1]$ sqlplus / as sysdba
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB READ WRITE NO
SQL> select patch_id,action,status,action_time,description from dba_registry_sqlpatch;
PATCH_ID ACTION STATUS ACTION_TIME DESCRIPTION
---------- ------------------------------ -------------------- ------------------------------ ---------------------------------------------------------------------------------------------------
35943157 APPLY SUCCESS 24-JAN-24 10.16.54.358890 PM Database Release Update : 19.22.0.0.240116 (35943157)
SQL> select inst_id,name,open_mode from gv$pdbs order by 2,1;
INST_ID NAME OPEN_MODE
---------- -------------------- --------------------
1 PDB READ WRITE
2 PDB READ WRITE
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY