Oracle 19c RPM 安装
一、 环境准备
1、 查看环境
[root@db1 ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="7.8"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.8"
PRETTY_NAME="Oracle Linux Server 7.8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:8:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.8
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.8
下载预安装包或直接下载;oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
① https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/index.html
② wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
安装预安装包:
关联yum组建配置:(补齐database-preinstall-19c-1.0-1.el7.x86_64.rpm安装依赖包)
[root@db1 yum.repos.d]# cat orel.repo
[OREL]
name=OREL
baseurl=file:///mnt
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1
[root@db1 ~]# rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
warning: oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:oracle-database-preinstall-19c-1.################################# [100%]
备注:可能是安装操作系统时安装的组建多的情况,所以此处提示需要依赖的包比较少。
二、安装数据库软件
说明:使用RPM安装方式,默认安装过程中新建了oracle用户;
[root@db1 ~]# ll
total 2631540
-rw-------. 1 root root 2251 Feb 16 22:21 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Desktop
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Documents
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Downloads
-rw-r--r--. 1 root root 2299 Feb 16 22:21 initial-setup-ks.cfg
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Music
-rwxrwxr-x. 1 root root 2694664264 Jul 30 08:28 oracle-database-ee-19c-1.0-1.x86_64.rpm
-rw-r--r--. 1 root root 18204 Feb 14 2019 oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Pictures
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Public
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Templates
drwxr-xr-x. 2 root root 6 Jul 30 15:57 Videos
[root@db1 ~]# yum -y install oracle-database-ee-19c-1.0-1.x86_64.rpm
Installed:
oracle-database-ee-19c.x86_64 0:1.0-1
Complete!
三、初始化数据库
说明:根据现场需要更改配置/etc/init.d/oracledb_ORCLCDB-19c
# Setting the required environment variables
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_VERSION=19c
export ORACLE_SID=ORCLCDB
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=ORCLPDB1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true
[root@db1 ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database ORCLCDB.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.
四、配置环境变量及用户
[root@db1 ~]# cat /etc/passwd|grep oracle
oracle:x:54321:54321::/home/oracle:/bin/bash
[root@db1 ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
===========================================================
[oracle@db1 ~]$ cat .bash_profile
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export NLS_LANG=AMERICAN_AMERICA.UTF8
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
export NLS_DATE_FORMAT='yyyy-MM-dd hh24:mi:ss'
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export PATH
五、检查并测试数据库
1、 放行防火墙TCP_1521端口
[root@db1 ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens32
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
添加tcp 1521端口
firewall-cmd --permanent --add-port=1521/tcp
重新加载防火墙配置:
[root@db1 ~]# firewall-cmd --reload
success
[root@db1 ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens32
sources:
services: ssh
ports: 1521/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
2、检查数据库状态
[oracle@db1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 30 19:45:01 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB1 READ WRITE NO
[oracle@db1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 30-JUL-2025 19:46:32
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 30-JUL-2025 17:29:01
Uptime 0 days 2 hr. 17 min. 30 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/db1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=db1)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "3b2358bb9ed6077ae063c90810ac2a3c" has 1 instance(s).
Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDB" has 1 instance(s).
Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "orclpdb1" has 1 instance(s).
Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
The command completed successfully
3、测试连接
4、相关参数配置
如:归档,SGA、PGA、连接数等需要配置,更好的满足生产使用需要。
总结:RPM安装方式节约了不少安装配置时间,确实提高了效率,部分参数可以安装好后进行调整。