前言
Oracle 一鍵安裝腳本,演示 龍蜥 Anolis 7.9 一鍵安裝 Oracle 21C 單機(全程無需人工干預)。
?? 腳本下載地址:Shell腳本安裝Oracle數據庫
前置準備
- 1、安裝好操作系統,建議安裝圖形化
- 2、配置好網絡
- 3、掛載本地 ISO 鏡像源
- 4、上傳軟件安裝包(安裝基礎包,補丁包)
- 5、上傳一鍵安裝腳本:OracleShellInstall
環境信息
# 主機版本
[root@anolis7 soft]# cat /etc/os-release
NAME="Anolis OS"
VERSION="7.9"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="7.9"
PRETTY_NAME="Anolis OS 7.9"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"
BUG_REPORT_URL="https://bugs.openanolis.cn/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
# 網絡信息
[root@anolis7 soft]# 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:20:2b:85 brd ff:ff:ff:ff:ff:ff
inet 192.168.6.136/24 brd 192.168.6.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::b567:60f9:d91b:b3c1/64 scope link noprefixroute
valid_lft forever preferred_lft forever
# 掛載本地 ISO 鏡像
[root@anolis7 soft]# mount | grep iso9660 | grep -v "/run/media"
/dev/sr0 on /mnt type iso9660 (ro,relatime)
[root@anolis7 soft]# df -h|grep /mnt
/dev/sr0 8.7G 8.7G 0 100% /mnt
# 安裝包存放在 /soft 目錄下
[root@anolis7 soft]# ll
-rwx------ 1 root root 19112 May 6 15:13 compat-libcap1-1.10-7.el7.x86_64.rpm
-rwx------ 1 root root 2156264 May 6 15:13 libc-2.17.so
-rwx------ 1 root root 3109225519 May 6 15:14 LINUX.X64_213000_db_home.zip
-rwxr-xr-x 1 root root 201804 May 6 15:14 OracleShellInstall
-rwx------ 1 root root 1458473664 May 6 15:13 p36352352_210000_Linux-x86-64.zip
-rwx------ 1 root root 127629034 May 6 15:13 p6880880_210000_Linux-x86-64.zip
-rwx------ 1 root root 321590 May 6 15:14 rlwrap-0.44.tar.gz
確保安裝環境準備完成后,即可執行一鍵安裝。
安裝命令
使用標準生產環境安裝參數:
# 根據腳本 README 或者 -h 命令提示,編輯好一鍵安裝命令,進入 /soft 目錄執行安裝:
./OracleShellInstall -lf ens33 `# local ip ifname`\
-n anolis7 `# 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`\
-opa 36352352 `# oracle PSU/RU`\
-opd Y `# optimize db`
安裝過程
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██
██?????██ ?██ ██?????? ?██ ?██ ?██?██ ?██ ?██ ?██
██ ??██ ██████ ██████ █████ ?██ █████ ?██ ?██ █████ ?██ ?██?██ ███████ ██████ ██████ ██████ ?██ ?██
?██ ?██??██??█ ??????██ ██???██ ?██ ██???██?█████████?██████ ██???██ ?██ ?██?██??██???██ ██???? ???██? ??????██ ?██ ?██
?██ ?██ ?██ ? ███████ ?██ ?? ?██?███████????????██?██???██?███████ ?██ ?██?██ ?██ ?██??█████ ?██ ███████ ?██ ?██
??██ ██ ?██ ██????██ ?██ ██ ?██?██???? ?██?██ ?██?██???? ?██ ?██?██ ?██ ?██ ?????██ ?██ ██????██ ?██ ?██
??███████ ?███ ??████████??█████ ███??██████ ████████ ?██ ?██??██████ ███ ███?██ ███ ?██ ██████ ??██ ??████████ ███ ███
??????? ??? ???????? ????? ??? ?????? ???????? ?? ?? ?????? ??? ??? ?? ??? ?? ?????? ?? ???????? ??? ???
注意:本腳本僅用于新服務器上實施部署數據庫使用,嚴禁在已運行數據庫的主機上執行,以免發生數據丟失或者損壞,造成不可挽回的損失!!!
請選擇安裝模式 [單機(si)/單機ASM(sa)/集群(rac)] : si
數據庫安裝模式: single
請選擇數據庫版本 [11/12/19/21] : 21
數據庫版本: 21
OracleShellInstall 開始安裝,詳細安裝過程可查看日志: tail -2000f /soft/print_ora_install_20240506152113.log
正在檢查操作系統是否符合安裝條件......已完成 (耗時: 0 秒)
正在去除密碼復雜度配置......已完成 (耗時: 1 秒)
正在配置 YUM 源......已完成 (耗時: 1 秒)
正在獲取操作系統信息......已完成 (耗時: 1 秒)
正在配置 Swap......已完成 (耗時: 0 秒)
正在配置防火墻......已完成 (耗時: 3 秒)
正在配置 selinux......已完成 (耗時: 1 秒)
正在配置 nsyctl......已完成 (耗時: 1 秒)
正在安裝依賴包......已完成 (耗時: 51 秒)
正在配置主機名和 /etc/hosts......已完成 (耗時: 0 秒)
正在創建用戶和組......已完成 (耗時: 1 秒)
正在創建安裝目錄......已完成 (耗時: 1 秒)
正在配置 Avahi-daemon 服務......已完成 (耗時: 1 秒)
正在配置透明大頁 && NUMA && 磁盤 IO 調度器......已完成 (耗時: 1 秒)
正在配置操作系統參數 sysctl......已完成 (耗時: 1 秒)
正在配置 RemoveIPC......已完成 (耗時: 1 秒)
正在配置用戶限制 limit......已完成 (耗時: 1 秒)
正在配置 shm 目錄......已完成 (耗時: 1 秒)
正在安裝 rlwrap 插件......已完成 (耗時: 10 秒)
正在配置用戶環境變量......已完成 (耗時: 1 秒)
正在解壓 Oracle 安裝包以及補丁......已完成 (耗時: 194 秒)
正在安裝 Oracle 軟件以及補丁......已完成 (耗時: 914 秒)
正在創建監聽......已完成 (耗時: 12 秒)
正在創建數據庫......已完成 (耗時: 1079 秒)
正在優化數據庫......已完成 (耗時: 16 秒)
恭喜!Oracle 單機安裝成功 (耗時: 2293 秒),現在是否重啟主機:[Y/N] Y
正在重啟主機......
連接測試
查看系統版本:
[root@anolis7 soft]# cat /etc/os-release
NAME="Anolis OS"
VERSION="7.9"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="7.9"
PRETTY_NAME="Anolis OS 7.9"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"
BUG_REPORT_URL="https://bugs.openanolis.cn/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
查看 Oracle 版本以及補丁:
[oracle@anolis7:/home/oracle]$ sqlplus -v SQL*Plus: Release 21.0.0.0.0 - Production Version 21.14.0.0.0 [oracle@anolis7:/home/oracle]$ opatch lspatches 36352352;Database Release Update : 21.14.0.0.240416 (36352352) OPatch succeeded.
查看監聽:
[oracle@anolis7:/home/oracle]$ lsnrctl stat
LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 06-MAY-2024 16:11:40
Copyright (c) 1991, 2021, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=anolis7)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date 06-MAY-2024 16:09:58
Uptime 0 days 0 hr. 1 min. 41 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/21.3.0/db/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/anolis7/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=anolis7)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "17c56febd36969e0e0638806a8c0e871" has 1 instance(s).
Instance "lucifer", status READY, has 1 handler(s) for this service...
Service "c8209f27c6b16005e053362ee80ae60e" has 1 instance(s).
Instance "lucifer", status READY, has 1 handler(s) for this service...
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...
Service "pdb01" has 1 instance(s).
Instance "lucifer", status READY, has 1 handler(s) for this service...
The command completed successfully
連接數據庫:
[oracle@anolis7:/home/oracle]$ sas
SQL*Plus: Release 21.0.0.0.0 - Production on Mon May 6 16:11:57 2024
Version 21.14.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.14.0.0.0
sys@LUCIFER 2024-05-06 16:11:57> 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
sys@LUCIFER 2024-05-06 16:11:59> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
數據庫連接正常。
最后修改時間:2026-03-23 16:46:24
「喜歡這篇文章,您的關注和贊賞是給作者最好的鼓勵」
關注作者
【版權聲明】本文為墨天輪用戶原創內容,轉載時必須標注文章的來源(墨天輪),文章鏈接,文章作者等基本信息,否則作者和墨天輪有權追究責任。如果您發現墨天輪中有涉嫌抄襲或者侵權的內容,歡迎發送郵件至:contact@modb.pro進行舉報,并提供相關證據,一經查實,墨天輪將立刻刪除相關內容。




