Linux/ Red Hat Enterprise Linux Server 7.9 上安裝 Oracle 19C
本文將逐步介紹在 Linux/ Red Hat Enterprise Linux Server 7.9 上安裝 Oracle 19C的過(guò)程。
一、Oracle 19C 安裝先決條件
自動(dòng)設(shè)置
如果您希望執(zhí)行所有先決條件設(shè)置,請(qǐng)執(zhí)行下命令。
ORACLE linux:
yum install -y oracle-database-preinstall-19c
它將完成您的所有基本步驟。
RHEL OR CentOS linux:
curl -o oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
手動(dòng)設(shè)置
如果您希望執(zhí)行手動(dòng)設(shè)置,則需要手動(dòng)執(zhí)行以下設(shè)置任務(wù)。
將以下行添加到“/etc/sysctl.conf”文件中。
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
運(yùn)行以下命令使修改內(nèi)核參數(shù)生效。
/sbin/sysctl -p
將以下行添加到“/etc/security/limits.conf”。
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
安裝的所需 RPM 包,以下是需要安裝的RPM列表。
yum install -y bc
yum install -y binutils
yum install -y compat-libcap1
yum install -y compat-libstdc++-33
#yum install -y dtrace-modules
#yum install -y dtrace-modules-headers
#yum install -y dtrace-modules-provider-headers
yum install -y dtrace-utils
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y fontconfig-devel
yum install -y glibc
yum install -y glibc-devel
yum install -y ksh
yum install -y libaio
yum install -y libaio-devel
yum install -y libdtrace-ctf-devel
yum install -y libXrender
yum install -y libXrender-devel
yum install -y libX11
yum install -y libXau
yum install -y libXi
yum install -y libXtst
yum install -y libgcc
yum install -y librdmacm-devel
yum install -y libstdc++
yum install -y libstdc++-devel
yum install -y libxcb
yum install -y make
yum install -y net-tools # Clusterware
yum install -y nfs-utils # ACFS
yum install -y python # ACFS
yum install -y python-configshell # ACFS
yum install -y python-rtslib # ACFS
yum install -y python-six # ACFS
yum install -y targetcli # ACFS
yum install -y smartmontools
yum install -y sysstat
創(chuàng)建相應(yīng)的用戶和組。
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
#groupadd -g 54324 backupdba
#groupadd -g 54325 dgdba
#groupadd -g 54326 kmdba
#groupadd -g 54327 asmdba
#groupadd -g 54328 asmoper
#groupadd -g 54329 asmadmin
#groupadd -g 54330 racdba
useradd -u 54321 -g oinstall -G dba,oper oracle
注:取消您需要的額外組的注釋。
額外的設(shè)置
1、設(shè)置oracle的密碼
passwd oracle
2、創(chuàng)建Oracle主目錄并賦予Oracle用戶所有權(quán)
mkdir -p /u01/app/oracle/product/19.3/db_home
chown -R oracle:oinstall /u01
chmod -R 775 /u01
3、設(shè)置Oracle用戶bash_profile
su - oracle
vi .bash_profile
刪除所有并粘貼如下面配置,確保根據(jù)您的環(huán)境更改環(huán)境變量。
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3/db_home
export ORACLE_SID=CDB
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
export NLS_LANG=american_america.al32utf8
export NLS_DATE_FORMAT="yyyy-mm-dd:hh24:mi:ss"
PATH=$PATH:$HOME/.local/bin:$ORACLE_HOME/bin
export PATH
讓profile生效~
source .bash_profile
4、關(guān)閉selinux
通過(guò)編輯“/etc/selinux/config”文件將secure Linux設(shè)置為diabled。
SELINUX=disabled
5、關(guān)閉firewall
systemctl stop firewalld
systemctl disable firewalld
二、安裝Oracle 19c軟件
下載 Oracle 19c 并將19c軟件文件拷貝到“ORACLE_HOME”目錄下并解壓縮。啟動(dòng)運(yùn)行安裝程序來(lái)執(zhí)行安裝。
cd $ORACLE_HOME
unzip -qo /softwares/LINUX.X64_193000_db_home.zip
#for GUI installation
./runInstaller
#for silent installation
./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=${HOSTNAME} \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
三、創(chuàng)建19C數(shù)據(jù)庫(kù)(二選一即可)
1、DBCA 創(chuàng)建19c Container Database
要?jiǎng)?chuàng)建包含多個(gè)pdb的19c容器數(shù)據(jù)庫(kù),請(qǐng)使用下面的命令
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} \
-characterSet AL32UTF8 \
-sysPassword enterCDB#123 \
-systemPassword enterCDB#123 \
-createAsContainerDatabase true \
-totalMemory 2000 \
-storageType FS \
-datafileDestination /u01/${ORACLE_SID} \
-emConfiguration NONE \
-numberOfPDBs 2 \
-pdbName PDB \
-pdbAdminPassword enterPDB#123 \
-ignorePreReqs
檢查數(shù)據(jù)庫(kù)中的所有容器。
sqlplus / as sysdba
SELECT NAME, OPEN_MODE, CDB FROM V$DATABASE;
SELECT CON_ID, NAME, OPEN_MODE FROM V$CONTAINERS;
2、DBCA 創(chuàng)建 19c Database (non-cdb)
Oracle已經(jīng)停止支持非cdb架構(gòu),但是你仍然可以創(chuàng)建一個(gè)非cdb數(shù)據(jù)庫(kù)。
export ORACLE_SID=orcl
#for silent database creation
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} \
-characterSet AL32UTF8 \
-sysPassword enterDB#123 \
-systemPassword enterDB#123 \
-createAsContainerDatabase false \
-totalMemory 2000 \
-storageType FS \
-datafileDestination /u01/${ORACLE_SID} \
-emConfiguration NONE \
-ignorePreReqs -sampleSchema true
四、附錄
1、安裝OPatch/版本升級(jí)
現(xiàn)在我們將 OPatch 應(yīng)用到 ORACLE_HOME 使其變?yōu)?19.13。
我們首先需要將 OPatch 實(shí)用程序升級(jí)到最新版本。
Rename the old OPatch Utility
cd $ORACLE_HOME
mv OPatch/ OPatch_old
unzip p6880880_122010_Linux-x86-64.zip
應(yīng)用最新的OPatch。
Apply the latest OPatch
cd /d01/software
unzip p33192793_190000_Linux-x86-64.zip
$ ls -lrth
drwxr-xr-x 5 oracle oracle 81 Oct 15 03:09 33192793
-rw-rw-r-- 1 oracle oracle 1.1M Oct 15 04:40 PatchSearch.xml
-rwxrwxr-x 1 oracle oracle 1.4G Feb 3 23:54 p33192793_190000_Linux-x86-64.zip
cd 33192793/
/d01/oracle/product/v.19.13.0.0/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.27
Copyright (c) 2022, Oracle Corporation. All rights reserved.
Oracle Home : /d01/oracle/product/19.13.0/dbhome_1
Central Inventory : /home/oracle/oraInventory
from : /d01/oracle/product/19.13.0/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.27
OUI version : 12.2.0.7.0
Log file location : /d01/oracle/product/19.13.0/dbhome_1/cfgtoollogs/opatch/opatch2022-01-31_09-46-30AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 33192793
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/d01/oracle/product/19.13.0/dbhome_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '33192793' to OH '/d01/oracle/product/19.13.0/dbhome_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.perlint, 5.28.1.0.0...
Patching component oracle.rdbms.locator, 19.0.0.0.0...
成功完成修補(bǔ)后,您將收到以下消息。
這樣你就可以斷定你的補(bǔ)丁是成功的。
2、ORACLE 19C gui安裝
登錄到 oracle 用戶并執(zhí)行以下操作。
export DISPLAY=<machine-name>:0.0
Unzip Software –
cd $ORACLE_HOME
unzip LINUX.X64_193000_db_home.zip
./runInstaller
現(xiàn)在我們將 開(kāi)始 oracle 二進(jìn)制安裝。
第 1 步:- 僅單擊設(shè)置軟件。
第 2 步:- 單擊單實(shí)例數(shù)據(jù)庫(kù)安裝。
第 3 步:- 單擊企業(yè)版。
第 4 步:-設(shè)置預(yù)言機(jī)基礎(chǔ)。
第 5 步:-選擇組。
步驟 6:-您可以選擇手動(dòng)運(yùn)行“root.sh”文件或自動(dòng)運(yùn)行,如下所示。
第 7 步:-檢查配置。
第 8 步:-如果一切順利,則會(huì)出現(xiàn)此屏幕。
第 9 步:- 安裝正在進(jìn)行中。
第 10 步:-安裝完成。