本文将演示如何使用脚本一键安装 Oracle 19C RAC 3 节点数据库的全过程。
在生产环境中,Linux 操作系统和网络一般不是由 DBA 来配置,为了更贴合生产使用,本脚本仅用于安装 Oracle 数据库,请提前安装好 Linux 操作系统。
主机版本 | 主机内存 | 磁盘空间 | 数据库版本 | PSU补丁版本 | OJVM补丁版本 | OPatch补丁版本 |
---|---|---|---|---|---|---|
Centos7.6 | 32G | 115G | 19C | 33509923 | 33808367 | 11.2.0.3.34 |
节点 | PubIP | PrivIP | VirIPI | SCANIP |
---|---|---|---|---|
1 | 193.1.3.1 | 1.1.1.1 | 193.1.3.4 | 193.1.3.10 |
2 | 193.1.3.2 | 1.1.1.2 | 193.1.3.5 | 193.1.3.10 |
3 | 193.1.3.3 | 1.1.1.3 | 193.1.3.6 | 193.1.3.10 |
## 节点一
[root@luciferdb03:/soft]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
eth1 658ca23d-769c-4a6f-a541-c236a412224d ethernet eth1
[root@luciferdb03:/soft]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 193.1.3.1 netmask 255.255.255.0 broadcast 193.1.3.255
inet6 fe80::eda:41ff:fe1d:ed3f prefixlen 64 scopeid 0x20<link>
ether 0c:da:41:1d:ed:3f txqueuelen 1000 (Ethernet)
RX packets 48758 bytes 9657994 (9.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 43755 bytes 9826085 (9.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.1.1.1 netmask 255.255.255.0 broadcast 1.1.1.255
inet6 fe80::eda:41ff:fe1d:f204 prefixlen 64 scopeid 0x20<link>
ether 0c:da:41:1d:f2:04 txqueuelen 1000 (Ethernet)
RX packets 10229514 bytes 15316863202 (14.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4215800 bytes 7159447755 (6.6 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
## 节点二
[root@luciferdb04:~]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
eth1 a8df8168-4427-4d8f-a472-da212e2d5a09 ethernet eth1
[root@luciferdb04:~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 193.1.3.2 netmask 255.255.255.0 broadcast 193.1.3.255
inet6 fe80::eda:41ff:fe1d:ae3c prefixlen 64 scopeid 0x20<link>
ether 0c:da:41:1d:ae:3c txqueuelen 1000 (Ethernet)
RX packets 43103 bytes 8675612 (8.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38950 bytes 8375054 (7.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.1.1.2 netmask 255.255.255.0 broadcast 1.1.1.255
inet6 fe80::eda:41ff:fe1d:9aed prefixlen 64 scopeid 0x20<link>
ether 0c:da:41:1d:9a:ed txqueuelen 1000 (Ethernet)
RX packets 10615410 bytes 11308390297 (10.5 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4025025 bytes 16239792705 (15.1 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
## 节点三
[root@luciferdb05:~]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
eth1 d6366244-2ef8-4e15-883e-4b12637f0dd2 ethernet eth1
[root@luciferdb05:~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 193.1.3.3 netmask 255.255.255.0 broadcast 193.1.3.255
inet6 fe80::eda:41ff:fe1d:f8b3 prefixlen 64 scopeid 0x20<link>
ether 0c:da:41:1d:f8:b3 txqueuelen 1000 (Ethernet)
RX packets 68256 bytes 16712778 (15.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 71805 bytes 16199787 (15.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.1.1.3 netmask 255.255.255.0 broadcast 1.1.1.255
inet6 fe80::eda:41ff:fe1d:765e prefixlen 64 scopeid 0x20<link>
ether 0c:da:41:1d:76:5e txqueuelen 1000 (Ethernet)
RX packets 9480723 bytes 10379158024 (9.6 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3423761 bytes 12959390768 (12.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在执行脚本之前,必须提前配置好 Public
和 Private
地址。
磁盘组 | 设备名称 | 数量 | 大小 | 冗余度 | 配置方式 |
---|---|---|---|---|---|
OCR | /dev/sdd,/dev/sde,/dev/sdf | 3 | 10G | NORMAL | multipath+udev |
DATA | /dev/sdb,/dev/sdc | 2 | 60G | EXTERNAL | multipath+udev |
ARCH | /dev/sda | 1 | 50G | EXTERNAL | multipath+udev |
## 节点一
[root@luciferdb03:/soft]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 50G 0 disk
sdb 8:16 0 60G 0 disk
sdc 8:32 0 70G 0 disk
sdd 8:48 0 10G 0 disk
sde 8:64 0 10G 0 disk
sdf 8:80 0 10G 0 disk
sr0 11:0 1 10G 0 rom
vda 252:0 0 128G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 127G 0 part
├─centos-root 253:0 0 114.1G 0 lvm /
└─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
loop0 7:0 0 10G 0 loop /mnt
## 节点二
[root@luciferdb04:~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 50G 0 disk
sdb 8:16 0 60G 0 disk
sdc 8:32 0 70G 0 disk
sdd 8:48 0 10G 0 disk
sde 8:64 0 10G 0 disk
sdf 8:80 0 10G 0 disk
sr0 11:0 1 10G 0 rom
vda 252:0 0 128G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 127G 0 part
├─centos-root 253:0 0 114.1G 0 lvm /
└─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
## 节点三
[root@luciferdb05:~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 50G 0 disk
sdb 8:16 0 60G 0 disk
sdc 8:32 0 70G 0 disk
sdd 8:48 0 10G 0 disk
sde 8:64 0 10G 0 disk
sdf 8:80 0 10G 0 disk
sr0 11:0 1 10G 0 rom
vda 252:0 0 128G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 127G 0 part
├─centos-root 253:0 0 114.1G 0 lvm /
└─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
在执行脚本之前,必须提前挂载好共享存储,脚本会自动配置多路径和udev。
首先,使用 ssh
工具连接到节点一 Linux 主机,创建一个存放安装介质的目录,比如:mkdir /soft
,然后上传安装所需的介质!
📢 注意:
[root@luciferdb03:/soft]# du -sh *
11G CentOS-7-x86_64-Athena-1904.iso ## 操作系统镜像
2.9G LINUX.X64_193000_db_home.zip ## 19C Grid 安装包
2.7G LINUX.X64_193000_grid_home.zip ## 19C Database 安装包
160K OracleShellInstall ## 一键安装脚本
2.5G p33509923_190000_Linux-x86-64.zip ## 19C Grid PSU 补丁
120M p33808367_190000_Linux-x86-64.zip ## 19C DB OJVM 补丁
119M p6880880_190000_Linux-x86-64.zip ## 19C OPatch 补丁
276K rlwrap-0.42.tar.gz ## 优化 sqlplus、rman 的翻页小插件
上传好以上安装介质就完成了第一步☝。
安装 Oracle 数据库需要安装一些 rpm 的依赖包,需要使用 yum
命令来安装,这就需要挂载 ISO 镜像来配置本地 YUM 源:
mount -o loop /soft/CentOS-7-x86_64-Athena-1904.iso /mnt
这里只需要执行 mount 命令挂载到 /mnt
目录下即可,配置好本地 YUM 源后,脚本里会自动配置 repo,执行 df -h | grep mnt
看到如下输出即代表成功挂载:
[root@orcl soft]# df -h | grep mnt
/dev/loop0 11G 11G 0 100% /mnt
📢 注意:如果不挂载 ISO 执行脚本,会提示:The iso file is not mounted on system
!
./OracleShellInstall -n luciferdb `# hostname prefix`\
-hn luciferdb03,luciferdb04,luciferdb05 `# rac node hostname`\
-cn luciferdb-cls `# cluster_name`\
-rp password `# root password`\
-gp oracle `# grid password`\
-op oracle `# oracle password`\
-lf eth0 `# local ip ifname`\
-pf eth1 `# rac private ip ifname`\
-ri 193.1.3.1,193.1.3.2,193.1.3.3 `# rac node public ip`\
-vi 193.1.3.4,193.1.3.5,193.1.3.6 `# rac virtual ip`\
-si 193.1.3.10 `# rac scan ip`\
-od /dev/sdd,/dev/sde,/dev/sdf `# rac ocr asm disk`\
-or NORMAL \
-dd /dev/sdb,/dev/sdc `# rac data asm disk`\
-ad /dev/sda `# rac arch asm disk`\
-o oradb `# dbname`\
-ds AL32UTF8 `# database character`\
-ns AL16UTF16 `# national character`\
-dp Oracle123Pwd `# sys/system password`\
-gpa 33509923 `# grid PSU/RU`\
-jpa 33808367 `# OJVM PSU/RU`\
-opd Y `# optimize db`
本文演示 3 节点安装,整个安装过程大概需要 90
分钟左右,全程自动安装建库,不需要人工干预,下面我们直接看视频演示:
RAC:Oracle 19C 3 节点 数据库一键安装