Oracle 19C RU补丁升级,从19.7to19.25 -单机

1. 环境信息:

|--------|---------|---------------|-----------|-----------|
| 角色 | 数据库 | IP地址 | 数据库版本 | 数据库名称 |
| 源端 | 单实例 | 172.30.21.191 | 19.7 | hfzcdb |

2. 安装准备

用rman备份数据库,再备份下oracle目录:

命令: tar zavf oracle.tar /oracle

19.25版本关于19C的补丁内容:

Oracle 19C Grid Database Release Update 19.25.0 Patch 36912597 15-Oct-2024

Oracle 19C Database GI Release Update 19.25.0 Patch 36916690 15-Oct-2024

Oracle 19C OJVM OJVM Release Update 19.25.0 Patch 36878697 15-Oct-2024

3. 安装步骤

下面演示一下 Oracle 19C RU 19.25 补丁的安装步骤。

3.1. 阅读 README 文件

首先需要查看补丁的 README 文件(解压补丁后即可获得),其中补丁的前置要求如下:

You must use the OPatch utility version 12.2.0.1.43 or later to apply this patch.

If you are using a Data Guard Physical Standby database, you must install this patch on both the primary database and the physical standby database.

If this is an Oracle RAC environment, install this patch using the OPatch rolling (no downtime) installation method as this patch is rolling RAC installable.

If this is not a RAC environment, shut down all instances and listeners associated with the Oracle home that you are updating.

翻译一下就是:

OPatch 版本大于 12.2.0.1.43

有 DG 的环境,DG 也要打补丁

RAC 环境可以滚动升级

单机环境需要关闭所有 oracle 相关的服务

3.2. 升级 OPatch

查看当前数据库的 Opatch 版本:

[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/OPatch]$opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.

备份之前的Opatch,

[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1]$mv OPatch/ OPatch-bak/

opatch 版本低于 43,需要下载最新的 OPatch 补丁替换,在 Patch 6880880 下载对应版本的补丁:

下载后上传到数据库主机,解压替换即可(这一步不需要停机,可以在线操作):

## 这里我上传到 /backup 目录,所以需要对目录进行授权
[root@hfzcdb91:/root]# chown -R oracle:oinstall /backup/

## oracle 用户静默解压 opatch 到 ORACLE_HOME 目录下
[oracle@hfzcdb91:/home/oracle]$ cd /backup/
[oracle@hfzcdb91:/backup]$ unzip -qo p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME

## 查看替换后的 OPatch 版本
[oracle@hfzcdb91:/oracle/app/oracle/product/19c/db_1/OPatch]$opatch version
OPatch Version: 12.2.0.1.44

OPatch succeeded.

升级完 OPatch 版本之后,需要进行安装前补丁冲突检查。

3.3. 冲突检查

首先需要上传 RU 补丁并解压:

## 这里我上传到 /backup 目录,所以需要对目录进行授权
[root@hfzcdb91:/root]# chown -R oracle:oinstall /backup/

## oracle 用户静默解压 RU 补丁包
[oracle@hfzcdb91:/backup]$ unzip -q p36912597_190000_Linux-x86-64.zip 
[oracle@hfzcdb91:/backup]$ cd 36912597/

## 检查冲突,一般是没有问题的
[oracle@hfzcdb91:/backup/36912597]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /oracle/app/oracle/product/19c/db_1
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.44
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_16-15-38PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

到这都没问题的话,就可以协商停机时间进行补丁升级了。

3.4. 补丁升级

前置工作都做完之后,补丁升级步骤其实很简单,RAC 滚动升级也可以使用这种方式:

-- 关闭数据库
[oracle@hfzcdb91:/backup/36912597]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Dec 6 16:24:45 2024
Version 19.7.0.0.0

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


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

SYS@hfzcdb> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

-- 关闭监听

[oracle@hfzcdb91:/backup/36912597]$lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 06-DEC-2024 16:27:54

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hfzcdb91)(PORT=1521)))
The command completed successfully

报错:Prerequisite check "CheckActiveFilesAndExecutables" failed.
解决:
[oracle@hfzcdb91:/backup/30783543/30869156]$fuser /oracle/app/oracle/product/19c/db_1/lib/libclntsh.so.19.1
[oracle@hfzcdb91:/backup/30783543/30869156]$kill -9 13411
-- 静默安装补丁(确保没有 oracle 相关进程之后就可以安装补丁)
[oracle@hfzcdb91:/backup/36912597]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch apply -silent
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/19c/db_1
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.44
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_16-29-47PM_1.log

Verifying environment and performing prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:


Following active files/executables/libs are used by ORACLE_HOME :/oracle/app/oracle/product/19c/db_1
/oracle/app/oracle/product/19c/db_1/lib/libclntsh.so.19.1
/oracle/app/oracle/product/19c/db_1/lib/libsqlplus.so



/oracle/app/oracle/product/19c/db_1/bin/oracle
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_16-29-47PM_1.log

OPatch failed with error code 73
[oracle@hfzcdb91:/backup/36912597]$ps -ef|grep ora
root      20097  20006  0 10:02 pts/0    00:00:00 su - oracle
oracle    20099  20097  0 10:02 pts/0    00:00:00 -bash
oracle    20158  20099  0 10:02 pts/0    00:00:00 rlwrap sqlplus / as sysdba
oracle    20159  20158  0 10:02 pts/1    00:00:00 sqlplus   as sysdba
oracle    20160  20159  0 10:02 ?        00:00:00 oraclehfzcdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
root      24283  24208  0 11:13 pts/2    00:00:00 su - oracle
oracle    24284  24283  0 11:13 pts/2    00:00:00 -bash
oracle    39035  24284  0 14:50 pts/2    00:00:00 rlwrap sqlplus / as sysdba
oracle    39036  39035  0 14:50 pts/3    00:00:00 sqlplus   as sysdba
root      43090  10228  0 16:00 ?        00:00:00 sshd: oracle [priv]
oracle    43094  43090  1 16:00 ?        00:00:22 sshd: oracle@notty
oracle    43095  43094  0 16:00 ?        00:00:00 /usr/libexec/openssh/sftp-server
oracle    43214  43094  0 16:01 ?        00:00:09 /usr/libexec/openssh/sftp-server
root      43409  43335  0 16:03 pts/4    00:00:00 su - oracle
oracle    43410  43409  0 16:03 pts/4    00:00:00 -bash
oracle    46534  43410  0 16:35 pts/4    00:00:00 ps -ef
oracle    46535  43410  0 16:35 pts/4    00:00:00 grep --color=auto ora
[oracle@hfzcdb91:/backup/36912597]$kill -9 20159
[oracle@hfzcdb91:/backup/36912597]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch apply -silent^C
[oracle@hfzcdb91:/backup/36912597]$ps -ef|grep ora
root      20097  20006  0 10:02 pts/0    00:00:00 su - oracle
oracle    20099  20097  0 10:02 pts/0    00:00:00 -bash
root      24283  24208  0 11:13 pts/2    00:00:00 su - oracle
oracle    24284  24283  0 11:13 pts/2    00:00:00 -bash
oracle    39035  24284  0 14:50 pts/2    00:00:00 rlwrap sqlplus / as sysdba
oracle    39036  39035  0 14:50 pts/3    00:00:00 sqlplus   as sysdba
root      43090  10228  0 16:00 ?        00:00:00 sshd: oracle [priv]
oracle    43094  43090  1 16:00 ?        00:00:22 sshd: oracle@notty
oracle    43095  43094  0 16:00 ?        00:00:00 /usr/libexec/openssh/sftp-server
oracle    43214  43094  0 16:01 ?        00:00:09 /usr/libexec/openssh/sftp-server
root      43409  43335  0 16:03 pts/4    00:00:00 su - oracle
oracle    43410  43409  0 16:03 pts/4    00:00:00 -bash
oracle    46571  43410  0 16:36 pts/4    00:00:00 ps -ef
oracle    46572  43410  0 16:36 pts/4    00:00:00 grep --color=auto ora
[oracle@hfzcdb91:/backup/36912597]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch apply -silent
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/19c/db_1
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.44
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_16-36-13PM_1.log

Verifying environment and performing prerequisite checks...

--------------------------------------------------------------------------------
Start OOP by Prereq process.
Launch OOP...

Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/19c/db_1
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.44
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_16-38-00PM_1.log

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

Do you want to proceed? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
All checks passed.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/oracle/product/19c/db_1')


Is the local system ready for patching? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Backing up files...
Applying interim patch '36912597' to OH '/oracle/app/oracle/product/19c/db_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.crypto.rsf, 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.tfa, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.ldap.ztk, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.options.olap, 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, 19.0.0.0.0...

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

Patching component oracle.rdbms.rsf, 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.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.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.sqlplus, 19.0.0.0.0...

Patching component oracle.sqlplus.ic, 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.javavm.server, 19.0.0.0.0...

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

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

Patching component oracle.ovm, 19.0.0.0.0...

Patching component oracle.oraolap, 19.0.0.0.0...

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

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

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

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

Patching component oracle.xdk, 19.0.0.0.0...

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

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

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

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

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

Patching component oracle.dbtoolslistener, 19.0.0.0.0...

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

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

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

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

Patching component oracle.rdbms.dm, 19.0.0.0.0...

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

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

Patching component oracle.odbc, 19.0.0.0.0...

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

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

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

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

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

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

Patching component oracle.rdbms.install.plugins, 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.oraolap.dbscripts, 19.0.0.0.0...

Patching component oracle.network.client, 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 36912597 successfully applied.
Sub-set patch [30869156] has become inactive due to the application of a super-set patch [36912597].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_16-38-00PM_1.log

OPatch succeeded.
[oracle@hfzcdb91:/backup/36912597]$

查看数据库已经升级完成:

[oracle@hfzcdb91:/backup/36912597]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch lspatches
36912597;Database Release Update : 19.25.0.0.241015 (36912597)
30805684;OJVM RELEASE UPDATE: 19.7.0.0.200414 (30805684)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

再升级 OJVM:

[oracle@hfzcdb91:/backup]$unzip -q p36878697_190000_Linux-x86-64.zip
replace PatchSearch.xml? [y]es, [n]o, [A]ll, [N]one, [r]ename: yes
[oracle@hfzcdb91:/backup]$cd 36878697/
[oracle@hfzcdb91:/backup/36878697]$ll
total 64
drwxr-x--- 3 oracle oinstall    28 Sep 24 15:15 etc
drwxr-x--- 6 oracle oinstall    80 Sep 24 15:15 files
-rw-rw-r-- 1 oracle oinstall 59526 Oct 15 12:01 README.html
-rw-r--r-- 1 oracle oinstall    11 Sep 24 15:15 README.txt
[oracle@hfzcdb91:/backup/36878697]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/19c/db_1
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.44
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_17-06-13PM_1.log

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

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 = '/oracle/app/oracle/product/19c/db_1')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '36878697' to OH '/oracle/app/oracle/product/19c/db_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 36878697 successfully applied.
Sub-set patch [30805684] has become inactive due to the application of a super-set patch [36878697].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_17-06-13PM_1.log

OPatch succeeded.

查看 ojvm 已经升级完成:

[oracle@hfzcdb91:/backup/36878697]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch lspatches
36878697;OJVM RELEASE UPDATE: 19.25.0.0.241015 (36878697)
36912597;Database Release Update : 19.25.0.0.241015 (36912597)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

3.5. 数据库升级,执行 datapatch:

Oracle 软件升级成功后,数据库本身也需要进行一些升级:

## 打开数据库
[oracle@hfzcdb91:/backup/36878697]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Dec 6 17:12:14 2024
Version 19.25.0.0.0

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

Connected to an idle instance.

SYS@hfzcdb> startup
ORACLE instance started.

Total System Global Area 2466247680 bytes
Fixed Size                  8942592 bytes
Variable Size             973078528 bytes
Database Buffers         1476395008 bytes
Redo Buffers                7831552 bytes
Database mounted.
Database opened.


##  执行 datapatch 更新数据库
[oracle@hfzcdb91:/backup/36878697]$/oracle/app/oracle/product/19c/db_1/OPatch/datapatch -verbose
SQL Patching tool version 19.25.0.0.0 Production on Fri Dec  6 17:14:27 2024
Copyright (c) 2012, 2024, Oracle.  All rights reserved.

Log file for this invocation: /oracle/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_53308_2024_12_06_17_14_27/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:
Interim patch 30805684 (OJVM RELEASE UPDATE: 19.7.0.0.200414 (30805684)):
  Binary registry: Not installed
  SQL registry: Applied successfully on 27-OCT-24 07.01.18.209121 PM
Interim patch 36878697 (OJVM RELEASE UPDATE: 19.25.0.0.241015 (36878697)):
  Binary registry: Installed
  SQL registry: Not installed

Current state of release update SQL patches:
  Binary registry:
    19.25.0.0.0 Release_Update 241010184253: Installed
  SQL registry:
    Applied 19.7.0.0.0 Release_Update 200404035018 successfully on 27-OCT-24 06.51.42.945421 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  The following interim patches will be rolled back:
    30805684 (OJVM RELEASE UPDATE: 19.7.0.0.200414 (30805684))
  Patch 36912597 (Database Release Update : 19.25.0.0.241015 (36912597)):
    Apply from 19.7.0.0.0 Release_Update 200404035018 to 19.25.0.0.0 Release_Update 241010184253
  The following interim patches will be applied:
    36878697 (OJVM RELEASE UPDATE: 19.25.0.0.241015 (36878697))

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

Validating logfiles...done
Patch 30805684 rollback: SUCCESS
  logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/30805684/23401476/30805684_rollback_HFZCDB_2024Dec06_17_15_46.log (no errors)
Patch 36912597 apply: SUCCESS
  logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/36912597/25871884/36912597_apply_HFZCDB_2024Dec06_17_16_57.log (no errors)
Patch 36878697 apply: SUCCESS
  logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/36878697/25797620/36878697_apply_HFZCDB_2024Dec06_17_16_56.log (no errors)
SQL Patching tool complete on Fri Dec  6 17:23:28 2024
[oracle@hfzcdb91:/backup/36878697]$

3.6. 编译无效对象

升级过程中可能导致某些对象失效,所以需要重编译:

[oracle@hfzcdb91:/backup/36878697]$sqlplus / as sysdba @?/rdbms/admin/utlrp.sql

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Dec 6 17:25:16 2024
Version 19.25.0.0.0

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


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


Session altered.


TIMESTAMP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2024-12-06 17:25:16

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              2024-12-06 17:25:22

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
-------------------
                 54

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.

查看数据库补丁升级的版本:

SYS@hfzcdb> select action,comments from registry$history;

ACTION                         COMMENTS
------------------------------ ------------------------------
BOOTSTRAP                      RDBMS_19.25.0.0.0DBRU_LINUX.X6
                               4_241010

RU_APPLY                       Patch applied on 19.3.0.0.0: R
                               elease_Update - 190410122720

RU_APPLY                       Patch applied from 19.3.0.0.0
                               to 19.7.0.0.0: Release_Update
                               - 200404035018

jvmpsu.sql                     RAN jvmpsu.sql
APPLY                          OJVM RU post-install
jvmpsu.sql                     RAN jvmpsu.sql
ROLLBACK                       OJVM RU post-deinstall
jvmpsu.sql                     RAN jvmpsu.sql
APPLY                          OJVM RU post-install
RU_APPLY                       Patch applied from 19.7.0.0.0
                               to 19.25.0.0.0: Release_Update
                                - 241010184253


10 rows selected.

列出补丁升级的内容,内容较多,只列出了一部分:

[oracle@hfzcdb91:/backup/36878697]$/oracle/app/oracle/product/19c/db_1/OP

[oracle@hfzcdb91:/backup/36878697]$/oracle/app/oracle/product/19c/db_1/OPatch/opatch lsinventory |more
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/19c/db_1
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.44
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2024-12-06_17-29-36PM_1.log

Lsinventory Output file location : /oracle/app/oracle/product/19c/db_1/cfgtoollogs/opatch/lsinv/lsinventory2024-12-06_17-29-36PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: hfzcdb91
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Database 19c                                                  19.0.0.0.0
There are 1 products installed in this Oracle Home.


Interim patches (3) :

Patch  36878697     : applied on Fri Dec 06 17:08:36 CST 2024
Unique Patch ID:  25797620
Patch description:  "OJVM RELEASE UPDATE: 19.25.0.0.241015 (36878697)"
   Created on 24 Sep 2024, 07:15:03 hrs UTC
   Bugs fixed:
     12565410, 12949919, 14112098, 15897884, 16799766, 17443054, 18759260
     19397646, 20875943, 22037067, 22873666, 23614160, 24701882, 25173172
     25881271, 26716835, 27015468, 28127287, 28209601, 28674263, 28777073
     28852334, 29224710, 29254623, 29372173, 29415774, 29445548, 29512125
     29540327, 29540831, 29707582, 29774362, 29942275, 29997959, 30134746
     30160625, 30408443, 30534662, 30674373, 30796980, 30855101, 30889443
     30895577, 31247838, 31306261, 31311732, 31335142, 31359215, 31395708
     31494420, 31668872, 31727233, 31776121, 31844357, 32032733, 32069696
     32124570, 32165759, 32167592, 32327208, 32523206, 32587721, 32892883
     33184467, 33223248, 33427267, 33563137, 33613833, 33805155, 33822881
     33863611, 33872610, 34006650, 34022133, 34149263, 34346865, 34450366
     34461697, 34473578, 34533150, 34604941, 34699616, 34786432, 34817208
     35021301, 35099674, 35239280, 35240410, 35309432, 35354098, 35355058
     35397949, 35480672, 35717077, 35806962, 35949725, 36021678, 36138120
     36210227, 36260537, 36365931, 36368005, 36405296, 36533029, 36686958
     36761847, 36866733, 37065931

Patch  36912597     : applied on Fri Dec 06 16:48:18 CST 2024
Unique Patch ID:  25871884
Patch description:  "Database Release Update : 19.25.0.0.241015 (36912597)"
   Created on 11 Oct 2024, 06:47:24 hrs UTC
   Bugs fixed:
     10121473, 10123661, 1297945, 14570574, 14735102, 15878434, 15931756
     15959416, 16662822, 16664572, 16750494, 17275499, 17395507, 17428816
     17468475, 17562236, 17777718, 18534283, 18697534, 18943905, 19080742
     19138896, 19147630, 19226753, 19630878, 19697993, 19884953, 19958239
     20007421, 20044584, 20083476, 20289608, 20313356, 20319830, 20479545
     20661314, 20721183, 20867658, 20922160, 21119541, 21217621, 21232786
     21245711, 21374587, 21528318, 21533734, 21629064, 21639146, 21888352
     21965541, 22066547, 22252368, 22325312, 22387320, 22553815, 22580355
     22599382, 22725871, 22729345, 22748979, 22813401, 23020668, 23066463
     23094775, 23125587, 23220873, 23294761, 23296836, 23311885, 23606241
     23645975, 23734075, 23734111, 23763462, 24336782, 24356932, 24408754
     24559425, 24561942, 24596874, 24597536, 24669730, 24673201, 24687075
......
     36816302, 36822350, 36844157, 36847318, 36850140, 36852920, 36860479
     36885853, 36903861, 36905385, 36905587, 36908826, 36916250, 36927520
     36928879, 36942226, 36943142, 36955210, 36958975, 36982498, 36988585
     36995477, 37010561, 37034448, 37048709, 37057169, 37078302, 37081891
     37097367, 37110446, 37156413, 7391838, 8460502, 8476681, 9002767

Patch  29585399     : applied on Thu Apr 18 15:21:33 CST 2019
Unique Patch ID:  22840393
Patch description:  "OCW RELEASE UPDATE 19.3.0.0.0 (29585399)"
   Created on 9 Apr 2019, 19:12:47 hrs PST8PDT
   Bugs fixed:
     27222128, 27572040, 27604329, 27760043, 27877830, 28302580, 28470673
     28621543, 28642469, 28699321, 28710663, 28755846, 28772816, 28785321
     28800508, 28808652, 28815557, 28847541, 28847572, 28870496, 28871040
     28874416, 28877252, 28881191, 28881848, 28888083, 28911140, 28925250
     28925460, 28935956, 28940472, 28942694, 28951332, 28963036, 28968779
     28980448, 28995287, 29003207, 29003617, 29016294, 29018680, 29024876
     29026154, 29027933, 29047127, 29052850, 29058476, 29111631, 29112455
     29117337, 29123444, 29125708, 29125786, 29129476, 29131772, 29132456
     29139727, 29146157, 29147849, 29149170, 29152603, 29152752, 29154631
     29154636, 29154829, 29159216, 29159661, 29160462, 29161923, 29169540
     29169739, 29170717, 29173618, 29181568, 29182920, 29183298, 29186091
     29191827, 29201143, 29201695, 29209545, 29210577, 29210610, 29210624
     29210683, 29213641, 29219627, 29224294, 29225861, 29229839, 29235934
     29242906, 29243749, 29244495, 29244766, 29244968, 29248723, 29249583
     29251564, 29255616, 29260224, 29261695, 29271019, 29273360, 29282090
     29282666, 29285453, 29285621, 29290235, 29292232, 29293806, 29294753
     29299830, 29307090, 29307109, 29311336, 29329675, 29330791, 29339299
     29357821, 29360467, 29360775, 29367971, 29368725, 29379299, 29379381
     29380527, 29381000, 29382296, 29391301, 29393649, 29402110, 29411931
     29413360, 29457319, 29465047, 3



--------------------------------------------------------------------------------

OPatch succeeded.

3.7. 回退 RU 补丁

这里适当介绍一下 RU 补丁的回退步骤,一般适用于升级后应用出现问题无法访问的情况:

opatch rollback -id 35943157

同样的,需要先关闭数据库以及监听等 oracle 相关的资源,然后备份 ORACLE_HOME 之后,执行以上命令进行回退,回退成功之后,再次执行 datapatch 操作。

相关推荐
O(1)的boot9 分钟前
微服务的问题
java·数据库·微服务
骐骥140 分钟前
PostgreSQL/PostGIS中提升空间查询(分析)性能(效率)的一些方法
数据库·postgresql·postgis·空间分析·空间查询
jikuaidi6yuan1 小时前
并行口的基本概念
数据库·mongodb
web136885658711 小时前
Spring Boot 中使用 @Transactional 注解配置事务管理
数据库·spring boot·sql
骷大人2 小时前
mysql开启配置binlog
数据库·mysql
Yolo_nn2 小时前
MySQL_第14章_存储过程与函数
数据库·mysql·存储过程·函数
GDDGHS_2 小时前
Flink自定义数据源
大数据·数据库·flink
Milk夜雨3 小时前
数据库进阶教程:结合编程实现动态数据操作
数据库·python·adb
weisian1513 小时前
Redis篇-5--原理篇4--Lua脚本
数据库·redis·lua
是十一月末3 小时前
Linux的基本功能和命令
linux·服务器·开发语言·数据库