前言
Oracle 一鍵安裝腳本,演示 RedHat 9.3 一鍵安裝 Oracle 19C 單機(19.23)過程(全程無需人工干預)。
?? 腳本下載地址:Shell腳本安裝Oracle數據庫
安裝準備
- 1、安裝好操作系統,建議安裝圖形化
- 2、配置好網絡
- 3、掛載本地 ISO 鏡像源
- 4、上傳軟件安裝包(安裝基礎包,補丁包)
- 5、上傳一鍵安裝腳本:OracleShellInstall
環境信息
[root@localhost ~]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="9.3 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.3 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"
[root@localhost ~]# ip a
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:80:58:e9 brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 192.168.183.90/24 brd 192.168.183.255 scope global noprefixroute ens160
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe80:58e9/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@localhost ~]# ll /soft
-rw-r--r-- 1 oracle oinstall 3059705302 May 11 18:28 LINUX.X64_193000_db_home.zip
-rwxr-xr-x 1 oracle oinstall 201960 May 11 18:31 OracleShellInstall
-rw-r--r-- 1 oracle oinstall 127475677 May 11 18:23 p36199232_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 1856311021 May 11 18:25 p36233263_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 133535622 May 11 18:23 p6880880_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 10528882688 May 11 18:33 rhel-9.3-x86_64-dvd.iso
確保安裝環境準備完成后,即可執行一鍵安裝。
安裝命令
使用標準生產環境安裝參數(安裝過程若失敗,腳本支持重復執行安裝):
./OracleShellInstall -lf ens160 `# local ip ifname`\
-n 19c `# hostname`\
-op oracle `# oracle password`\
-d /u01 `# software base dir`\
-ord /oradata `# data dir`\
-o lzhdb `# dbname`\
-dp oracle `# sys/system password`\
-ds AL32UTF8 `# database character`\
-ns AL16UTF16 `# national character`\
-redo 200 `# redo size`\
-opa 36233263 `# oracle PSU/RU`\
-jpa 36199232 `# OJVM PSU/RU`\
-opd Y `# optimize db`
安裝過程
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██
██?????██ ?██ ██?????? ?██ ?██ ?██?██ ?██ ?██ ?██
██ ??██ ██████ ██████ █████ ?██ █████ ?██ ?██ █████ ?██ ?██?██ ███████ ██████ ██████ ██████ ?██ ?██
?██ ?██??██??█ ??????██ ██???██ ?██ ██???██?█████████?██████ ██???██ ?██ ?██?██??██???██ ██???? ???██? ??????██ ?██ ?██
?██ ?██ ?██ ? ███████ ?██ ?? ?██?███████????????██?██???██?███████ ?██ ?██?██ ?██ ?██??█████ ?██ ███████ ?██ ?██
??██ ██ ?██ ██????██ ?██ ██ ?██?██???? ?██?██ ?██?██???? ?██ ?██?██ ?██ ?██ ?????██ ?██ ██????██ ?██ ?██
??███████ ?███ ??████████??█████ ███??██████ ████████ ?██ ?██??██████ ███ ███?██ ███ ?██ ██████ ??██ ??████████ ███ ███
??????? ??? ???????? ????? ??? ?????? ???????? ?? ?? ?????? ??? ??? ?? ??? ?? ?????? ?? ???????? ??? ???
注意:本腳本僅用于新服務器上實施部署數據庫使用,嚴禁在已運行數據庫的主機上執行,以免發生數據丟失或者損壞,造成不可挽回的損失!!!
請選擇安裝模式 [單機(si)/單機ASM(sa)/集群(rac)] : si
數據庫安裝模式: single
請選擇數據庫版本 [11/12/19/21] : 19
數據庫版本: 19
OracleShellInstall 開始安裝,詳細安裝過程可查看日志: tail -2000f /soft/print_ora_install_20240511183555.log
正在檢查操作系統是否符合安裝條件......已完成 (耗時: 0 秒)
正在去除密碼復雜度配置......已完成 (耗時: 0 秒)
正在配置 YUM 源......已完成 (耗時: 1 秒)
正在獲取操作系統信息......已完成 (耗時: 1 秒)
正在配置 Swap......已完成 (耗時: 0 秒)
正在配置防火墻......已完成 (耗時: 1 秒)
正在配置 selinux......已完成 (耗時: 0 秒)
正在配置 nsyctl......已完成 (耗時: 1 秒)
正在安裝依賴包......已完成 (耗時: 26 秒)
正在配置主機名和 /etc/hosts......已完成 (耗時: 0 秒)
正在創建用戶和組......已完成 (耗時: 1 秒)
正在創建安裝目錄......已完成 (耗時: 0 秒)
正在配置 Avahi-daemon 服務......已完成 (耗時: 1 秒)
正在配置透明大頁 && NUMA && 磁盤 IO 調度器......已完成 (耗時: 1 秒)
正在配置操作系統參數 sysctl......已完成 (耗時: 1 秒)
正在配置 RemoveIPC......已完成 (耗時: 2 秒)
正在配置用戶限制 limit......已完成 (耗時: 1 秒)
正在配置 shm 目錄......已完成 (耗時: 1 秒)
正在安裝 rlwrap 插件......已完成 (耗時: 0 秒)
正在配置用戶環境變量......已完成 (耗時: 1 秒)
正在解壓 Oracle 安裝包以及補丁......已完成 (耗時: 335 秒)
正在安裝 Oracle 軟件以及補丁......已完成 (耗時: 985 秒)
正在創建監聽......已完成 (耗時: 2 秒)
正在創建數據庫......已完成 (耗時: 646 秒)
正在優化數據庫......已完成 (耗時: 7 秒)
恭喜!Oracle 單機安裝成功 (耗時: 2014 秒),現在是否重啟主機:[Y/N] y
正在重啟主機......
連接測試
查看系統版本:
[root@19c soft]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="9.3 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.3 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"
查看 Oracle 版本以及補丁:
[oracle@19c:/home/oracle]$ sqlplus -v SQL*Plus: Release 19.0.0.0.0 - Production Version 19.23.0.0.0 [oracle@19c:/soft]$ opatch lspatches 36199232;OJVM RELEASE UPDATE: 19.23.0.0.240416 (36199232) 36233263;Database Release Update : 19.23.0.0.240416 (36233263) 29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399) OPatch succeeded.
查看監聽:
[oracle@19c:/soft]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 11-MAY-2024 19:17:35
Copyright (c) 1991, 2024, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=19c)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 11-MAY-2024 19:10:55
Uptime 0 days 0 hr. 6 min. 40 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/19c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=19c)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "lzhdb" has 1 instance(s).
Instance "lzhdb", status READY, has 1 handler(s) for this service...
Service "lzhdbXDB" has 1 instance(s).
Instance "lzhdb", status READY, has 1 handler(s) for this service...
The command completed successfully
連接數據庫:
[oracle@19c:/home/oracle]$ sas SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 11 19:17:01 2024 Version 19.23.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.23.0.0.0 sys@LZHDB 2024-05-11 19:17:01> show parameter name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cdb_cluster_name string cell_offloadgroup_name string db_file_name_convert string db_name string lzhdb db_unique_name string lzhdb global_names boolean FALSE instance_name string lzhdb lock_name_space string log_file_name_convert string pdb_file_name_convert string processor_group_name string service_names string lzhdb
數據庫連接正常。
最后修改時間:2026-03-23 16:24:01
「喜歡這篇文章,您的關注和贊賞是給作者最好的鼓勵」
關注作者
【版權聲明】本文為墨天輪用戶原創內容,轉載時必須標注文章的來源(墨天輪),文章鏈接,文章作者等基本信息,否則作者和墨天輪有權追究責任。如果您發現墨天輪中有涉嫌抄襲或者侵權的內容,歡迎發送郵件至:contact@modb.pro進行舉報,并提供相關證據,一經查實,墨天輪將立刻刪除相關內容。




