1. 查看当前数据库版本信息
[oracle@oracle19c ~]$ cd $ORACLE_HOME
[oracle@oracle19c dbhome_1]$ ./OPatch/opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)
2. 替换Opatch
[root@oracle19c patch]# cd /opt/sws/
[root@oracle19c sws]# ll
total 1850188
-rwxr-x--- 1 root root 1769419773 Sep 9 19:07 p35320081_190000_Linux-x86-64.zip
-rwxr-x--- 1 root root 125167420 Sep 9 19:07 p6880880_190000_Linux-x86-64.zip
[root@oracle19c sws]# chown oracle.oinstall p*
[oracle@oracle19c dbhome_1]$ mv OPatch OPatch.bak
[oracle@oracle19c dbhome_1]$ unzip /opt/sws/p6880880_190000_Linux-x86-64.zip
[oracle@oracle19c dbhome_1]$ ls |grep OPatch
OPatch
OPatch.bak
[oracle@oracle19c dbhome_1]$ ./OPatch/opatch version
OPatch Version: 12.2.0.1.39
OPatch succeeded.
3. 关闭数据库监听和实例
[oracle@oracle19c dbhome_1]$ lsnrctl stop
SQL>shudown immediate;
#如果不关闭实例会报如下的错误
[oracle@oracle19c 35320081]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.39
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /opt/oracle/product/19c/dbhome_1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/19c/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.39
OUI version : 12.2.0.7.0
Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-09-09_19-21-33PM_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 :/opt/oracle/product/19c/dbhome_1
/opt/oracle/product/19c/dbhome_1/bin/oracle
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-09-09_19-21-33PM_1.log
OPatch failed with error code 73
4. 打补丁
[root@oracle19c sws]# cd /opt/sws/
[root@oracle19c sws]# unzip p35320081_190000_Linux-x86-64.zip
[root@oracle19c sws]# chown -R oracle.oinstall 35320081
[root@oracle19c sws]# su - oracle
[oracle@oracle19c ~]$ cd /opt/sws/35320081/
[oracle@oracle19c 35320081]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -ph ./
[oracle@oracle19c 35320081]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
[oracle@oracle19c 35320081]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.39
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /opt/oracle/product/19c/dbhome_1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/19c/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.39
OUI version : 12.2.0.7.0
Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-09-09_19-25-53PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 35320081
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 = '/opt/oracle/product/19c/dbhome_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '35320081' to OH '/opt/oracle/product/19c/dbhome_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 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.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] 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.blaslapack, 19.0.0.0.0...
Patching component oracle.buildtools.rsf, 19.0.0.0.0...
… … …
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.rdbms.hs_common, 19.0.0.0.0...
Patching component oracle.odbc, 19.0.0.0.0...
Patching component oracle.precomp.lang, 19.0.0.0.0...
Patching component oracle.precomp.common, 19.0.0.0.0...
Patching component oracle.jdk, 1.8.0.201.0...
Patch 35320081 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [35320081].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-09-09_19-25-53PM_1.log
OPatch succeeded.
5. 查看补丁
[oracle@oracle19c 35320081]$ $ORACLE_HOME/OPatch/opatch lspatches
35320081;Database Release Update : 19.20.0.0.230718 (35320081)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
6. 启动数据库
[oracle@oracle19c 35320081]$ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup
7. Post-patch操作
a. 运行datapatch
[oracle@oracle19c 35320081]$ cd $ORACLE_HOME/OPatch
[oracle@oracle19c OPatch]$ ./datapatch -verbose
b. 检查日志是否有错
c. 编译无效对象
i. 普通数据库执行编译无效对象
cd $ORACLE_HOME/rdbms/admin
SQL>@utlrp.sql
ii. 可插拔数据库revalidate 无效对象
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
d. 更新rman catalog
$ rman catalog system/oracle@alias
RMAN> UPGRADE CATALOG;
RMAN> UPGRADE CATALOG;
RMAN> EXIT;
标签:RU,oracle19c,19.0,dbhome,0.0,OPatch,oracle,打补丁,Oracle
From: https://blog.51cto.com/ablewang/12038932