Oracle 19c 19.3单实例RU升级补丁至19.28

一、环境介绍

环境 信息
OS Oracle Linux Server 7.9
IP 192.168.184.200
DB Version oracle 19.3.0
ORACLE_SID oracle19c
OPatch p6880880_190000_Linux-x86-64(OPatch 12.2.0.1.47)
DB Patch p37960098_190000_Linux-x86-64(DB-19.28)
OJVM Patch p37847857_190000_Linux-x86-64(OJVM-19.28)

二、现有环境

##oracle
[oracle@oracle OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@oracle OPatch]$ 
[oracle@oracle OPatch]$ ./opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)

OPatch succeeded.


select * from product_component_version;
 
PRODUCT                        VERSION    VERSION_FU STATUS
------------------------------ ---------- ---------- ------------------
Oracle Database 19c Enterprise 19.0.0.0.0 19.3.0.0.0 Production Edition

三、升级OPatch

###oracle
[root@oracle opt]# cd /u01/app/oracle/product/19.3.0/dbhome_1/
[root@oracle dbhome_1]# mv OPatch OPatch.bak20250829
[root@oracle dbhome_1]# unzip -qo /opt/p6880880_190000_Linux-x86-64\(OPatch\ 12.2.0.1.47\).zip -d /u01/app/oracle/product/19.3.0/dbhome_1/
[root@oracle dbhome_1]# chmod -R 755 OPatch
[root@oracle dbhome_1]#
[root@oracle dbhome_1]# chown -R oracle:oinstall OPatch
[root@oracle dbhome_1]# cd OPatch
[root@oracle OPatch]# ./opatch version
OPatch Version: 12.2.0.1.47

OPatch succeeded.

四、检查补丁冲突

###oracle DB和OJVM
###解压补丁至根/opt目录 
unzip -qo p37960098_190000_Linux-x86-64\(DB-19.28\).zip
unzip -qo p37847857_190000_Linux-x86-64\(OJVM-19.28\).zip
chown -R oracle:oinstall 37960098 
chown -R oracle:oinstall 37847857
chmod -R 755 37960098
chmod -R 755 37847857

su - oracle
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

##进入OJVM补丁目录检查补丁是否冲突
[oracle@oracle opt]$ cd 37847857/
[oracle@oracle 37847857]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.47
Copyright (c) 2025, 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.47
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2025-08-29_10-23-53AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[oracle@oracle 37847857]$ 


##进入DB补丁目录检查补丁是否冲突
[oracle@oracle 37847857]$ cd ../37960098/
[oracle@oracle 37960098]$ 
[oracle@oracle 37960098]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.47
Copyright (c) 2025, 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.47
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2025-08-29_10-24-13AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

五、关闭监听和数据库

###需要关闭监听和数据库,并退出sqlplus
[oracle@oracle ~]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-AUG-2025 10:28:44

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))
The command completed successfully
[oracle@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Aug 29 10:28:53 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> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle ~]$ 

六、应用补丁

### 打DB补丁oracle
[oracle@oracle opt]$ cd 37960098/
[oracle@oracle 37960098]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.47
Copyright (c) 2025, 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.47
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2025-08-29_10-33-44AM_1.log

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

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 '37960098' 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.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.ldap.ztk, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.pg4appc, 19.0.0.0.0 ] , [ oracle.pg4appc, 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.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 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.util, 19.0.0.0.0...

Patching component oracle.rdbms, 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.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 37960098 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [37960098].
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/opatch2025-08-29_10-33-44AM_1.log

OPatch succeeded.




### 打OJVM oracle
[oracle@oracle opt]$ cd 37847857/
[oracle@oracle 37847857]$ 
[oracle@oracle 37847857]$ $ORACLE_HOME/OPatch/opatch apply 
Oracle Interim Patch Installer version 12.2.0.1.47
Copyright (c) 2025, 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.47
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2025-08-29_10-45-13AM_1.log

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

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 '37847857' to OH '/u01/app/oracle/product/19.3.0/dbhome_1'

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

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

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

Patching component oracle.rdbms, 19.0.0.0.0...

Patching component oracle.javavm.client, 19.0.0.0.0...
Patch 37847857 successfully applied.
Log file location: /u01/app/oracle/product/19.3.0/dbhome_1/cfgtoollogs/opatch/opatch2025-08-29_10-45-13AM_1.log

OPatch succeeded.
[oracle@oracle 37847857]$ 


### 查看补丁 oracle
[oracle@oracle 37847857]$ /u01/app/oracle/product/19.3.0/dbhome_1/OPatch/opatch lspatches
37847857;OJVM RELEASE UPDATE: 19.28.0.0.250715 (37847857)
37960098;Database Release Update : 19.28.0.0.250715 (37960098)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

七、加载修改过的SQL文件到数据库

###启动实例,监听建议先不开,防止有用户连接操作。 oracle
sqlplus /nolog
SQL> Connect / as sysdba
SQL> startup
SQL> alter pluggable database all open;
SQL> quit
cd $ORACLE_HOME/OPatch
./datapatch -verbose


###详细操作日志
[oracle@oracle ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Aug 29 10:56:49 2025
Version 19.28.0.0.0

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

SQL> Connect / as sysdba
Connected to an idle instance.
SQL> 
SQL> 
SQL> startup
ORACLE instance started.

Total System Global Area 2667575536 bytes
Fixed Size                  9181424 bytes
Variable Size             570425344 bytes
Database Buffers         2080374784 bytes
Redo Buffers                7593984 bytes
Database mounted.
Database opened.
SQL> alter pluggable database all open;

Pluggable database altered.

SQL> 
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
SQL> 
SQL> 
SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.28.0.0.0





###加载补丁
[oracle@oracle ~]$ cd $ORACLE_HOME/OPatch
[oracle@oracle OPatch]$ 
[oracle@oracle OPatch]$ 
[oracle@oracle OPatch]$ ./datapatch -verbose
SQL Patching tool version 19.28.0.0.0 Production on Fri Aug 29 10:59:22 2025
Copyright (c) 2012, 2025, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_12024_2025_08_29_10_59_22/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:
Interim patch 37847857 (OJVM RELEASE UPDATE: 19.28.0.0.250715 (37847857)):
  Binary registry: Installed
  PDB CDB$ROOT: Not installed
  PDB PDB$SEED: Not installed
  PDB PDB1: Not installed

Current state of release update SQL patches:
  Binary registry:
    19.28.0.0.0 Release_Update 250705030417: Installed
  PDB CDB$ROOT:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 27-AUG-25 06.50.16.846746 PM
  PDB PDB$SEED:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 27-AUG-25 06.55.40.882947 PM
  PDB PDB1:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 27-AUG-25 06.55.40.882947 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PDB1
    No interim patches need to be rolled back
    Patch 37960098 (Database Release Update : 19.28.0.0.250715 (37960098)):
      Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.28.0.0.0 Release_Update 250705030417
    The following interim patches will be applied:
      37847857 (OJVM RELEASE UPDATE: 19.28.0.0.250715 (37847857))

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

Validating logfiles...done
Patch 37960098 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37960098/27635722/37960098_apply_ORACLE19_CDBROOT_2025Aug29_11_01_50.log (no errors)
Patch 37847857 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37847857/27534561/37847857_apply_ORACLE19_CDBROOT_2025Aug29_11_00_38.log (no errors)
Patch 37960098 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37960098/27635722/37960098_apply_ORACLE19_PDBSEED_2025Aug29_11_12_03.log (no errors)
Patch 37847857 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37847857/27534561/37847857_apply_ORACLE19_PDBSEED_2025Aug29_11_11_13.log (no errors)
Patch 37960098 apply (pdb PDB1): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37960098/27635722/37960098_apply_ORACLE19_PDB1_2025Aug29_11_12_03.log (no errors)
Patch 37847857 apply (pdb PDB1): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37847857/27534561/37847857_apply_ORACLE19_PDB1_2025Aug29_11_11_13.log (no errors)
SQL Patching tool complete on Fri Aug 29 11:21:23 2025
[oracle@oracle OPatch]$ 

八、编译无效对象

###datapatch命令会加载SQL,这个过程可能会产生无效对象。 oracle
export PATH=$PATH:$ORACLE_HOME/bin
cd $ORACLE_HOME/rdbms/admin
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -e -b utlrp -d $ORACLE_HOME/rdbms/admin utlrp.sql
###或者
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql




###采用其中一种方式
[oracle@oracle OPatch]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@oracle OPatch]$ cd $ORACLE_HOME/rdbms/admin
[oracle@oracle admin]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -e -b utlrp -d $ORACLE_HOME/rdbms/admin utlrp.sql
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/utlrp_catcon_14887.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/utlrp*.log] files for output generated by scripts

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/utlrp_*.lst] files for spool files, if any

catcon.pl: completed successfully

九、补丁验证

[oracle@oracle 37847857]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Aug 29 11:32:19 2025
Version 19.28.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.28.0.0.0

SQL> 
SQL> 
SQL> 
SQL> SELECT patch_id, status, description FROM dba_registry_sqlpatch;

  PATCH_ID STATUS					 DESCRIPTION
---------- ------------------------- --------------------------------------------------------------------------------
  29517242 SUCCESS                   Database Release Update : 19.3.0.0.190416 (29517242)
  37847857 SUCCESS                   OJVM RELEASE UPDATE: 19.28.0.0.250715 (37847857)
  37960098 SUCCESS                   Database Release Update : 19.28.0.0.250715 (37960098)
SQL> 
SQL> 
SQL> SELECT owner, object_name, object_type
  2  FROM dba_objects
  3  WHERE status = 'INVALID';

no rows selected

SQL> 
SQL> SELECT banner_full FROM v$version;

BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.28.0.0.0

十、参考链接

Oracle 19.28 RU 升级最佳实践指南

Oracle 19c 单实例 RU 从19.14 升级到19.15 -- cnDBA.cn_中国DBA社区

posted @ 2025-08-29 15:17  把你打成猪  阅读(165)  评论(0)    收藏  举报