上篇我们将一个11.2.0.4的单实例升级到了19.3,本篇继续升级到最新的RU,19.27.
Oracle 11g 升级到19c 操作示例 — AutoUpgrade 工具
https://www.cndba.cn/dave/article/131640
其他相关文章如下:
Oracle 12.2 家族的补丁 RU 和 RUR 说明
https://www.cndba.cn/dave/article/4063Linux 7.4 平台下 Oracle 19.3 单实例安装手册
https://www.cndba.cn/dave/article/3427
1 当前DB 环境
[oracle@cndba.cn software]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
[oracle@cndba.cn software]$ uname -r
3.10.0-957.el7.x86_64
[oracle@cndba.cn software]$
[oracle@cndba.cn admin]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 26-JUN-2025 13:46:14
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora11g)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 26-JUN-2025 13:24:53
Uptime 0 days 0 hr. 23 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u02/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora
Listener Log File /u02/app/oracle/diag/tnslsnr/ora11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@cndba.cn admin]$
[oracle@cndba.cn admin]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 26 14:03:51 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 con_name
CON_NAME
------------------------------
orcl
SQL>
2 从MOS下载19.27 的RU 补丁
Oracle RU 19.27 发布了
https://www.cndba.cn/dave/article/131629
3 开始安装RU补丁
3.1 更新OPatch工具版本
要安装19c的RU,OPatch 工具的版本必须大于 12.2.0.1.45。 在Oracle 19.3的版本中,OPatch版本是12.2.0.1.17的。 需要单独的更新OPatch。
[oracle@cndba.cn OPatch]$ pwd
/u02/app/oracle/product/19.0.0/dbhome_1/OPatch
[oracle@cndba.cn OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.
[oracle@cndba.cn OPatch]$
如果从其他版本进行升级,可以从patch 6880880 下载最新的OPatch。 关于OPatch 工具升级的方法参考我之前的博客,如下:
Oracle 更新 OPatch 工具版本 的方法 说明
https://www.cndba.cn/Dave/article/1353
[oracle@cndba.cn OPatch]$ ./opatch --version
OPatch cannot continue because it would not be able to load OUI platform dependent library from the directory "/u02/app/oracle/product/19.0.0/dbhome_1/oui/lib/linux". The directory does not exist in the Oracle home.
This could be due to the following reasons.
(1) Incompatible usage of java with OUI (32/64 bit).
(2) Wrong 32-bit Oracle Home installation in 64-bit environment (or) vice-versa.
Please contact Oracle support for more details.
OPatch failed with error code 1
[oracle@cndba.cn OPatch]$ ./opatch version -jre /u02/app/oracle/product/19.0.0/dbhome_1/jdk
OPatch Version: 12.2.0.1.44
OPatch succeeded.
[oracle@cndba.cn OPatch]$
Oracle 19c 升级错误【verify_queryable_inventory returned ORA-20001: Latest xml inventory is not loaded into table】
https://www.cndba.cn/dave/article/131628
3.2 检查Patch 是否冲突
[oracle@cndba.cn software]$ cd 37642901/
[oracle@cndba.cn 37642901]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ -jre /u02/app/oracle/product/19.0.0/dbhome_1/jdk
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2025, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u02/app/oracle/product/19.0.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u02/app/oracle/product/19.0.0/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.44
OUI version : 12.2.0.7.0
Log file location : /u02/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2025-06-26_14-15-08PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
[oracle@cndba.cn 37642901]$
3.3 应用patch
这里有几点注意事项:
- 如果是物理DG,那么主备库都需要安装Patch,可以先在备库安装,再安装主库,操作步骤可以参考:Document 278641.1。
- 对于RAC 环境,可以使用OPatch rolling 方式来安装,这样没有停机时间,具体操作可以参考:Document 244241.1。
- 对于单实例,必须关闭待升级ORACLE HOME关联的所有实例和监听,并且包括退出所有的sqlplus窗口。
关闭实例和监听,并退出sqlplus:
[oracle@cndba.cn 37642901]$ lsnrctl stop
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 26-JUN-2025 14:17:53
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora11g)(PORT=1521)))
The command completed successfully
[oracle@cndba.cn 37642901]$
[oracle@cndba.cn 37642901]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 26 14:21:59 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> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@cndba.cn 37642901]$
应用patch:
[oracle@cndba.cn 37642901]$ $ORACLE_HOME/OPatch/opatch apply -jre /u02/app/oracle/product/19.0.0/dbhome_1/jdk
Oracle Interim Patch Installer version 12.2.0.1.46
Copyright (c) 2025, Oracle Corporation. All rights reserved.
Oracle Home : /u02/app/oracle/product/19.0.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u02/app/oracle/product/19.0.0/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.46
OUI version : 12.2.0.7.0
Log file location : /u02/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2025-06-26_14-37-07PM_1.log
……
Patching component oracle.jdk, 1.8.0.201.0...
Patch 37642901 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [37642901].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u02/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2025-06-26_14-41-30PM_1.log
OPatch succeeded.
[oracle@cndba.cn 37642901]$
3.4 加载变化的SQL到数据库
安装补丁之后,还需要将有变化的SQL加载到数据库中,这里可以直接运行Datapatch工具将这些修改的SQL重新加载到数据库中,如果是RAC环境,只需要在一个节点执行就可以了。
根据readme的说明,操作步骤如下:
sqlplus /nolog
SQL> Connect / as sysdba
SQL> startup
SQL> alter pluggable database all open;
SQL> quit
cd $ORACLE_HOME/OPatch
./datapatch -verbose
datapatch命令只对打开的数据库生效,所有Oracle建议在执行该命令之前将CDB和所有的PDB都打开,一次更新掉。 但如果有部分PDB没有打开,也可以在打开之后,重新运行datapatch命令并制定pdb实例名,比如: ./datapatch -pdbs dave
这种情况可以参考之前的博客:
Oracle 18c 单实例 RUR 从18.3.0 升级到18.3.1 操作手册
https://www.cndba.cn/dave/article/3138
我们这里将所有的PDB 都打开后在执行datapatch工具。
启动实例:
[oracle@cndba.cn dbhome_1]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 26 14:58:50 2025
Version 19.27.0.0.0
Copyright (c) 1982, 2024, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 8589932704 bytes
Fixed Size 8960160 bytes
Variable Size 419430400 bytes
Database Buffers 8153726976 bytes
Redo Buffers 7815168 bytes
Database mounted.
Database opened.
SQL>
我们这里是11g 升上来的,是non-cdb 架构,如果是pdb 架构,还需要open pdb:
SQL> show pdbs
SQL> alter pluggable database dave open;
运行datapatch工具:
[oracle@cndba.cn 37642901]$ $ORACLE_HOME/OPatch/datapatch -verbose
SQL Patching tool version 19.27.0.0.0 Production on Thu Jun 26 15:04:56 2025
Copyright (c) 2012, 2025, Oracle. All rights reserved.
Log file for this invocation: /u02/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_52816_2025_06_26_15_04_56/sqlpatch_invocation.log
Connecting to database...OK
Gathering database info...done
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.27.0.0.0 Release_Update 250406131139: Installed
SQL registry:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 26-JUN-25 01.30.07.696068 AM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
No interim patches need to be rolled back
Patch 37642901 (Database Release Update : 19.27.0.0.250415 (37642901)):
Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.27.0.0.0 Release_Update 250406131139
No interim patches need to be applied
Installing patches...
Patch installation complete. Total patches installed: 1
Validating logfiles...done
Patch 37642901 apply: SUCCESS
logfile: /u02/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_apply_ORCL_2025Jun26_15_18_24.log (no errors)
SQL Patching tool complete on Thu Jun 26 15:30:10 2025
[oracle@cndba.cn 37642901]$
3.5 查看版本变化
datapatch 工具加载修改的SQL之后会将patch添加到dba_registry_sqlpatch试图中,以反应patch的应用情况。 查询试图可以看到patch的APPLY状态为”SUCCESS”。
SQL> col status for a10
SQL> col action for a10
SQL> col action_time for a30
SQL> col description for a60
SQL> select patch_id,patch_type,action,status,action_time,description from dba_registry_sqlpatch;
PATCH_ID PATCH_TYPE ACTION
---------- -------------------- ------------------------------
STATUS
--------------------------------------------------
ACTION_TIME
---------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------
29517242 RU APPLY
SUCCESS
26-JUN-25 01.30.07.696068 AM
Database Release Update : 19.3.0.0.190416 (29517242)
PATCH_ID PATCH_TYPE ACTION
---------- -------------------- ------------------------------
STATUS
--------------------------------------------------
ACTION_TIME
---------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------
37642901 RU APPLY
SUCCESS
26-JUN-25 03.29.30.184284 PM
Database Release Update : 19.27.0.0.250415 (37642901)
SQL>select ACTION_TIME,VERSION,COMMENTS from dba_registry_history;
ACTION_TIME VERSION COMMENTS
---------------------------------------- ------------------------- ------------------------------------------------------------
24-AUG-13 12.03.45.119862 PM 11.2.0.4 Patchset 11.2.0.2.0
04-FEB-21 11.32.31.238128 PM 11.2.0.4 Patchset 11.2.0.2.0
19 RDBMS_19.27.0.0.0DBRU_LINUX.X64_250405
26-JUN-25 01.30.03.734776 AM 19.0.0.0.0 Patch applied on 19.3.0.0.0: Release_Update - 190410122720
26-JUN-25 01.38.10.217198 AM 19.0.0.0.0 Upgraded from 11.2.0.4.0 to 19.3.0.0.0
26-JUN-25 03.29.30.239957 PM 19.0.0.0.0 Patch applied from 19.3.0.0.0 to 19.27.0.0.0: Release_Update
- 250406131139
3.6 处理无效对象
最后一步就是处理无效对象,因为之前datapatch命令会加载SQL,这个过程可能会产生无效对象。 可以执行@utlrp.sql脚本处理这些无效对象。
SQL> @/u02/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/utlrp.sql
版权声明:本文为博主原创文章,未经博主允许不得转载。