← 返回安装合集
腾讯 TencentOS 2.4 一键安装 Oracle 11GR2 单机
🚀 获取 OracleShellInstall 一键安装脚本
支持 Oracle 11gR2 ~ 26ai 全版本,覆盖 20+ 操作系统,单机 / ASM / RAC 三种模式一键部署。告别繁琐手动配置,让安装效率提升 10 倍。
大家好,这里是 Lucifer三思而后行,专注于提升数据库运维效率。
前言
Oracle 一键安装脚本,演示腾讯 TencentOS 2.4 一键安装 Oracle 11GR2 单机过程(全程无需人工干预)。
安装准备
- 系统组安装好操作系统(支持最小化安装)
- 网络组配置好主机网络,通常只需要一个公网 IP 地址
- DBA 创建软件目录:
mkdir /soft - DBA 上传 Oracle 安装介质(基础包,补丁包)到 /soft 目录下
- DBA 上传 Oracle 一键安装脚本到 /soft 目录下,授予脚本执行权限:
chmod +x OracleshellInstall - DBA 挂载主机 ISO 镜像,这里只需要 mount 上即可(这个很简单,不了解的可以百度下)
- 根据脚本安装脚本以及实际情况,配置好脚本的安装参数,在 /soft 目录下执行一键安装即可。
环境信息
# 主机版本
[root@tencent ~]# cat /etc/os-release
NAME="TencentOS Server"
VERSION="2.4"
ID="tencentos"
ID_LIKE="rhel fedora centos tlinux"
VERSION_ID="2.4"
PRETTY_NAME="TencentOS Server 2.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:tencentos:tencentos:2"
HOME_URL="https://cloud.tencent.com/product/ts"
# 网络信息
[root@tencent ~]# ip a
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:a8:1b:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.6.45/24 brd 192.168.6.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::4514:996a:f91b:fb8b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
# 挂载本地 ISO 镜像
[root@tencent ~]# mount /dev/sr0 /mnt/
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@tencent ~]# mount | grep iso9660 | grep -v "/run/media"
/dev/sr0 on /mnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048)
[root@tencent ~]# df -h|grep /mnt
/dev/sr0 14G 14G 0 100% /mnt
# 安装包存放在 /soft 目录下
[root@tencent ~]# mkdir /soft
[root@tencent /soft]# ll
-rw-r--r--. 1 root root 243137 Sep 24 14:08 OracleShellInstall
-rwx------. 1 root root 1395582860 Sep 24 14:08 p13390677_112040_Linux-x86-64_1of7.zip
-rwx------. 1 root root 1151304589 Sep 24 14:08 p13390677_112040_Linux-x86-64_2of7.zip
确保安装环境准备完成后,即可执行一键安装。
安装命令
使用标准生产环境安装参数:
[root@tencent /soft]# chmod +x OracleShellInstall
# 根据脚本 README 或者 -h 命令提示,编辑好一键安装命令,进入 /soft 目录执行安装:
./OracleShellInstall -lf ens33 `# local ip ifname`\
-n tencent `# 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
请选择数据库版本 [11|12|19|21|23] : 11
数据库版本: 11
!!! 免责声明:当前操作系统版本是 [ TencentOS Server 2.4 ] 不在 Oracle 官方支持列表,本脚本只负责安装,请确认是否继续安装 (Y/N): [Y]
OracleShellInstall 开始安装,详细安装过程可查看日志: tail -2000f /soft/print_shell_install_20240924142723.log
正在进行安装前检查,请稍等......
正在检测安装包 /soft/p13390677_112040_Linux-x86-64_1of7.zip 的 MD5 值是否正确,请稍等......
正在检测安装包 /soft/p13390677_112040_Linux-x86-64_2of7.zip 的 MD5 值是否正确,请稍等......
正在配置本地软件源......已完成 (耗时: 0 秒)
正在获取操作系统信息......已完成 (耗时: 1 秒)
正在安装依赖包......已完成 (耗时: 64 秒)
正在禁用防火墙......已完成 (耗时: 2 秒)
正在禁用 selinux......已完成 (耗时: 1 秒)
正在配置 nsyctl......已完成 (耗时: 1 秒)
正在配置主机名和 hosts 文件......已完成 (耗时: 0 秒)
正在创建用户和组......已完成 (耗时: 1 秒)
正在创建安装目录......已完成 (耗时: 0 秒)
正在配置透明大页 && NUMA && 磁盘 IO 调度器......已完成 (耗时: 1 秒)
正在配置操作系统参数 sysctl......已完成 (耗时: 1 秒)
正在配置 RemoveIPC......已完成 (耗时: 1 秒)
正在配置用户限制 limit......已完成 (耗时: 1 秒)
正在配置 shm 目录......已完成 (耗时: 1 秒)
正在配置用户环境变量......已完成 (耗时: 1 秒)
正在解压 Oracle 安装包以及补丁......已完成 (耗时: 28 秒)
正在安装 Oracle 软件以及补丁......已完成 (耗时: 167 秒)
正在创建监听......已完成 (耗时: 2 秒)
正在创建数据库......已完成 (耗时: 190 秒)
正在优化数据库......已完成 (耗时: 15 秒)
恭喜!Oracle 一键安装执行完成 (耗时: 486 秒),现在是否重启主机:[Y/N] Y
正在重启当前节点主机......
连接测试
查看系统版本:
[root@tencent ~]# cat /etc/os-release
NAME="TencentOS Server"
VERSION="2.4"
ID="tencentos"
ID_LIKE="rhel fedora centos tlinux"
VERSION_ID="2.4"
PRETTY_NAME="TencentOS Server 2.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:tencentos:tencentos:2"
HOME_URL="https://cloud.tencent.com/product/ts"
查看 Oracle 版本以及补丁:
[oracle@tencent:/home/oracle]$ sqlplus -v
SQL*Plus: Release 11.2.0.4.0 Production
[oracle@tencent:/home/oracle]$ opatch lspatches
There are no Interim patches installed in this Oracle Home.
检查监听:
[oracle@tencent:/home/oracle]$ lsnrctl stat
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-JUN-2024 17:02:45
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 13-JUN-2024 16:57:51
Uptime 0 days 0 hr. 4 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/tencent/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tencent)(PORT=1521)))
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@tencent:/home/oracle]$ sas SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 13 17:02:46 2024 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options sys@LUCIFER 2024-06-13 17:02:46> show parameter name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ 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 processor_group_name string service_names string lucifer
数据库连接正常。
感谢您的阅读,这里是 Lucifer三思而后行,欢迎点赞+关注,我会持续分享数据库知识、运维技巧。