文章大纲
Oracle Database 从 19C 开始还提供了 RPM 包方式进行安装,RPM 包安装方式简单,且能够通过 RPM 进行管理,但是无法决定安装目录,默认是安装在 /opt
目录下。
安装 preinstall RPM 包
oracle-database-preinstall-19c
RPM 包帮助配置安装之前所需的用户和内核参数的配置,默认 YUM 源和光盘中已经提供了,直接安装即可:
[root@oel7-3 ~]# yum install -y oracle-database-preinstall-19c.x86_64
安装数据库软件
使用 RPM 安装要确保 /opt
目录有 7G 空闲空间,直接安装:
[root@oel7-3 ~]# yum localinstall -y oracle-database-ee-19c-1.0-1.x86_64.rpm
创建数据库实例
可以使用 dbac
图形化或静默创建,也可以通过以下方式创建:
[root@oel7-3 ~]# /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.
设置环境变量:
[oracle@oel7-3 ~]$ cat >> .bash_profile << EOF
export ORACLE_SID=ORCLCDB
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export CLASSPATH=$ORACLE_HOME/JRE:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
EOF
[oracle@oel7-3 ~]$ source .bash_profile
验证已创建监听:
[oracle@oel7-3 ~]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-JAN-2025 22:34:45
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel7-3)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 04-JAN-2025 22:17:29
Uptime 0 days 0 hr. 17 min. 16 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/oel7-3/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7-3)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oel7-3)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "2ae33bd0597304b3e0639083a8c06ec0" 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
连接到数据库:
[oracle@oel7-3 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jan 4 22:38:10 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
SQL>
虽然生产环境中使用这种方式较少,但个人感觉这比 ZIP 安装方式要简单的多,也有可能是新推出而不被老手所接受,习惯了老式的安装方式。