前言
Oracle 一鍵安裝腳本,演示華為 Ubuntu 22.04 一鍵安裝 Oracle 11GR2 單機版過程(全程無需人工干預)。
?? 腳本下載地址:Shell腳本安裝Oracle數(shù)據(jù)庫
安裝準備
- 1、安裝好操作系統(tǒng),建議安裝圖形化
- 2、配置好網(wǎng)絡
- 3、上傳軟件安裝包(安裝基礎包,補丁包)
- 4、上傳一鍵安裝腳本:OracleShellInstall
環(huán)境信息
# 主機版本
root@Ubuntu22:/soft# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
# 網(wǎng)絡信息
root@Ubuntu22:/soft# ip a
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:e9:de:06 brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 192.168.6.123/24 brd 192.168.6.255 scope global dynamic noprefixroute ens160
valid_lft 84800sec preferred_lft 84800sec
inet6 fe80::d5b7:70e3:c953:9b59/64 scope link noprefixroute
valid_lft forever preferred_lft forever
# 連接外網(wǎng)測試
root@Ubuntu22:/soft# ping www.baidu.com
PING www.a.shifen.com (180.101.50.188) 56(84) bytes of data.
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=1 ttl=53 time=5.32 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=2 ttl=53 time=5.24 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=3 ttl=53 time=5.75 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=4 ttl=53 time=5.79 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=5 ttl=53 time=5.91 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=6 ttl=53 time=5.76 ms
# 安裝包存放在 /soft 目錄下
root@Ubuntu22:/soft# ls -l
-rwxr-xr-x 1 root root 217523 6月 6 11:33 OracleShellInstall
-rwx------ 1 root root 1395582860 6月 6 11:27 p13390677_112040_Linux-x86-64_1of7.zip
-rwx------ 1 root root 1151304589 6月 6 11:27 p13390677_112040_Linux-x86-64_2of7.zip
確保安裝環(huán)境準備完成后,即可執(zhí)行一鍵安裝。
安裝命令
使用標準生產(chǎn)環(huán)境安裝參數(shù)(安裝過程若失敗,腳本支持重復執(zhí)行安裝):
# 根據(jù)腳本 README 或者 -h 命令提示,編輯好一鍵安裝命令,進入 /soft 目錄執(zhí)行安裝:
./OracleShellInstall -lf ens160 `# local ip ifname`\
-n Ubuntu22 `# 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`
安裝過程
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██
██?????██ ?██ ██?????? ?██ ?██ ?██?██ ?██ ?██ ?██
██ ??██ ██████ ██████ █████ ?██ █████ ?██ ?██ █████ ?██ ?██?██ ███████ ██████ ██████ ██████ ?██ ?██
?██ ?██??██??█ ??????██ ██???██ ?██ ██???██?█████████?██████ ██???██ ?██ ?██?██??██???██ ██???? ???██? ??????██ ?██ ?██
?██ ?██ ?██ ? ███████ ?██ ?? ?██?███████????????██?██???██?███████ ?██ ?██?██ ?██ ?██??█████ ?██ ███████ ?██ ?██
??██ ██ ?██ ██????██ ?██ ██ ?██?██???? ?██?██ ?██?██???? ?██ ?██?██ ?██ ?██ ?????██ ?██ ██????██ ?██ ?██
??███████ ?███ ??████████??█████ ███??██████ ████████ ?██ ?██??██████ ███ ███?██ ███ ?██ ██████ ??██ ??████████ ███ ███
??????? ??? ???????? ????? ??? ?????? ???????? ?? ?? ?????? ??? ??? ?? ??? ?? ?????? ?? ???????? ??? ???
注意:本腳本僅用于新服務器上實施部署數(shù)據(jù)庫使用,嚴禁在已運行數(shù)據(jù)庫的主機上執(zhí)行,以免發(fā)生數(shù)據(jù)丟失或者損壞,造成不可挽回的損失!!!
請選擇安裝模式 [單機(si)/單機ASM(sa)/集群(rac)] : si
數(shù)據(jù)庫安裝模式: single
請選擇數(shù)據(jù)庫版本 [11/12/19/21] : 11
數(shù)據(jù)庫版本: 11
!!! 免責聲明:當前操作系統(tǒng)版本是 [ Ubuntu 22.04.4 LTS ] 不在 Oracle 官方支持列表,本腳本只負責安裝,請確認是否繼續(xù)安裝 (Y/N): [Y]
OracleShellInstall 開始安裝,詳細安裝過程可查看日志: tail -2000f /soft/print_shell_install_.log
正在去除密碼復雜度配置......已完成 (耗時: 0 秒)
正在配置網(wǎng)絡軟件源......已完成 (耗時: 35 秒)
正在獲取操作系統(tǒng)信息......已完成 (耗時: 1 秒)
正在安裝依賴包......已完成 (耗時: 164 秒)
正在配置 Swap......已完成 (耗時: 2 秒)
正在配置防火墻......已完成 (耗時: 1 秒)
正在配置 selinux......已完成 (耗時: 0 秒)
正在配置主機名和 /etc/hosts......已完成 (耗時: 0 秒)
正在創(chuàng)建用戶和組......已完成 (耗時: 1 秒)
正在創(chuàng)建安裝目錄......已完成 (耗時: 0 秒)
正在配置 Avahi-daemon 服務......已完成 (耗時: 3 秒)
正在配置透明大頁 && NUMA && 磁盤 IO 調(diào)度器......已完成 (耗時: 7 秒)
正在配置操作系統(tǒng)參數(shù) sysctl......已完成 (耗時: 1 秒)
正在配置 RemoveIPC......已完成 (耗時: 0 秒)
正在配置用戶限制 limit......已完成 (耗時: 1 秒)
正在配置 shm 目錄......已完成 (耗時: 1 秒)
正在配置用戶環(huán)境變量......已完成 (耗時: 1 秒)
正在解壓 Oracle 安裝包以及補丁......已完成 (耗時: 34 秒)
正在安裝 Oracle 軟件以及補丁......已完成 (耗時: 270 秒)
正在創(chuàng)建監(jiān)聽......已完成 (耗時: 4 秒)
正在創(chuàng)建數(shù)據(jù)庫......已完成 (耗時: 231 秒)
正在優(yōu)化數(shù)據(jù)庫......已完成 (耗時: 20 秒)
恭喜!Oracle 單機安裝成功 (耗時: 778 秒),現(xiàn)在是否重啟主機:[Y/N] Y
正在重啟當前節(jié)點主機......
連接測試
查看系統(tǒng)版本:
[root@Ubuntu22:/root]# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
查看 Oracle 版本以及補丁:
[oracle@Ubuntu22:/home/oracle]$ sqlplus -v SQL*Plus: Release 11.2.0.4.0 Production [oracle@Ubuntu22:/home/oracle]$ opatch lspatches 此 Oracle 主目錄中未安裝任何中間補丁程序。
查看監(jiān)聽:
[oracle@Ubuntu22:/home/oracle]$ lsnrctl stat
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-JUN-2024 12:17:25
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 06-JUN-2024 12:15:09
Uptime 0 days 0 hr. 2 min. 16 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/Ubuntu22/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Ubuntu22)(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
連接數(shù)據(jù)庫:
[oracle@Ubuntu22:/home/oracle]$ sas SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 6 12:17:26 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 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 sys@LUCIFER 2024-06-06 12:17:29>
數(shù)據(jù)庫連接正常。
最后修改時間:2026-03-23 16:09:37
「喜歡這篇文章,您的關注和贊賞是給作者最好的鼓勵」
關注作者
【版權聲明】本文為墨天輪用戶原創(chuàng)內(nèi)容,轉載時必須標注文章的來源(墨天輪),文章鏈接,文章作者等基本信息,否則作者和墨天輪有權追究責任。如果您發(fā)現(xiàn)墨天輪中有涉嫌抄襲或者侵權的內(nèi)容,歡迎發(fā)送郵件至:contact@modb.pro進行舉報,并提供相關證據(jù),一經(jīng)查實,墨天輪將立刻刪除相關內(nèi)容。




