前言

Oracle 一键安装脚本,演示华为欧拉 openEuler 20.03 LTS SP4 一键安装 Oracle 12CR2 单机版过程(全程无需人工干预)。(脚本包括 ORALCE PSU/OJVM 等补丁自动安装

⭐️ 脚本下载地址Shell脚本安装Oracle数据库

脚本第三代支持 N 节点一键安装,不限制节点数!

安装准备

  • 1、安装好操作系统,建议安装图形化
  • 2、配置好网络
  • 3、挂载本地 ISO 镜像源
  • 4、上传软件安装包(安装基础包,补丁包)
  • 5、上传一键安装脚本:OracleShellInstall

环境信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 主机版本
[root@openEuler20 soft]# cat /etc/os-release
NAME="openEuler"
VERSION="20.03 (LTS-SP4)"
ID="openEuler"
VERSION_ID="20.03"
PRETTY_NAME="openEuler 20.03 (LTS-SP4)"
ANSI_COLOR="0;31"

# 网络信息
[root@openEuler20 soft]# ip a
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:03:ee:92 brd ff:ff:ff:ff:ff:ff
inet 192.168.6.168/24 brd 192.168.6.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::ff5b:ab16:9e9c:8088/64 scope link noprefixroute
valid_lft forever preferred_lft forever

# 挂载本地 ISO 镜像
[root@openEuler20 soft]# mount | grep iso9660 | grep -v "/run/media"
/dev/sr0 on /mnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048)
[root@openEuler20 soft]# df -h|grep /mnt
/dev/sr0 17G 17G 0 100% /mnt

# 安装包存放在 /soft 目录下
[root@openEuler20 soft]# ll
-rwx------. 1 root root 1307484 May 14 13:38 compat-glibc-2.12-4.el7.centos.x86_64.rpm
-rwx------. 1 root root 3314147328 May 14 13:49 LINUX.X64_122010_db_home.zip
-rwxr-xr-x. 1 root root 204381 May 14 13:37 OracleShellInstall
-rwx------. 1 root root 138325588 May 14 13:48 p35926712_122010_Linux-x86-64.zip
-rwx------. 1 root root 1148325873 May 14 13:48 p35966787_122010_Linux-x86-64.zip
-rwx------. 1 root root 127629034 May 14 13:48 p6880880_122010_Linux-x86-64.zip
-rwx------. 1 root root 321590 May 14 13:37 rlwrap-0.44.tar.gz

确保安装环境准备完成后,即可执行一键安装。

安装命令

使用标准生产环境安装参数(安装过程若失败,脚本支持重复执行安装):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 根据脚本 README 或者 -h 命令提示,编辑好一键安装命令,进入 /soft 目录执行安装:
./OracleShellInstall -lf ens33 `# local ip ifname`\
-n openEuler20 `# hostname`\
-op oracle `# oracle password`\
-d /u01 `# software base dir`\
-ord /oradata `# data dir`\
-o lucifer `# dbname`\
-dp oracle `# sys/system password`\
-ds AL32UTF8 `# database character`\
-ns AL16UTF16 `# national character`\
-redo 100 `# redo size`\
-opa 35966787 `# oracle PSU/RU`\
-jpa 35926712 `# OJVM PSU/RU`\
-opd Y `# optimize db`

安装过程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
   ███████                             ██          ████████ ██               ██  ██ ██                    ██              ██  ██
██░░░░░██ ░██ ██░░░░░░ ░██ ░██ ░██░██ ░██ ░██ ░██
██ ░░██ ██████ ██████ █████ ░██ █████ ░██ ░██ █████ ░██ ░██░██ ███████ ██████ ██████ ██████ ░██ ░██
░██ ░██░░██░░█ ░░░░░░██ ██░░░██ ░██ ██░░░██░█████████░██████ ██░░░██ ░██ ░██░██░░██░░░██ ██░░░░ ░░░██░ ░░░░░░██ ░██ ░██
░██ ░██ ░██ ░ ███████ ░██ ░░ ░██░███████░░░░░░░░██░██░░░██░███████ ░██ ░██░██ ░██ ░██░░█████ ░██ ███████ ░██ ░██
░░██ ██ ░██ ██░░░░██ ░██ ██ ░██░██░░░░ ░██░██ ░██░██░░░░ ░██ ░██░██ ░██ ░██ ░░░░░██ ░██ ██░░░░██ ░██ ░██
░░███████ ░███ ░░████████░░█████ ███░░██████ ████████ ░██ ░██░░██████ ███ ███░██ ███ ░██ ██████ ░░██ ░░████████ ███ ███
░░░░░░░ ░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░░ ░░░░░░░░ ░░ ░░ ░░░░░░ ░░░ ░░░ ░░ ░░░ ░░ ░░░░░░ ░░ ░░░░░░░░ ░░░ ░░░


注意:本脚本仅用于新服务器上实施部署数据库使用,严禁在已运行数据库的主机上执行,以免发生数据丢失或者损坏,造成不可挽回的损失!!!

请选择安装模式 [单机(si)/单机ASM(sa)/集群(rac)] : si

数据库安装模式: single

请选择数据库版本 [11/12/19/21] : 12

数据库版本: 12

OracleShellInstall 开始安装,详细安装过程可查看日志: tail -2000f /soft/print_ora_install_20240514135411.log
正在检查操作系统是否符合安装条件......已完成 (耗时: 0 秒)
正在去除密码复杂度配置......已完成 (耗时: 2 秒)
正在配置 YUM 源......已完成 (耗时: 1 秒)
正在获取操作系统信息......已完成 (耗时: 1 秒)
正在配置 Swap......已完成 (耗时: 0 秒)
正在配置防火墙......已完成 (耗时: 2 秒)
正在配置 selinux......已完成 (耗时: 1 秒)
正在配置 nsyctl......已完成 (耗时: 1 秒)
正在安装依赖包......已完成 (耗时: 65 秒)
正在配置主机名和 /etc/hosts......已完成 (耗时: 0 秒)
正在创建用户和组......已完成 (耗时: 2 秒)
正在创建安装目录......已完成 (耗时: 1 秒)
正在配置 Avahi-daemon 服务......已完成 (耗时: 8 秒)
正在配置透明大页 && NUMA && 磁盘 IO 调度器......已完成 (耗时: 1 秒)
正在配置操作系统参数 sysctl......已完成 (耗时: 1 秒)
正在配置 RemoveIPC......已完成 (耗时: 1 秒)
正在配置用户限制 limit......已完成 (耗时: 1 秒)
正在配置 shm 目录......已完成 (耗时: 1 秒)
正在安装 rlwrap 插件......已完成 (耗时: 18 秒)
正在配置用户环境变量......已完成 (耗时: 2 秒)
正在解压 Oracle 安装包以及补丁......已完成 (耗时: 156 秒)
正在安装 Oracle 软件以及补丁......已完成 (耗时: 1497 秒)
正在创建监听......已完成 (耗时: 6 秒)
正在创建数据库......已完成 (耗时: 856 秒)
正在优化数据库......已完成 (耗时: 15 秒)

恭喜!Oracle 单机安装成功 (耗时: 2639 秒),现在是否重启主机:[Y/N] Y

正在重启当前节点主机......

连接测试

查看系统版本:

1
2
3
4
5
6
7
[root@openEuler20 soft]# cat /etc/os-release 
NAME="openEuler"
VERSION="20.03 (LTS-SP4)"
ID="openEuler"
VERSION_ID="20.03"
PRETTY_NAME="openEuler 20.03 (LTS-SP4)"
ANSI_COLOR="0;31"

查看 Oracle 版本以及补丁:

1
2
3
4
5
6
7
8
9
[oracle@openEuler20:/home/oracle]$ sqlplus -v

SQL*Plus: Release 12.2.0.1.0 Production

[oracle@openEuler20:/home/oracle]$ opatch lspatches
35926712;OJVM RELEASE UPDATE 12.2.0.1.240116 (35926712)
35966787;Database Jan 2024 Release Update : 12.2.0.1.240116 (35966787)

OPatch succeeded.

查看监听:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[oracle@openEuler20:/home/oracle]$ lsnrctl stat

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 14-MAY-2024 14:46:34

Copyright (c) 1991, 2016, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=openEuler20)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 14-MAY-2024 14:43:51
Uptime 0 days 0 hr. 2 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/db/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/openEuler20/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=openEuler20)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "lucifer" has 1 instance(s).
Instance "lucifer", status READY, has 1 handler(s) for this service...
Service "luciferXDB" has 1 instance(s).
Instance "lucifer", status READY, has 1 handler(s) for this service...
The command completed successfully

连接数据库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[oracle@openEuler20:/home/oracle]$ sas

SQL*Plus: Release 12.2.0.1.0 Production on Tue May 14 14:46:36 2024

Copyright (c) 1982, 2016, Oracle. All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

sys@LUCIFER 2024-05-14 14:46:36> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name string lucifer
cell_offloadgroup_name string
db_file_name_convert string
db_name string lucifer
db_unique_name string lucifer
global_names boolean FALSE
instance_name string lucifer
lock_name_space string
log_file_name_convert string
pdb_file_name_convert string
processor_group_name string
service_names string lucifer

数据库连接正常。