1、准备工作


1.1、配置本地YUM源


mount -t auto /dev/cdrom  /mnt

rm -rf /etc/yum.repos.d/

mkdir -p /etc/yum.repos.d/

cat >> /etc/yum.repos.d/OE-Media.repo<<EOF
# OE-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  OE-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=OE-media [command]
#  
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=OE-media [command]

[OE-media]
name=OE-$releasever - Media
baseurl=file:///mnt/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OE-7
EOF


yum clean all
yum makecache

1.2、安装依赖包


dnf install -y bc  
dnf install -y binutils  
dnf install -y elfutils-libelf  
dnf install -y elfutils-libelf-devel  
dnf install -y fontconfig-devel  
dnf install -y glibc  
dnf install -y glibc-devel  
dnf install -y ksh  
dnf install -y libaio  
dnf install -y libaio-devel  
dnf install -y libXrender  
dnf install -y libX11  
dnf install -y libXau  
dnf install -y libXi  
dnf install -y libXtst  
dnf install -y libgcc  
dnf install -y libnsl  
dnf install -y librdmacm  
dnf install -y libstdc++  
dnf install -y libstdc++-devel  
dnf install -y libxcb  
dnf install -y libibverbs  
dnf install -y make  
dnf install -y policycoreutils  
dnf install -y policycoreutils-python-utils  
dnf install -y smartmontools  
dnf install -y sysstat  
dnf install -y psmisc  
dnf install -y xorg-x11-utils  
dnf install -y lsof
dnf install -y libnsl libnsl2  
dnf install -y vim  
dnf install -y net-tools  
dnf install -y openssl-devel  
dnf install -y glibc-compat-2.17  
dnf install -y unixODBC unixODBC-devel  
dnf install -y libXrender-devel  
dnf install -y libXtst-devel  
dnf install -y librdmacm-devel
dnf install -y xorg-x11-utils
dnf install -y nfs-utils
dnf install -y tigervnc-server

下载两个关键安装包
wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/compat-libcap1-1.10-7.el7.x86_64.rpm  
wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm  

或者在ORACLE LINUX 7ISO中获取

[root@192 Packages]# rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
warning: compat-libcap1-1.10-7.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:compat-libstdc++-33-3.2.3-72.el7 ################################# [ 50%]
   2:compat-libcap1-1.10-7.el7        ################################# [100%]


准备libsnl
[root@192 /]# cd /usr/lib64/
[root@192 lib64]# ln -s /usr/lib64/libnsl.so.3 libnsl.so.1
 [root@192 lib64]#  ln -s /usr/lib64/libnsl.so.3 libnsl.so.2
 
 ++准备libc_nonshared.a,从ORACLE EL7上获取
  scp 192.168.1.100:/usr/lib64/libc_nonshared.a /usr/lib64/.
   scp 192.168.1.100:/usr/lib64/libpthread_nonshared.a /usr/lib64/.
 

1.3、创建用户组 


groupadd -g 1001 oinstall
groupadd -g 1002 dba
groupadd -g 1003 oper
groupadd -g 1004 asmdba
groupadd -g 1005 backupdba
groupadd -g 1006 dgdba
groupadd -g 1007 kmdba
groupadd -g 1008 racdba

useradd -u 1001 -m -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba oracle
id oracle
a=1
echo oracle:$a|chpasswd

hostnamectl set-hostname oracle19c

su - 

1.4、创建软件安装目录和数据库目录


mkdir -p /opt/oracle
chown -R oracle:oinstall  /opt/oracle
chmod -R 775 /opt/oracle

1.5、准备其它条件 


cat >> /etc/hosts <<EOF
192.168.1.143  oracle19c
EOF

cat >> /etc/sysctl.conf <<EOF
fs.file-max = 6815744  
kernel.sem = 250 32000 100 128  
kernel.shmmni = 4096  
kernel.shmall = 1073741824  
kernel.shmmax = 6597069766656
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.eth3.rp_filter = 2       
#net.ipv4.conf.eth2.rp_filter = 2
#net.ipv4.conf.eth0.rp_filter = 1  
fs.aio-max-nr = 1048576  
net.ipv4.ip_local_port_range = 9000 65500 
EOF

cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <<EOF
session required /lib/security/pam_limits.so
EOF

cat >> /etc/profile <<EOF
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
EOF

cat >> /etc/csh.login <<EOF
if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF

1.6、配置环境变量:


vi /home/oracle/.bash_profile 
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=rundb
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export INVENTORY_LOCATION=/opt/oracle/oraInventory
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin
umask 022


su - oracle

mkdir -p $ORACLE_HOME

exit

1.7、关闭防火墙与selinux


systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/=enforcing/=disabled/g' /etc/selinux/config
setenforce 0
getenforce


上传oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
上传oracle-database-ee-19c-1.0-1.x86_64.rpm

2、安装RPM ORACLE 19C

安装racle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
[root@oracle19c ~]# rpm -ivh --nodeps 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
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-database-preinstall-19c-1.################################# [100%]

安装oracle-database-ee-19c-1.0-1.x86_64.rpm

[root@oracle19c ~]#  rpm -ivh oracle-database-ee-19c-1.0-1.x86_64.rpm
warning: oracle-database-ee-19c-1.0-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-database-ee-19c-1.0-1     ################################# [100%]
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure


3、安装完成,修改初始化配置文件


vi /etc/init.d/oracledb_ORCLCDB-19c 

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=ZHS16GBK
export PDB_NAME=ORCLPDB1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=false

监听端口默认即可
 vi /etc/sysconfig/oracledb_ORCLCDB-19c.conf

4、初始化库

[root@oracle19c ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database ORCLCDB.
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
70% 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@oracle19c ~]#
 

5、安装监测

[oracle@oracle19c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Oct 21 11:51:49 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> select ^C

SQL> show parameter target

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target                   integer     0
db_big_table_cache_percent_target    string      0
db_flashback_retention_target        integer     1440
fast_start_io_target                 integer     0
fast_start_mttr_target               integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
parallel_servers_target              integer     64
pga_aggregate_target                 big integer 3156M
sga_target                           big integer 9472M
target_pdbs                          integer     0
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /opt/oracle/product/19c/dbhome_1/dbs/arch
Oldest online log sequence     3
Current log sequence           5
SQL> show pdbs
SQL> select name from v$database;

NAME
---------
ORCLCDB

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
 


[oracle@oracle19c ~]$ lsnrctl stat

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 21-OCT-2025 11:53:06

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle19c)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                21-OCT-2025 11:44:12
Uptime                    0 days 0 hr. 8 min. 53 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/oracle19c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle19c)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oracle19c)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
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...
The command completed successfully
 

Logo

鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。

更多推荐