Oracle 数据库安装只需 5 分钟?不服不行!

大家好,这里是 DBA学习之路,专注于提升数据库运维效率。

前言

前几天看到 Debian 出了 12.10 版本,今天周末手痒就用脚本测了一把一键安装 Oracle,没想到安装很顺利,只花了 5 分钟左右。至于为什么要选 ARM 版本,是因为我的电脑是 ARM 芯片,所以只能安装 ARM 版本的操作系统了,Oracle 也就只能选择 19C 版本,

本文就演示一下我如何在 Debian 12.10(ARM)安装 Oracle 19C 单机版过程。

脚本介绍

作为一名 Oracle DBA,工作中无可避免的需要安装部署 Oracle 数据库,例如生产建库,恢复测试,容灾搭建等等。众所周知,Oracle 从零开始安装部署一套数据库需要花费大量的时间和精力。往往有时候因为粗心敲错代码就导致安装部署失败的情况时有发生。

目前已经部分开源,可以应对大部分安装工作,大家可自行试用!

脚本下载地址:https://gitee.com/luciferlpc/OracleShellInstall

PS:不好用,青学会会长倒立洗头!

一键安装

使用脚本安装前,首先需要自行安装好操作系统(包括网络的配置),然后上传 Oracle 软件即可执行安装。

环境信息

这里我大概列一下我的环境信息:

# 主机版本
root@Debian12:~# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

# 网络信息
root@Debian12:~# ip a
2: enp0s5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:1c:42:0a:39:fc brd ff:ff:ff:ff:ff:ff
    inet 10.211.55.16/24 brd 10.211.55.255 scope global dynamic noprefixroute enp0s5
       valid_lft 1696sec preferred_lft 1696sec
    inet6 fdb2:2c26:f4e4:0:7952:491b:e58c:2a51/64 scope global temporary dynamic 
       valid_lft 602898sec preferred_lft 84186sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fe0a:39fc/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 2591938sec preferred_lft 604738sec
    inet6 fe80::21c:42ff:fe0a:39fc/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

# 连接外网测试
root@Debian12:~# ping www.baidu.com
PING www.a.shifen.com (180.101.51.73) 56(84) bytes of data.
64 bytes from 180.101.51.73 (180.101.51.73): icmp_seq=1 ttl=128 time=11.4 ms
64 bytes from 180.101.51.73 (180.101.51.73): icmp_seq=2 ttl=128 time=31.7 ms
64 bytes from 180.101.51.73 (180.101.51.73): icmp_seq=3 ttl=128 time=77.8 ms

# 安装包存放在 /soft 目录下
root@Debian12:/soft# ls -l
-rw------- 1 root root 2415583176 Mar 22 19:41 LINUX.ARM64_1919000_db_home.zip
-rw-r--r-- 1 root root     245295 Mar 22 19:35 OracleShellInstall
-rwxr-xr-x 1 root root     321590 Mar 22 19:37 rlwrap-0.44.tar.gz

这里有一个 OracleShellInstall 脚本

安装命令

参考脚本对应的 README 文档,使用标准生产环境安装参数进行安装:

# 根据脚本 README 或者 -h 命令提示,编辑好一键安装命令,进入 /soft 目录执行安装:
root@Debian12:/soft# chmod +x OracleShellInstall 
root@Debian12:/soft# ./OracleShellInstall -lf enp0s5 `# local ip ifname`\
-n Debian12 `# 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`\
-opd Y `# optimize db`

安装过程

整个安装过程无需人工干预,选择对应的模式和版本之后就会执行全自动安装,安装过程如下:

   ███████                             ██          ████████ ██               ██  ██ ██                    ██              ██  ██
  ██░░░░░██                           ░██         ██░░░░░░ ░██              ░██ ░██░██                   ░██             ░██ ░██
 ██     ░░██ ██████  ██████    █████  ░██  █████ ░██       ░██       █████  ░██ ░██░██ ███████   ██████ ██████  ██████   ░██ ░██
░██      ░██░░██░░█ ░░░░░░██  ██░░░██ ░██ ██░░░██░█████████░██████  ██░░░██ ░██ ░██░██░░██░░░██ ██░░░░ ░░░██░  ░░░░░░██  ░██ ░██
░██      ░██ ░██ ░   ███████ ░██  ░░  ░██░███████░░░░░░░░██░██░░░██░███████ ░██ ░██░██ ░██  ░██░░█████   ░██    ███████  ░██ ░██
░░██     ██  ░██    ██░░░░██ ░██   ██ ░██░██░░░░        ░██░██  ░██░██░░░░  ░██ ░██░██ ░██  ░██ ░░░░░██  ░██   ██░░░░██  ░██ ░██
 ░░███████  ░███   ░░████████░░█████  ███░░██████ ████████ ░██  ░██░░██████ ███ ███░██ ███  ░██ ██████   ░░██ ░░████████ ███ ███
  ░░░░░░░   ░░░     ░░░░░░░░  ░░░░░  ░░░  ░░░░░░ ░░░░░░░░  ░░   ░░  ░░░░░░ ░░░ ░░░ ░░ ░░░   ░░ ░░░░░░     ░░   ░░░░░░░░ ░░░ ░░░ 


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

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

数据库安装模式: single                                                                           

请选择数据库版本 [19] : 19

数据库版本:     19                                                                               

!!! 免责声明:当前操作系统版本是 [ Debian GNU/Linux 12 (bookworm) ] 不在 Oracle 官方支持列表,本脚本只负责安装,请确认是否继续安装 (Y/N): [Y] 

OracleShellInstall 开始安装,详细安装过程可查看日志: tail -2000f /soft/print_shell_install_20250322103331.log                                                                                  

正在进行安装前检查,请稍等......                                                                                  

正在检测安装包 /soft/LINUX.ARM64_1919000_db_home.zip 的 MD5 值是否正确,请稍等......                                                                                  

正在配置网络软件源......已完成 (耗时: 5)
正在获取操作系统信息......已完成 (耗时: 1)
正在安装依赖包......已完成 (耗时: 30)
正在配置 Swap......已完成 (耗时: 11)
正在配置主机名和 hosts 文件......已完成 (耗时: 0)
正在创建用户和组......已完成 (耗时: 1)
正在创建安装目录......已完成 (耗时: 0)
正在配置 Avahi-daemon 服务......已完成 (耗时: 1)
正在配置透明大页 && NUMA && 磁盘 IO 调度器......已完成 (耗时: 1)
正在配置操作系统参数 sysctl......已完成 (耗时: 1)
正在配置 RemoveIPC......已完成 (耗时: 1)
正在配置用户限制 limit......已完成 (耗时: 1)
正在配置 shm 目录......已完成 (耗时: 1)
正在配置用户环境变量......已完成 (耗时: 1)
正在解压 Oracle 安装包以及补丁......已完成 (耗时: 34)
正在安装 Oracle 软件以及补丁......已完成 (耗时: 41)
正在创建监听......已完成 (耗时: 1)
正在创建数据库......已完成 (耗时: 236)
正在优化数据库......已完成 (耗时: 5)

恭喜!Oracle 一键安装执行完成 (耗时: 378),现在是否重启主机:[Y/N] Y

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

到这里,整个安装就完成了,非常丝滑!可以看到包括解压软件在内一共就花了 378 秒~

连接测试

安装完成后,我们进行一些简单的连接测试,确保数据库可以正常使用。

首先,查看 Oracle 版本以及补丁:

[oracle@Debian12:/home/oracle]$ sqlplus -v

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

[oracle@Debian12:/home/oracle]$ opatch lspatches
There are no Interim patches installed in this Oracle Home "/u01/app/oracle/product/19.3.0/db".

OPatch succeeded.

查看监听是否正常:

[oracle@Debian12:/home/oracle]$ lsnrctl stat

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 22-MAR-2025 10:42:42

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=Debian12)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                22-MAR-2025 10:41:51
Uptime                    0 days 0 hr. 0 min. 50 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.3.0/db/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/Debian12/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Debian12)(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

连接数据库:

[oracle@Debian12:/home/oracle]$ sas

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 22 10:42:54 2025
Version 19.19.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

SYS@lucifer SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string
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

数据库连接正常。

写在最后

俗说得好:"懒人"推动世界的发展。 既然能用脚本解决的事情,为什么还要那么麻烦,干就完事儿了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Lucifer三思而后行

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值