一、說明
本次安裝将使用Oracle通用安裝程式(OUI)安裝Oracle資料庫軟體以及資料庫
1.1 Linux 下Oracle作業系統要求
Oracle Linux 8.1 with the Unbreakable Enterprise Kernel 6: 5.4.17-2011.0.7.el8uek.x86_64 or later
Oracle Linux 8 with the Red Hat Compatible kernel: 4.18.0-80.el8.x86_64 or later
Oracle Linux 7.4 with the Unbreakable Enterprise Kernel 4: 4.1.12-124.19.2.el7uek.x86_64 or later
Oracle Linux 7.4 with the Unbreakable Enterprise Kernel 5: 4.14.35-1818.1.6.el7uek.x86_64 or later
Oracle Linux 7.5 with the Red Hat Compatible kernel: 3.10.0-862.11.6.el7.x86_64 or later
Red Hat Enterprise Linux 8: 4.18.0-80.el8.x86_64 or later
Red Hat Enterprise Linux 7.5: 3.10.0-862.11.6.el7.x86_64 or later
SUSE Linux Enterprise Server 12 SP3: 4.4.162-94.72-default or later
SUSE Linux Enterprise Server 15: 4.12.14-23-default or later
1.2 硬體環境要求
伺服器制作與體系結構 | 确認支援伺服器制造、模型、核心體系結構和主機總線擴充卡(HBA)或網絡接口控制器(NIC),以便與Oracle資料庫和Oracle網格基礎設施一起運作。 |
伺服器顯示卡 | 至少1024x768顯示分辨率,這是Oracle通用安裝程式需要的。 |
最小RAM |
|
配置設定給/tmp目錄 | 中至少有1GB的空間。/tmp目錄。 |
相對于RAM(Oracle資料庫)的交換空間配置設定 | 在1GB到2GB之間:是RAM大小的1.5倍 在2GB到16 GB之間:等于RAM的大小 超過16 GB:16 GB 注:如果您為Linux伺服器啟用了HugePages,那麼在計算交換空間之前,應該從可用RAM中扣除配置設定給HugePages的記憶體。 |
Oracle軟體的最小本地磁盤存儲空間 | 對于Linux86-64: Oracle資料庫企業版至少7.2GB。 Oracle資料庫标準版本至少7.2GB。 注: Oracle建議您配置設定大約100 GB用于在現有Oracle首頁之上應用任何未來修補程式的額外空間。有關特定修補程式相關磁盤空間的要求,請參閱修補程式文檔。 |
1.3 媒體要求
Oracle:21.3
LINUX.X64_213000_db_home.zip
二、作業系統基礎配置
2.1 檢察伺服器硬體和記憶體
使用以下指令确定伺服器上的實體RAM大小至少1G以上
# grep MemTotal /proc/meminfo
确定配置的交換空間的大小
# grep SwapTotal /proc/meminfo
确定tmp目錄空間足夠1G
# df -h /tmp
(如果/tmp空間不足,則清理/tmp目錄以滿足磁盤空間要求。
或設定Oracle使用者環境時,還要設定TMP和TMPDIR環境變量到要使用的目錄中,而不是/tmp)
确定系統版本能夠支援19c資料庫
# uname -m
2.2關閉防火牆
關閉運作中的服務
#systemctl stop firewalld.service
關閉作業系統自啟動
#systemctl disable firewalld.service
檢查關閉情況
systemctl status firewalld.service
如下,dead表示未開啟開機啟動;inactive表示現在的狀态是關閉
關閉selinux:
編輯/etc/selinux/config 檔案
[root@DBServer1 ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
2.3 RPM包安裝
oracle 21C需要以下RPM依賴包:
bc
binutils
compat-libcap1
compat-libstdc++33
elfutils-libelf
elfutils-libelf-devel
fontconfig-devel
glibc
glibc-devel
ksh
libaio
libaio-devel
libX11
libXau
libXi
libXtst
libXrender
libXrender-devel
libgcc
libstdc++
libstdc++-devel
libxcb
make
smartmontools
sysstat
compat-libstdc++-33-3.2.3 需要手動下載下傳上傳
挂載光驅
# mount /dev/sr0 /mnt
# cd /etc/yum.repos.d/
# mv public-yum-ol7.repo public-yum-ol7.repo.bak
# vi yum.repo
[base]
Name=base
Baseurl=file:///mnt
Enabled=1
Gpgcheck=0
yum install bc binutils compat-libcap1 compat-libstdc++33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat kmod*
2.4使用者建立
建立oracle使用者
groupadd -g 1001 oinstall
groupadd -g 1002 dba
useradd -u 1001 -g oinstall -G dba oracle
passwd oracle ——修改oracle使用者密碼
2.5 核心參數
vi /etc/sysctl.conf
kernel.shmall = physical RAM size / pagesize For most systems, this will be the value 2097152
kernel.shmmax = 1/2 of physical RAM
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
執行sysctl -p 指令使以上設定生效
編輯/etc/pam.d/login 添加如下内容:
vi /etc/pam.d/login
session required pam_limits.so
編輯vi /etc/profile添加如下内容: #系統環境變量
if [ /$USER = "oracle" ] ; then
if [ /$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
編輯/etc/security/limits.conf 添加如下内容:
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
2.6環境變量
# su - oracle
$ vi .bash_profile
export ORACLE_BASE=/oracle/app
export ORACLE_HOME=/oracle/app/product/21.3.0/db_1
export ORACLE_SID=xxx
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
mkdir -p /oracle/app/product/21.3.0/db_1
mkdir -p /oracle/oraInventory
chmod -R 775 /oracle
chown -R oracle:oinstall /oracle/app
chown -R oracle:oinstall /oracle/oraInventory
2.7 /etc/hosts寫入
root使用者
vi /etc/hosts
192.186.30.90(ip) zwy(主機名)
三、安裝媒體準備
上傳媒體
需要注意的是,21c需要把軟體包直接解壓到ORACLE_HOME的目錄下
Oracle使用者
cd /oracle/app/product/21.3.0/db_1
unzip LINUX.X64_193000_db_home.zip
四、安裝資料庫軟體
開始安裝RDBMS軟體
-----------------------------------------------------------------------------------------------
oracle使用者執行安裝:
打開Xmanager-passive
export DISPLAY=xxx.xxx.xxx.xxx:0.0(xxx.xxx.xxx.xxx為操作機器的IP 0.0為xxmanager的端口)
cd $ORACLE_HOME
./runInstaller
安裝截圖如下:

這裡隻選擇安裝軟體,執行個體在軟體安裝好後再安裝
選擇安裝單執行個體
選擇企業版
這裡填寫在環境變量裡配置過的ORACLE_BASE
五、DBCA建庫
我們選擇進階配置
選擇資料庫模版
确定資料庫執行個體名以及是否建立容器資料庫