前言
Oracle 一鍵安裝腳本,演示 CentOS7.9 一鍵安裝 Oracle 12CR2 單機 non-CDB 多實例(20240116)過程(全程無需人工干預)。(腳本包括 ORALCE PSU/OJVM 等補丁自動安裝)
?? 腳本下載地址:Shell腳本安裝Oracle數據庫
腳本第三代支持 N 節點一鍵安裝,不限制節點數!
安裝準備
- 1、安裝好操作系統,建議安裝圖形化
- 2、配置好網絡
- 3、掛載本地 ISO 鏡像源
- 4、上傳軟件安裝包(安裝基礎包,補丁包)
- 5、上傳一鍵安裝腳本:OracleShellInstall
環境信息
[root@localhost ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@localhost ~]# 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:4d:e5:4b brd ff:ff:ff:ff:ff:ff
inet 192.168.200.151/24 brd 192.168.200.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::c56:de4d:f34b:72bd/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@localhost ~]# ls /mnt/cdrom/
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[root@localhost ~]# ll /soft
-rw-r--r-- 1 root root 3817244 Apr 10 16:20 glibc-2.17-326.el7_9.x86_64.rpm
-rw-r--r-- 1 root root 3453696911 Apr 10 16:18 LINUX.X64_122010_db_home.zip
-rw-r--r-- 1 root root 192431 Apr 10 16:18 OracleShellInstall
-rw-r--r-- 1 root root 138325588 Apr 10 16:18 p35926712_122010_Linux-x86-64.zip
-rw-r--r-- 1 root root 1148325873 Apr 10 16:18 p35966787_122010_Linux-x86-64.zip
-rw-r--r-- 1 root root 127629034 Apr 10 16:18 p6880880_122010_Linux-x86-64.zip
-rw-r--r-- 1 root root 340033 Apr 10 16:20 rlwrap-0.46.1.tar.gz
確保安裝環境準備完成后,即可執行一鍵安裝。
安裝命令
使用標準生產環境安裝參數(安裝過程若失敗,腳本支持重復執行安裝):
# 根據腳本 README 或者 -h 命令提示,編輯好一鍵安裝命令,進入 /soft 目錄執行安裝:
./OracleShellInstall -lf ens33 \
-n h12c2 \
-o orcl1,orcl2 \
-opa 35966787 \
-jpa 35926712 \
-op oracle \
-dp oracle \
-redo 500 \
-opd Y
安裝過程
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██
██?????██ ?██ ██?????? ?██ ?██ ?██?██ ?██ ?██ ?██
██ ??██ ██████ ██████ █████ ?██ █████ ?██ ?██ █████ ?██ ?██?██ ███████ ██████ ██████ ██████ ?██ ?██
?██ ?██??██??█ ??????██ ██???██ ?██ ██???██?█████████?██████ ██???██ ?██ ?██?██??██???██ ██???? ???██? ??????██ ?██ ?██
?██ ?██ ?██ ? ███████ ?██ ?? ?██?███████????????██?██???██?███████ ?██ ?██?██ ?██ ?██??█████ ?██ ███████ ?██ ?██
??██ ██ ?██ ██????██ ?██ ██ ?██?██???? ?██?██ ?██?██???? ?██ ?██?██ ?██ ?██ ?????██ ?██ ██????██ ?██ ?██
??███████ ?███ ??████████??█████ ███??██████ ████████ ?██ ?██??██████ ███ ███?██ ███ ?██ ██████ ??██ ??████████ ███ ███
??????? ??? ???????? ????? ??? ?????? ???????? ?? ?? ?????? ??? ??? ?? ??? ?? ?????? ?? ???????? ??? ???
請選擇安裝模式 [單機(si)/單機ASM(sa)/集群(rac)] : si
數據庫安裝模式: single
請選擇數據庫版本 [11/12/19/21] : 12
數據庫版本: 12
OracleShellInstall 開始安裝(安裝過程可查看日志:/soft/print_ora_install_20240410213819.log)
正在檢查操作系統是否符合安裝條件......已完成 (耗時: 0 秒)
正在去除密碼復雜度配置......已完成 (耗時: 0 秒)
正在配置 YUM 源......已完成 (耗時: 1 秒)
單機數據庫重裝,停止并刪除運行數據庫......已完成 (耗時: 1 秒)
正在獲取操作系統信息......已完成 (耗時: 1 秒)
正在配置 Swap......已完成 (耗時: 48 秒)
正在配置防火墻......已完成 (耗時: 2 秒)
正在配置 selinux......已完成 (耗時: 1 秒)
正在配置 nsyctl......已完成 (耗時: 1 秒)
正在安裝依賴包......已完成 (耗時: 50 秒)
正在配置主機名和 /etc/hosts......已完成 (耗時: 1 秒)
正在創建用戶和組......已完成 (耗時: 1 秒)
正在創建安裝目錄......已完成 (耗時: 1 秒)
正在配置 Avahi-daemon 服務......已完成 (耗時: 14 秒)
正在配置透明大頁 && NUMA && 磁盤 IO 調度器......已完成 (耗時: 1 秒)
正在配置操作系統參數 sysctl......已完成 (耗時: 1 秒)
正在配置 RemoveIPC......已完成 (耗時: 1 秒)
正在配置用戶限制 limit......已完成 (耗時: 1 秒)
正在配置 shm 目錄......已完成 (耗時: 1 秒)
正在安裝 rlwrap 插件......已完成 (耗時: 13 秒)
正在配置用戶環境變量......已完成 (耗時: 1 秒)
正在解壓 Oracle 安裝包以及補丁......已完成 (耗時: 70 秒)
正在安裝 Oracle 軟件以及補丁......已完成 (耗時: 650 秒)
正在創建監聽......已完成 (耗時: 3 秒)
正在創建數據庫......已完成 (耗時: 1210 秒)
正在優化數據庫......已完成 (耗時: 18 秒)
恭喜!Oracle 單機安裝成功 (耗時: 2092 秒),現在是否重啟主機:[Y/N]
連接測試
[root@h12c2:/root]$ so
[oracle@h12c2:/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.
[oracle@h12c2:/home/oracle]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 10-APR-2024 22:21:44
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=h12c2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 10-APR-2024 22:21:21
Uptime 0 days 0 hr. 0 min. 22 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/h12c2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=h12c2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl1" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Service "orcl1XDB" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Service "orcl2" has 1 instance(s).
Instance "orcl2", status READY, has 1 handler(s) for this service...
Service "orcl2XDB" has 1 instance(s).
Instance "orcl2", status READY, has 1 handler(s) for this service...
The command completed successfully
最后修改時間:2026-03-23 16:26:35
「喜歡這篇文章,您的關注和贊賞是給作者最好的鼓勵」
關注作者
【版權聲明】本文為墨天輪用戶原創內容,轉載時必須標注文章的來源(墨天輪),文章鏈接,文章作者等基本信息,否則作者和墨天輪有權追究責任。如果您發現墨天輪中有涉嫌抄襲或者侵權的內容,歡迎發送郵件至:contact@modb.pro進行舉報,并提供相關證據,一經查實,墨天輪將立刻刪除相關內容。




