跳过正文

Oracle 19c 单实例升级到 19.30 RU 补丁实战指南

Greatfinish
作者
Greatfinish
记录 Oracle、PostgreSQL、达梦、Linux、存储与生产环境故障处理经验。

适用版本:Oracle Database 19.3.0 → 19.30.0 环境:单实例 ,OS 为 Oracle Linux 7.9 补丁类型:RU (Release Update) 19.30.0.0.260120 工具:opatch / datapatch


一、补丁简介
#

Oracle Database 19c 是长期支持版本,Oracle 会继续按季度发布版本更新 (RU)(通常为 1、4、7、10 月),以解决安全漏洞、修复错误并提升性能。2026年 1 月 20 日,Oracle 2026 年第一季度 RU 补丁发布。如下所示:

补丁号补丁名发布日期文件名
Patch 38632161DATABASE RELEASE UPDATE 19.30.0.0.02026-1-20p38632161_190000_Linux-x86-64.zip
Patch 38629535GI RELEASE UPDATE 19.30.0.0.02026-1-20p38629535_190000_Linux-x86-64.zip
Patch 38523609OJVM RELEASE UPDATE 19.30.0.0.02026-1-20p38632161_190000_Linux-x86-64.zip
Patch 6880880OPatch 12.2.0.1.49 for DB 19.0.0.0.02026-1-20p6880880_190000_Linux-x86-64.zip

保持 Oracle 数据库的补丁更新不再是可选项,而是所有重视安全性、稳定性和长期支持的数据库管理员的核心职责。本文将介绍补丁程序 38632161 的实际应用过程,该补丁程序用于将 Oracle Database 19c 单实例升级到版本 19.30.0.0.260120。本文涵盖了 OPatch 升级、预检查、补丁应用和补丁应用后的验证,所有步骤均基于真实的生产环境。

将所有补丁文件上传到生产环境/home/oracle/19.30目录下

[oracle@prod_db 19.30]$ ll
total 6393340
-rw-r--r-- 1 oracle oinstall  129508957 Jan 22 19:35 p38523609_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 4065209003 Jan 22 19:36 p38629535_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 2279159986 Jan 22 19:36 p38632161_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall   72896144 Jan 22 19:36 p6880880_190000_Linux-x86-64.zip
[oracle@prod_db 19.30]$

二、先决条件
#

在应用此补丁之前,OPatch 版本要求:

OPatch version 12.2.0.1.48 or later

检查现有 OPatch 版本

cd $ORACLE_HOME/OPatch
./opatch version

[oracle@prod_db ~]$ cd $ORACLE_HOME/OPatch
[oracle@prod_db OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.
[oracle@prod_db OPatch]$

三、升级OPatch工具
#

为了避免冲突,现有的 OPatch 目录已进行备份:

cd $ORACLE_HOME
mv OPatch OPatch_12.2.0.1.17

[oracle@prod_db OPatch]$ cd $ORACLE_HOME
[oracle@prod_db dbhome_1]$ mv OPatch OPatch_12.2.0.1.17
[oracle@prod_db dbhome_1]$

接下来,最新的 OPatch 被直接解压到 Oracle Home 目录下:

cd ~/19.30
unzip -q p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME

[oracle@prod_db dbhome_1]$ cd ~/19.30
[oracle@prod_db 19.30]$ unzip -q p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME

解压完成后,验证结果升级成功:

cd $ORACLE_HOME/OPatch
./opatch version

[oracle@prod_db 19.30]$ cd $ORACLE_HOME/OPatch
[oracle@prod_db OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.49

OPatch succeeded.
[oracle@prod_db OPatch]$

✅️OPatch 现在符合补丁要求。


四、记录当前补丁级别
#

在应用新的更新包之前,了解当前的补丁基线非常重要。

数据库补丁状态

SQL> select action_time, action, status, source_version, target_version from dba_registry_sqlpatch;

ACTION_TIME                                                                 ACTION          STATUS                    SOURCE_VERSION  TARGET_VERSION
--------------------------------------------------------------------------- --------------- ------------------------- --------------- ---------------
22-JAN-26 08.48.44.104406 PM                                                APPLY           SUCCESS                   19.1.0.0.0      19.3.0.0.0

SQL>

这里显示数据库版本还是维持最早安装的19.3版本

Oracle 主目录补丁清单

opatch lspatches

[oracle@prod_db ~]$ opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)

OPatch succeeded.
[oracle@prod_db ~]$

OCW 版本更新 19.3,数据库版本更新 19.3


五、解压补丁 38632161
#

补丁包的解压过程如下:

cd ~/19.30
unzip -q p38632161_190000_Linux-x86-64.zip
ll

[oracle@prod_db ~]$ cd ~/19.30
[oracle@prod_db 19.30]$ unzip -q p38632161_190000_Linux-x86-64.zip
[oracle@prod_db 19.30]$ ll
total 6395860
drwxr-xr-x 5 oracle oinstall         81 Jan 17 16:18 38632161
-rw-r--r-- 1 oracle oinstall  129508957 Jan 22 19:35 p38523609_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 4065209003 Jan 22 19:36 p38629535_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 2279159986 Jan 22 19:36 p38632161_190000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall   72896144 Jan 22 19:36 p6880880_190000_Linux-x86-64.zip
-rw-rw-r-- 1 oracle oinstall    2578958 Jan 21 00:56 PatchSearch.xml
[oracle@prod_db 19.30]$

这创建了一个名为 38632161 的补丁目录,其中包含升级所需的元数据、脚本、二进制文件和配置文件。

OCW 版本更新 19.3,数据库版本更新 19.3


六、运行冲突和先决条件检查
#

在操作前务必先验证是否存在冲突

cd ~/19.30/38632161/
opatch prereq CheckConflictAgainstOHWithDetail -ph ./

[oracle@prod_db 19.30]$ cd 38632161/
[oracle@prod_db 38632161]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.49
Copyright (c) 2026, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/19.3.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.3.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.49
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2026-01-22_21-52-46PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[oracle@prod_db 38632161]$

✅️未检测到任何冲突

这一步骤对于避免补丁安装失败或Oracle Home目录损坏至关重要。


七、关闭数据库和监听
#

Oracle 要求在应用版本更新之前进行干净关机。

sqlplus / as sysdba
shutdown immediate

[oracle@prod_db 38632161]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 22 21:59:32 2026
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> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@prod_db 38632161]$ 

然后停止监听

lsnrctl stop

[oracle@prod_db 38632161]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 22-JAN-2026 22:00:25

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=prod_db)(PORT=1521)))
The command completed successfully
[oracle@prod_db 38632161]$

此时,系统已完全准备好进行补丁更新。


八、DB应用补丁 38632161
#

到补丁文件所在目录并应用补丁:

cd ~/19.30/38632161/
opatch apply


[oracle@prod_db 38632161]$ cd ~/19.30/38632161/
[oracle@prod_db 38632161]$ opatch apply
Oracle Interim Patch Installer version 12.2.0.1.49
Copyright (c) 2026, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.3.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.3.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.49
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2026-01-22_22-03-57PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   38632161

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 = '/u01/app/oracle/product/19.3.0/dbhome_1')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '38632161' to OH '/u01/app/oracle/product/19.3.0/dbhome_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.assistants.asm, 19.0.0.0.0 ] , [ oracle.crypto.rsf, 19.0.0.0.0 ] , [ oracle.datamining, 19.0.0.0.0 ] , [ oracle.oraolap.mgmt, 19.0.0.0.0 ] , [ oracle.pg4appc, 19.0.0.0.0 ] , [ oracle.pg4mq, 19.0.0.0.0 ] , [ oracle.precomp.companion, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.pg4mq, 19.0.0.0.0 ] , [ oracle.oraolap.mgmt, 19.0.0.0.0 ] , [ oracle.java.sqlj.sqljruntime, 19.0.0.0.0 ] , [ oracle.datamining, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.ldap.ztk, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] , [ oracle.jdk, 1.8.0.391.11 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.rdbms.rsf, 19.0.0.0.0...

Patching component oracle.rdbms, 19.0.0.0.0...

Patching component oracle.rdbms.util, 19.0.0.0.0...

Patching component oracle.assistants.acf, 19.0.0.0.0...

Patching component oracle.assistants.deconfig, 19.0.0.0.0...

Patching component oracle.assistants.server, 19.0.0.0.0...

Patching component oracle.blaslapack, 19.0.0.0.0...

Patching component oracle.buildtools.rsf, 19.0.0.0.0...

Patching component oracle.ctx, 19.0.0.0.0...

Patching component oracle.dbdev, 19.0.0.0.0...

Patching component oracle.dbjava.ic, 19.0.0.0.0...

Patching component oracle.dbjava.jdbc, 19.0.0.0.0...

Patching component oracle.dbjava.ucp, 19.0.0.0.0...

Patching component oracle.duma, 19.0.0.0.0...

Patching component oracle.javavm.client, 19.0.0.0.0...

Patching component oracle.ldap.client, 19.0.0.0.0...

Patching component oracle.ldap.owm, 19.0.0.0.0...

Patching component oracle.ldap.rsf, 19.0.0.0.0...

Patching component oracle.ldap.security.osdt, 19.0.0.0.0...

Patching component oracle.marvel, 19.0.0.0.0...

Patching component oracle.network.rsf, 19.0.0.0.0...

Patching component oracle.odbc.ic, 19.0.0.0.0...

Patching component oracle.ons, 19.0.0.0.0...

Patching component oracle.ons.ic, 19.0.0.0.0...

Patching component oracle.oracore.rsf, 19.0.0.0.0...

Patching component oracle.perlint, 5.28.1.0.0...

Patching component oracle.precomp.common.core, 19.0.0.0.0...

Patching component oracle.precomp.rsf, 19.0.0.0.0...

Patching component oracle.rdbms.crs, 19.0.0.0.0...

Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...

Patching component oracle.rdbms.deconfig, 19.0.0.0.0...

Patching component oracle.rdbms.install.common, 19.0.0.0.0...

Patching component oracle.rdbms.oci, 19.0.0.0.0...

Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0...

Patching component oracle.rdbms.scheduler, 19.0.0.0.0...

Patching component oracle.rhp.db, 19.0.0.0.0...

Patching component oracle.rsf, 19.0.0.0.0...

Patching component oracle.sdo, 19.0.0.0.0...

Patching component oracle.sdo.locator.jrf, 19.0.0.0.0...

Patching component oracle.sqlj.sqljruntime, 19.0.0.0.0...

Patching component oracle.sqlplus, 19.0.0.0.0...

Patching component oracle.sqlplus.ic, 19.0.0.0.0...

Patching component oracle.tfa.db, 19.0.0.0.0...

Patching component oracle.wwg.plsql, 19.0.0.0.0...

Patching component oracle.xdk.rsf, 19.0.0.0.0...

Patching component oracle.xdk.parser.java, 19.0.0.0.0...

Patching component oracle.rdbms.lbac, 19.0.0.0.0...

Patching component oracle.ldap.ssl, 19.0.0.0.0...

Patching component oracle.network.aso, 19.0.0.0.0...

Patching component oracle.xdk, 19.0.0.0.0...

Patching component oracle.nlsrtl.rsf.core, 19.0.0.0.0...

Patching component oracle.odbc, 19.0.0.0.0...

Patching component oracle.rdbms.rat, 19.0.0.0.0...

Patching component oracle.rdbms.dv, 19.0.0.0.0...

Patching component oracle.oraolap.dbscripts, 19.0.0.0.0...

Patching component oracle.rdbms.hs_common, 19.0.0.0.0...

Patching component oracle.ldap.rsf.ic, 19.0.0.0.0...

Patching component oracle.oraolap, 19.0.0.0.0...

Patching component oracle.install.deinstalltool, 19.0.0.0.0...

Patching component oracle.mgw.common, 19.0.0.0.0...

Patching component oracle.rdbms.rman, 19.0.0.0.0...

Patching component oracle.xdk.server, 19.0.0.0.0...

Patching component oracle.oraolap.api, 19.0.0.0.0...

Patching component oracle.rdbms.hsodbc, 19.0.0.0.0...

Patching component oracle.ctx.atg, 19.0.0.0.0...

Patching component oracle.nlsrtl.rsf, 19.0.0.0.0...

Patching component oracle.nlsrtl.rsf.core, 19.0.0.0.0...

Patching component oracle.nlsrtl.rsf.ic, 19.0.0.0.0...

Patching component oracle.sqlj.sqljruntime, 19.0.0.0.0...

Patching component oracle.wwg.plsql, 19.0.0.0.0...

Patching component oracle.network.client, 19.0.0.0.0...

Patching component oracle.dbtoolslistener, 19.0.0.0.0...

Patching component oracle.rdbms.install.plugins, 19.0.0.0.0...

Patching component oracle.ctx.rsf, 19.0.0.0.0...

Patching component oracle.nlsrtl.rsf.lbuilder, 19.0.0.0.0...

Patching component oracle.rdbms.drdaas, 19.0.0.0.0...

Patching component oracle.sdo.locator, 19.0.0.0.0...

Patching component oracle.rdbms.locator, 19.0.0.0.0...

Patching component oracle.network.listener, 19.0.0.0.0...

Patching component oracle.ovm, 19.0.0.0.0...

Patching component oracle.javavm.server, 19.0.0.0.0...

Patching component oracle.xdk.xquery, 19.0.0.0.0...

Patching component oracle.precomp.common, 19.0.0.0.0...

Patching component oracle.precomp.lang, 19.0.0.0.0...

Patching component oracle.jdk, 1.8.0.201.0...
Patch 38632161 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [38632161].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2026-01-22_22-03-57PM_1.log

OPatch succeeded.
[oracle@prod_db 38632161]$

九、启动数据库和监听
#

应用补丁后就可以启动数据库和监听了

sqlplus / as sysdba
startup
alter pluggable database all open;
lsnrctl start

[oracle@prod_db 38632161]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 22 22:11:19 2026
Version 19.30.0.0.0

Copyright (c) 1982, 2025, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 2516580200 bytes
Fixed Size                  9181032 bytes
Variable Size             536870912 bytes
Database Buffers         1962934272 bytes
Redo Buffers                7593984 bytes
Database mounted.
Database opened.
SQL> alter pluggable database all open;

Pluggable database altered.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.30.0.0.0
[oracle@prod_db 38632161]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 22-JAN-2026 22:11:56

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

Starting /u01/app/oracle/product/19.3.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/prod_db/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prod_db)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=prod_db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                22-JAN-2026 22:11:56
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/prod_db/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prod_db)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@prod_db 38632161]$

十、运行 Datapatch 健全性检查
#

进行二进制补丁更新后,必须验证 SQL 级别的更改。

在运行 datapatch 之前,Oracle 提供了一个强大的预验证步骤

检查内容包括:

  • 数据库组件状态
  • 无效对象
  • PDB违规行为
  • 表空间健康状况
  • 调度程序作业
  • 数据泵活动
  • JVM、Vault 和 GoldenGate 触发器
  • 中央库存和词典一致性
datapatch -sanity_checks

[oracle@prod_db 38632161]$ datapatch -sanity_checks
SQL Patching sanity checks version 19.30.0.0.0 on Thu 22 Jan 2026 10:16:15 PM CST
Copyright (c) 2021, 2026, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sanity_checks_20260122_221615_48586/sanity_checks_20260122_221615_48586.log

Running checks
JSON report generated in /u01/app/oracle/cfgtoollogs/sqlpatch/sanity_checks_20260122_221615_48586/sqlpatch_sanity_checks_summary.json file
Checks completed. Printing report:

Check: Database component status - OK
Check: PDB Violations - OK
Check: Invalid System Objects - OK
Check: Tablespace Status - OK
Check: Backup jobs - OK
Check: Temp file exists - OK
Check: Temp file online - OK
Check: Data Pump running - OK
Check: Container status - OK
Check: Oracle Database Keystore - OK
Check: Dictionary statistics gathering - WARNING
  Patching the database without recent data dictionary statistics gathered may lead to performance issues.
  Data dictionary statistics are older than 7 days.
  Run the following queries to start gathering the dictionary statistics:
    EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;
    EXEC DBMS_SYSTEM.GATHER_FIXED_OBJECTS_STATS;
  Refer to MOS 457926.1 for more details.
  PDB$SEED:
    |     LATEST      |        OPERATION        |  STATUS   |
    |-----------------+-------------------------+-----------|
    | 17-APR-19 02:03 | gather_dictionary_stats | COMPLETED |
    |-----------------+-------------------------+-----------|
Check: Scheduled Jobs - OK
Check: GoldenGate triggers - OK
Check: Logminer DDL triggers - OK
Check: Check sys public grants - OK
Check: Statistics gathering running - OK
Check: Optim dictionary upgrade parameter - OK
Check: Symlinks on oracle home path - OK
Check: Central Inventory - OK
Check: Java Virtual Machine Enable - OK
Check: Oracle Database Vault Enabled - OK
Check: Queryable Inventory database directories - OK
Check: Queryable Inventory locks - OK
Check: Queryable Inventory package - OK
Check: Queryable Inventory external table - OK
Check: Imperva processes - OK
Check: Guardium processes - OK
Check: Locale - OK

Refer to MOS Note 2975965.1 and debug log
/u01/app/oracle/cfgtoollogs/sqlpatch/sanity_checks_20260122_221615_48586/sanity_checks_debug_20260122_221615_48586.log

SQL Patching sanity checks completed on Thu 22 Jan 2026 10:16:19 PM CST
[oracle@prod_db 38632161]$

✅️这证明数据库已准备好进行 SQL 补丁更新,并且数据完全一致。


十一、使用 Datapatch 应用 SQL 补丁
#

现在执行 datapatch 工具,应用与 19.30 二进制补丁对应的 SQL 脚本。

Datapatch 连接到数据库,收集注册表信息,并应用 SQL 更改:

datapatch -verbose

[oracle@prod_db 38632161]$ datapatch -verbose
SQL Patching tool version 19.30.0.0.0 Production on Thu Jan 22 22:22:57 2026
Copyright (c) 2012, 2026, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_48990_2026_01_22_22_22_57/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done

Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
  No interim patches found

Current state of release update SQL patches:
  Binary registry:
    19.30.0.0.0 Release_Update 260116203150: Installed
  PDB CDB$ROOT:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 22-JAN-26 08.48.44.104406 PM
  PDB PDB:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 22-JAN-26 08.54.41.962296 PM
  PDB PDB$SEED:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 22-JAN-26 08.54.41.962296 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PDB
    No interim patches need to be rolled back
    Patch 38632161 (Database Release Update : 19.30.0.0.260120 (38632161)):
      Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.30.0.0.0 Release_Update 260116203150
    No interim patches need to be applied

Installing patches...
Patch installation complete.  Total patches installed: 3

Validating logfiles...done
Patch 38632161 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/38632161/28443995/38632161_apply_PRODCDB_CDBROOT_2026Jan22_22_23_43.log (no errors)
Patch 38632161 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/38632161/28443995/38632161_apply_PRODCDB_PDBSEED_2026Jan22_22_28_42.log (no errors)
Patch 38632161 apply (pdb PDB): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/38632161/28443995/38632161_apply_PRODCDB_PDB_2026Jan22_22_28_42.log (no errors)
SQL Patching tool complete on Thu Jan 22 22:32:57 2026
[oracle@prod_db 38632161]$

✅️这证实 SQL 注册表已成功更新。


十二、验证补丁应用情况
#

要确认补丁是否已安装,请查询 DBA_REGISTRY_SQLPATCH 视图。

set lines 200
col action_time format a25
col status format a12
select action_time, action, status, source_version, target_version from dba_registry_sqlpatch;

[oracle@prod_db 38632161]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 22 22:36:11 2026
Version 19.30.0.0.0

Copyright (c) 1982, 2025, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.30.0.0.0

SQL> set lines 200
SQL> col action_time format a25
SQL> col status format a12
SQL> select action_time, action, status, source_version, target_version from dba_registry_sqlpatch;

ACTION_TIME               ACTION          STATUS       SOURCE_VERSION  TARGET_VERSION
------------------------- --------------- ------------ --------------- ---------------
22-JAN-26 08.48.44.104406 APPLY           SUCCESS      19.1.0.0.0      19.3.0.0.0
 PM

22-JAN-26 10.28.24.990898 APPLY           SUCCESS      19.3.0.0.0      19.30.0.0.0
 PM


SQL>

Oracle 主目录补丁清单

opatch lspatches

[oracle@prod_db 38632161]$ opatch lspatches
38632161;Database Release Update : 19.30.0.0.260120 (38632161)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.
[oracle@prod_db 38632161]$

编译失效对象

@$ORACLE_HOME/rdbms/admin/utlrp.sql

[oracle@prod_db 38632161]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 22 22:39:50 2026
Version 19.30.0.0.0

Copyright (c) 1982, 2025, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.30.0.0.0

SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

Session altered.


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2026-01-22 22:39:53

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END              2026-01-22 22:39:54

DOC> The following query reports the number of invalid objects.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
                  0

DOC> The following query reports the number of exceptions caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC> Note: Typical compilation errors (due to coding errors) are not
DOC>       logged into this table: they go into DBA_ERRORS instead.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
                          0


Function created.


PL/SQL procedure successfully completed.


Function dropped.


PL/SQL procedure successfully completed.

SQL>

至此整个升级过程结束