作者 | JiekeXu

来源 | JiekeXu DBA之路(ID: JiekeXu_IT)

大家好,我是 JiekeXu,很高兴又和大家见面了,今天和大家聊聊 Oracle 19c RU 升级的事,欢迎点击上方蓝字关注我,标星或置顶,更多干货第一时间到达!

1、  补丁包准备及说明

关于补丁升级已经写过好多文章了,全部都是 11204 版本的,尤其是 RAC 11204 AIX 环境下打 190716 的补丁值得推荐给大家,感兴趣的可以去墨天轮瞅瞅【https://www.modb.pro/doc/4638】,不过没有 19c 相关的文章,这里就简单写写吧,如下是下载的补丁包,关于如何查找及下载补丁包,之前已经有介绍过了,这里不在多说,有问题的可阅读文末相关文章查看。关于补丁包可在下方公众号【数据库江湖】后台回复【GIRU20210119】获取。

p32126842_190000_Linux-x86-64.zip
p6880880_122010_Linux-x86-64.zip


如果opatch 命令不可用,需要配置环境变量
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

RU 32126842 包含 GI  和 OJVM 是一个大补丁集,适用于安装了 OCW 和 OJVM 的 RAC 环境,当然也适用于单实例环境。里面包含 DB 补丁 32218454,这个可以从同级目录下 README.html  文件看出来。还有值得注意的是惠普和 Linuxone 系统不适用 ACFS,DBWLM and TOMCAT “ACFS, DBWLMand TOMCAT subpatches are not applicable to the HP-UX Itanium and Linux on IBMSystem z platforms” 安装补丁时请仔细阅读 readme 文档。

补丁包单机环境使用 Oracle 用户解压,RAC 环境一定要使用 grid  用户解压。

 

查看操作系统版本

[oracle@JiekeXu etc]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4(Maipo)
[oracle@JiekeXu etc]$ free -m
              total        used        free      shared buff/cache   available
Mem:           7822         882         263       2740        6676        3889
Swap:          8191           0        8191


[oracle@JiekeXu soft]$ ls -l
total 3238640
drwxrwxrwx 4 oracle oinstall         80 Jan19 21:42 32126842
drwxr-x--- 15 oracle oinstall       4096 Feb 1 18:47 OPatch
-rwxrwxrwx 1 oracle oinstall 3194762691 Feb 10 12:56p32126842_190000_Linux-x86-64.zip
-rwxrwxrwx 1 oracle oinstall  120761121 Mar10 17:01 p6880880_122010_Linux-x86-64.zip
-rw-rw-r-- 1 oracle oinstall     831586 Jan20 00:20 PatchSearch.xml

2、  补丁执行的总体步骤

总体步骤也很简单,备份家目录,替换 opatch,oracleinventory 验证、空间检测,补丁冲突检测,补丁分析,应用补丁等七大步骤。后续步骤将根据这七步进行。

 

3、  家目录备份

 

因为补丁安装针对的是 Oracle  家目录下文件的替换,故需要将家目录文件做一个备份。为了保证备份的文件可用,建议将数据库停止后做备份,RAC 集群时建议停止集群件备份,当出现不能解决的问题时可以将备份的 ORACLE_HOME 目录还原,可正常启动集群件。

[oracle@JiekeXu32126842]$  sqlplus / as sysdba


SQL*Plus:Release 19.0.0.0.0 - Production on Sun Mar 14 11:56:00 2021
Version19.3.0.0.0


Copyright(c) 1982, 2019, Oracle.  All rightsreserved.


Connectedto:
OracleDatabase 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version19.3.0.0.0


SYS@JiekeCDB>shu immediate
Databaseclosed.
Databasedismounted.
ORACLEinstance shut down.
SYS@JiekeCDB>exit
Disconnectedfrom Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version19.3.0.0.0
[oracle@JiekeXu32126842]$ echo $ORACLE_HOME
/opt/oracle/product/19c/dbhome_1
--使用root 用户进行家目录备份
[oracle@JiekeXu opt]# tar  -zcvf  /opt/oracle.tar.gz  /opt/oracle

 

注意:当你的数据库运行了好久时,进行家目录备份时需要对其下的小文件进行清理工作,尤其是审计 audit 目录,如果有上万个小文件会对你的备份时长造成致命的打击。可直接删除 audit 目录然后新建,或者遍历删除,由于此目录快速增长 inode  耗尽导致数据库不可登陆的问题也是屡见不鲜,之前有篇文章,可点此查看处理办法

 

4、  OPatch 替换

 

Readme 文档中要求 OParch 版本为 12.2.0.1.23 及以后的版本,故需要替换为新的 OParch ,这里新下载的是12.2.0.1.24.

[oracle@JiekeXuOPatch]$ cd $ORACLE_HOME/OPatch
[oracle@JiekeXuOPatch]$ ./opatch version
OPatch Version:12.2.0.1.17
OPatchsucceeded.
[oracle@JiekeXuOPatch]$ cd ..
[oracle@JiekeXudbhome_1]$ mv OPatch/ OPatch_bak17
[oracle@JiekeXudbhome_1]$ cp -r /home/oracle/soft/OPatch/ ./
[oracle@JiekeXudbhome_1]$ ls -lh OPatch
[oracle@JiekeXudbhome_1]$ pwd
/opt/oracle/product/19c/dbhome_1
[oracle@JiekeXudbhome_1]$ cd OPatch
[oracle@JiekeXuOPatch]$ ./opatch version
OPatchVersion: 12.2.0.1.24
OPatchsucceeded.

注意:如果是 RAC 集群环境,包括两节点GI_HOME的所有目录均要替换。

 

5、oracle inventory 验证

 

$ <ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh<ORACLE_HOME>

[oracle@JiekeXu OPatch]$ ./opatch lsinv

如果是 RAC 环境分别指定 $GI_HOME 和 $ORACLE_HOME

opatch lspatches 检查版本以及现有安装的补丁。

 

 

6、  空间检测

 

 

当你的家目录剩余空间大于 20G 的时候,这一步可以省略,下图是我 AIX 6.1 环境下的空间检测截图,空间剩余 7.74G,当剩余空间小于 12745.939M 时空间检测就会失败。故空间大于 20G 无忧。

 

 

我目前的 ORACLE_HOME 剩余目录为 41 G,可以满足要求,

[oracle@JiekeXu OPatch]$ df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   71G  31G   41G  43% /
devtmpfs               3.9G     0 3.9G   0% /dev
tmpfs                  3.9G   12K 3.9G   1% /dev/shm
tmpfs                  3.9G  297M 3.6G   8% /run
tmpfs                  3.9G     0 3.9G   0% /sys/fs/cgroup
/dev/sda2             1014M  143M 872M  15% /boot
/dev/mapper/rhel-home   60G 9.1G   51G  16% /home
tmpfs                  783M    0  783M   0% /run/user/0


cat /tmp/patch_list_dbhome.txt
/home/oracle/soft/32126842/32226239/32218454
/home/oracle/soft/32126842/32226239/32222571
[oracle@JiekeXu 32226239]$ pwd
/home/oracle/soft/32126842/32226239
[oracle@JiekeXu 32226239]$ $ORACLE_HOME/OPatch/opatchprereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
Oracle Interim Patch Installer version12.2.0.1.24
Copyright (c) 2021, OracleCorporation.  All rights reserved.


PREREQ session


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.24
OUI version       : 12.2.0.7.0
Log file location :/opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_19-34-34PM_1.log


Invoking prereq"checksystemspace"


Prereq "checkSystemSpace" passed.


OPatch succeeded.

注意:当为 RAC 时 GI home  和 db_home 均需要检测。

 

7、  补丁冲突检测

 

冲突检测是必须做的一项,当你的系统有一些 one-off 小补丁时,则需要进行补丁冲突检测,防止打补丁失败,我这里是使用 prm 包直接安装的 19.3 新环境,无其他小补丁,可正常检测通过。关于 19.3 rpm 包安装请点击这里查看

 

 

$ORACLE_HOME/OPatch/opatch prereqCheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/soft/32126842/32226239/32218454
$ORACLE_HOME/OPatch/opatch prereqCheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/soft/32126842/32226239/32222571

注意:如果你的是 RAC 环境,GI home  和 DB home 均需要检测按照 readme 里七条均需要检测。

 

8、  补丁分析

 

#GRID_HOME/OPatch/opatchauto apply <UNZIPPED_PATCH_LOCATION>/32226239 -analyze


 

注意:这里需要 root 用户分析GI_HOME 即可

JiekeXu1:/u01/app/19.0.0.0/grid# /u01/app/19.0.0.0/grid/OPatch/opatchauto apply /u01/soft/32126842/32226239/ -analyze

 

9、  应用补丁

 

如果是单实例环境,需要停实例和监听,然后使用 opatch apply 打补丁,当为 RAC 时可直接 opatchauto apply。

[oracle@JiekeXu32218454]$ lsnrctl stop
[oracle@JiekeXu32218454]$ lsnrctl stat


LSNRCTLfor Linux: Version 19.0.0.0.0 - Production on 14-MAR-2021 20:52:44


Copyright(c) 1991, 2019, Oracle.  All rightsreserved.


Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.139.79.29)(PORT=1521)))
TNS-12541:TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=JiekeXu)(PORT=11521)))
TNS-12541:TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541:TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
[oracle@JiekeXu32218454]$ pwd
/home/oracle/soft/32126842/32226239/32218454
[oracle@JiekeXu32218454]$ ll
total 84
drwxr-x---  3 oracle oinstall    21 Jan 17 02:27 custom
drwxr-x---  3 oracle oinstall    20 Jan 17 02:27 etc
drwxr-x---38 oracle oinstall  4096 Jan 17 02:21files
-rw-r--r--  1 oracle oinstall 75268 Jan 17 02:27README.html
-rw-r--r--  1 oracle oinstall    21 Jan 17 02:27 README.txt
[oracle@JiekeXu32218454]$ $ORACLE_HOME/OPatch/opatch apply


OracleInterim Patch Installer version 12.2.0.1.24
Copyright(c) 2021, Oracle Corporation.  All rightsreserved.




OracleHome       :/opt/oracle/product/19c/dbhome_1
CentralInventory : /opt/oracle/oraInventory
   from           :/opt/oracle/product/19c/dbhome_1/oraInst.loc
OPatchversion    : 12.2.0.1.24
OUIversion       : 12.2.0.7.0
Log filelocation : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_20-52-53PM_1.log


Verifyingenvironment and performing prerequisite checks...
OPatchcontinues with these patches:  32218454 


Do youwant to proceed? [y|n]
Could notrecognize input. Please re-enter.
y
UserResponded with: Y
Allchecks passed.


Pleaseshutdown Oracle instances running out of this ORACLE_HOME on the local system.
(OracleHome = '/opt/oracle/product/19c/dbhome_1')




Is thelocal system ready for patching? [y|n]
y
User Respondedwith: Y
Backingup files...
Applyinginterim patch '32218454' 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.net.cman, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [oracle.oid.client, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [oracle.options.olap, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [oracle.jdk, 1.8.0.191.0 ]  not present inthe Oracle Home or a higher version is found.


Patchingcomponent oracle.rdbms, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.rsf, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.util, 19.0.0.0.0...


Patching componentoracle.assistants.acf, 19.0.0.0.0...


Patchingcomponent oracle.assistants.deconfig, 19.0.0.0.0...


Patchingcomponent oracle.assistants.server, 19.0.0.0.0...


Patchingcomponent oracle.buildtools.rsf, 19.0.0.0.0...


Patchingcomponent oracle.ctx, 19.0.0.0.0...


Patchingcomponent oracle.dbjava.ic, 19.0.0.0.0...


Patchingcomponent oracle.dbjava.jdbc, 19.0.0.0.0...


Patchingcomponent oracle.dbjava.ucp, 19.0.0.0.0...


Patchingcomponent oracle.dbtoolslistener, 19.0.0.0.0...


Patchingcomponent oracle.ldap.owm, 19.0.0.0.0...


Patchingcomponent oracle.ldap.rsf, 19.0.0.0.0...


Patchingcomponent oracle.network.rsf, 19.0.0.0.0...


Patchingcomponent oracle.oracore.rsf, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.dbscripts, 19.0.0.0.0...


Patching componentoracle.rdbms.deconfig, 19.0.0.0.0...


Patchingcomponent oracle.sdo, 19.0.0.0.0...


Patchingcomponent oracle.sdo.locator.jrf, 19.0.0.0.0...


Patchingcomponent oracle.sqlplus, 19.0.0.0.0...


Patchingcomponent oracle.xdk, 19.0.0.0.0...


Patchingcomponent oracle.marvel, 19.0.0.0.0...


Patchingcomponent oracle.xdk.rsf, 19.0.0.0.0...


Patchingcomponent oracle.ctx.atg, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.scheduler, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.lbac, 19.0.0.0.0...


Patchingcomponent oracle.duma, 19.0.0.0.0...


Patchingcomponent oracle.ldap.rsf.ic, 19.0.0.0.0...


Patchingcomponent oracle.odbc, 19.0.0.0.0...


Patchingcomponent oracle.ctx.rsf, 19.0.0.0.0...


Patchingcomponent oracle.oraolap.api, 19.0.0.0.0...


Patchingcomponent oracle.xdk.parser.java, 19.0.0.0.0...


Patchingcomponent oracle.oraolap, 19.0.0.0.0...


Patchingcomponent oracle.sdo.locator, 19.0.0.0.0...


Patchingcomponent oracle.sqlplus.ic, 19.0.0.0.0...


Patchingcomponent oracle.mgw.common, 19.0.0.0.0...


Patchingcomponent oracle.ons, 19.0.0.0.0...


Patchingcomponent oracle.dbdev, 19.0.0.0.0...


Patchingcomponent oracle.network.listener, 19.0.0.0.0...


Patchingcomponent oracle.nlsrtl.rsf, 19.0.0.0.0...


Patchingcomponent oracle.ovm, 19.0.0.0.0...


Patchingcomponent oracle.oraolap.dbscripts, 19.0.0.0.0...


Patchingcomponent oracle.xdk.xquery, 19.0.0.0.0...


Patchingcomponent oracle.precomp.rsf, 19.0.0.0.0...


Patchingcomponent oracle.javavm.client, 19.0.0.0.0...


Patchingcomponent oracle.precomp.common.core, 19.0.0.0.0...


Patchingcomponent oracle.ldap.security.osdt, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.oci, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.rman, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.crs, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.install.common, 19.0.0.0.0...


Patchingcomponent oracle.javavm.server, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.drdaas, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.install.plugins, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.dv, 19.0.0.0.0...


Patchingcomponent oracle.ldap.client, 19.0.0.0.0...


Patchingcomponent oracle.network.client, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.rsf.ic, 19.0.0.0.0...


Patchingcomponent oracle.precomp.common, 19.0.0.0.0...


Patchingcomponent oracle.precomp.lang, 19.0.0.0.0...


Patchingcomponent oracle.jdk, 1.8.0.201.0...
Patch32218454 successfully applied.
Sub-setpatch [29517242] has become inactive due to the application of a super-setpatch [32218454].
Pleaserefer to Doc ID 2161861.1 for any possible further required actions.
Log filelocation:/opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_20-52-53PM_1.log


OPatchsucceeded.
[oracle@JiekeXu 32218454]$

 

OJVM 补丁应用

 

当实例启动时 OJVM 补丁执行会失败,故需要关闭实例。

[oracle@JiekeXu32067171]$ pwd
/home/oracle/soft/32126842/32067171
[oracle@JiekeXu32067171]$ $ORACLE_HOME/OPatch/opatch apply
OracleInterim Patch Installer version 12.2.0.1.24
Copyright(c) 2021, Oracle Corporation.  All rightsreserved.




OracleHome       :/opt/oracle/product/19c/dbhome_1
CentralInventory : /opt/oracle/oraInventory
   from           :/opt/oracle/product/19c/dbhome_1/oraInst.loc
OPatchversion    : 12.2.0.1.24
OUIversion       : 12.2.0.7.0
Log filelocation :/opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_21-50-38PM_1.log


Verifyingenvironment and performing prerequisite checks...
Prerequisitecheck "CheckActiveFilesAndExecutables" failed.
Thedetails are:




Followingactive executables are not used by opatch process :
/opt/oracle/product/19c/dbhome_1/bin/oracle


Followingactive executables are used by opatch process :


UtilSessionfailed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log filelocation: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_21-50-38PM_1.log


OPatch failed with error code 73


[oracle@JiekeXu32067171]$ $ORACLE_HOME/OPatch/opatch apply
OracleInterim Patch Installer version 12.2.0.1.24
Copyright(c) 2021, Oracle Corporation.  All rightsreserved.




OracleHome       :/opt/oracle/product/19c/dbhome_1
CentralInventory : /opt/oracle/oraInventory
   from           :/opt/oracle/product/19c/dbhome_1/oraInst.loc
OPatchversion    : 12.2.0.1.24
OUIversion       : 12.2.0.7.0
Log filelocation :/opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_21-53-32PM_1.log


Verifyingenvironment and performing prerequisite checks...


--------------------------------------------------------------------------------
Start OOPby Prereq process.
LaunchOOP...


OracleInterim Patch Installer version 12.2.0.1.24
Copyright(c) 2021, Oracle Corporation.  All rightsreserved.




OracleHome       :/opt/oracle/product/19c/dbhome_1
CentralInventory : /opt/oracle/oraInventory
   from           :/opt/oracle/product/19c/dbhome_1/oraInst.loc
OPatchversion    : 12.2.0.1.24
OUIversion       : 12.2.0.7.0
Log filelocation :/opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_21-53-44PM_1.log


Verifyingenvironment and performing prerequisite checks...
OPatchcontinues with these patches:  32067171 


Do youwant to proceed? [y|n]
y
UserResponded with: Y
Allchecks passed.


Pleaseshutdown Oracle instances running out of this ORACLE_HOME on the local system.
(OracleHome = '/opt/oracle/product/19c/dbhome_1')




Is thelocal system ready for patching? [y|n]
y
UserResponded with: Y
Backingup files...
Applyinginterim patch '32067171' to OH '/opt/oracle/product/19c/dbhome_1'


Patchingcomponent oracle.javavm.server, 19.0.0.0.0...


Patchingcomponent oracle.javavm.server.core, 19.0.0.0.0...


Patchingcomponent oracle.rdbms.dbscripts, 19.0.0.0.0...


Patchingcomponent oracle.rdbms, 19.0.0.0.0...


Patchingcomponent oracle.javavm.client, 19.0.0.0.0...
Patch32067171 successfully applied.
Log filelocation:/opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2021-03-14_21-53-44PM_1.log


OPatch succeeded.
--== OJVM 也需要跑 datapatch 脚本

注意:如何是 RAC 直接使用 root 用户自动打补丁

但是要注意的是由于BUG 29859410 该问题是由于在安装19c GI 时生成的本地 oui-patch.xml 权限存在问题,并且没有生成远程节点的 oui-patch.xml 文件,在打补丁的过程中从节点1拷贝的文件存在权限不正确的问题,会导致对除节点1之外的节点打补丁失败,在 20.1 版本修复该问题。因此,我们在19c上打 RU 时需要提前准备好 oui-patch.xml 文件。

grid@Jiekexu2:/u01/app/oraInventory/ContentsXML>scp -p Jiekexu1:/u01/app/oraInventory/ContentsXML/oui-patch.xml .
oui-patch.xml                                                                                                    100%  174    0.2KB/s   00:00
grid@Jiekexu2:/u01/app/oraInventory/ContentsXML> chmod 660 oui-patch.xml
grid@Jiekexu2:/u01/app/oraInventory/ContentsXML> chown grid:oinstall oui-patch.xml
grid@Jiekexu2:/u01/app/oraInventory/ContentsXML> ls -l
total 16
-rw-rw---- 1 grid oinstall 300 Dec 10 10:17 comps.xml
-rw-rw---- 1 grid oinstall 567 Dec 10 10:17inventory.xml
-rw-rw---- 1 grid oinstall 292 Dec 10 10:17 libs.xml
-rw-rw---- 1 grid oinstall 174 Dec10 10:14 oui-patch.xml


然后 root 用户两节点分别执行以下命令可自动打补丁
#/u01/app/19.0.0.0/grid/OPatch/opatchauto apply /u01/soft/32126842/32226239/ 

10、开库执行 datapatch 脚本

[oracle@JiekeXu32222571]$ sqlplus / as sysdba


SQL*Plus:Release 19.0.0.0.0 - Production on Sun Mar 14 21:23:04 2021
Version19.10.0.0.0


Copyright(c) 1982, 2020, Oracle.  All rightsreserved.


Connectedto an idle instance.


SYS@JiekeCDB>startup
ORACLEinstance started.


TotalSystem Global Area 2466250392 bytes
FixedSize                  9137816 bytes
VariableSize             620756992 bytes
DatabaseBuffers         1828716544 bytes
Redo Buffers                7639040 bytes
Databasemounted.
Databaseopened.
SYS@JiekeCDB>show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------------------------------------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JIEKEPDB                       MOUNTED
         5 JIEKEPDB1                      MOUNTED
--打开所有 pdb
SYS@JiekeCDB>alter pluggable database all open;


Pluggabledatabase altered.


SYS@JiekeCDB>show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------------------------------------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JIEKEPDB                       READ WRITE NO
         5 JIEKEPDB1                      READ WRITE NO

--执行 datapatch 脚本
[oracle@JiekeXuOPatch]$ ./datapatch -verbose
SQLPatching tool version 19.10.0.0.0 Production on Sun Mar 14 21:26:36 2021
Copyright(c) 2012, 2020, Oracle.  All rightsreserved.


Log filefor this invocation:/opt/oracle/cfgtoollogs/sqlpatch/sqlpatch_21224_2021_03_14_21_26_36/sqlpatch_invocation.log


Connectingto database...OK
Gatheringdatabase info...done


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


Bootstrappingregistry and package to current versions...done
Determiningcurrent state...done


Currentstate of interim SQL patches:
  No interim patches found


Currentstate of release update SQL patches:
  Binary registry:
    19.10.0.0.0 Release_Update 210108185017:Installed
  PDB CDB$ROOT:
    Applied 19.3.0.0.0 Release_Update190410122720 successfully on 18-JUN-20 02.28.12.207114 PM
  PDB JIEKEPDB:
    Applied 19.3.0.0.0 Release_Update190410122720 successfully on 18-JUN-20 02.33.11.348597 PM
  PDB JIEKEPDB1:
    Applied 19.3.0.0.0 Release_Update190410122720 successfully on 18-JUN-20 02.33.11.348597 PM
  PDB PDB$SEED:
    Applied 19.3.0.0.0 Release_Update190410122720 successfully on 18-JUN-20 02.33.11.348597 PM


Addingpatches to installation queue and performing prereq checks...done
Installationqueue:
  For the following PDBs: CDB$ROOT PDB$SEEDJIEKEPDB JIEKEPDB1
    No interim patches need to be rolled back
    Patch 32218454 (Database Release Update :19.10.0.0.210119 (32218454)):
      Apply from 19.3.0.0.0 Release_Update190410122720 to 19.10.0.0.0 Release_Update 210108185017
    No interim patches need to be applied


Installingpatches...


Patchinstallation complete.  Total patchesinstalled: 4


Validatinglogfiles...done
Patch 32218454apply (pdb CDB$ROOT): SUCCESS
  logfile:/opt/oracle/cfgtoollogs/sqlpatch/32218454/24018797/32218454_apply_JIEKECDB_CDBROOT_2021Mar14_21_27_00.log(no errors)
Patch32218454 apply (pdb PDB$SEED): SUCCESS
  logfile: /opt/oracle/cfgtoollogs/sqlpatch/32218454/24018797/32218454_apply_JIEKECDB_PDBSEED_2021Mar14_21_30_35.log(no errors)
Patch32218454 apply (pdb JIEKEPDB): SUCCESS
  logfile:/opt/oracle/cfgtoollogs/sqlpatch/32218454/24018797/32218454_apply_JIEKECDB_JIEKEPDB_2021Mar14_21_30_34.log(no errors)
Patch32218454 apply (pdb JIEKEPDB1): SUCCESS
  logfile:/opt/oracle/cfgtoollogs/sqlpatch/32218454/24018797/32218454_apply_JIEKECDB_JIEKEPDB1_2021Mar14_21_30_34.log(no errors)
SQL Patching tool complete on Sun Mar 14 21:34:51 2021


--执行 utlrp.sql 编译无效对象
cd $ORACLE_HOME/rdbms/admin/
SYS@JiekeCDB> @utlrp.sql

11、验证补丁是否成功

 

SYS@JiekeCDB>col ACTION for a8
SYS@JiekeCDB>col status for a10
SYS@JiekeCDB>set line 230
SYS@JiekeCDB>col ACTION_TIME for a30
SYS@JiekeCDB>col DESCRIPTION for a60
SYS@JiekeCDB>select patch_id, action,status,action_time,description  from dba_registry_sqlpatch;


  PATCH_ID ACTION   STATUS    ACTION_TIME                   DESCRIPTION
------------------ ---------- ------------------------------ ------------------------------------------------------------
  29517242 APPLY    SUCCESS   18-JUN-20 02.28.12.207114 PM  Database Release Update : 19.3.0.0.190416 (29517242)
  32218454 APPLY    SUCCESS   14-MAR-21 09.34.36.905609 PM  Database Release Update : 19.10.0.0.210119 (32218454)


SYS@JiekeCDB>!$ORACLE_HOME/OPatch/opatch lspatches
32067171;OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)


OPatch succeeded.

检查发现 OCW 还没有更新成功,如果你使用了OCW 故需要单独执行补丁。

[oracle@JiekeXu32226239]$ cd 32222571
[oracle@JiekeXu32222571]$ pwd
/home/oracle/soft/32126842/32226239/32222571
[oracle@JiekeXu32222571]$ ll
total 84
drwxr-x---  3 oracle oinstall    21 Jan 17 02:21 custom
drwxr-x---  3 oracle oinstall    20 Jan 17 02:21 etc
drwxr-x---20 oracle oinstall   217 Jan 17 02:19files
-rw-r--r--  1 oracle oinstall 84079 Jan 17 02:21README.txt
[oracle@JiekeXu32222571]$
[oracle@JiekeXu32222571]$ $ORACLE_HOME/OPatch/opatch apply
OracleInterim Patch Installer version 12.2.0.1.24
Copyright(c) 2021, Oracle Corporation.  All rightsreserved.
Oracle Home       :/opt/oracle/product/19c/dbhome_1

SYS@JiekeCDB>select patch_id, action,status,action_time,description  from dba_registry_sqlpatch;


  PATCH_ID ACTION   STATUS    ACTION_TIME                   DESCRIPTION
------------------ ---------- ------------------------------------------------------------------------------------------
  29517242 APPLY    SUCCESS   18-JUN-20 02.28.12.207114 PM  Database Release Update : 19.3.0.0.190416 (29517242)
  32218454 APPLY    SUCCESS   14-MAR-21 09.34.36.905609 PM  Database Release Update : 19.10.0.0.210119 (32218454)
  32067171 APPLY    SUCCESS   14-MAR-21 10.11.06.457834 PM  OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)
SYS@JiekeCDB>!$ORACLE_HOME/OPatch/opatch lspatches
32222571;OCW Interim patch for 32222571
32067171;OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
OPatchsucceeded.

以上就完成了,建议大家执行补丁时参考补丁解压包里的 readme.html 文档,今天就到这里了,如果此文对您有帮助,欢迎点赞、在看与转发,便是对作者最大的支持。感兴趣的小伙伴们可以动手试试咯,关于数据库安装包 rpm 包和补丁 DBRU 都已经准备好了(包括补丁readme 文档),扫描下方二维码回复关键字【19cRPM包下载】和【GIRU20210119】获取。

其他补丁相关文章链接:

https://mp.weixin.qq.com/s/2DoBV-8PsoYENgwM3BAIaQ

https://mp.weixin.qq.com/s/zS4aE3TfhbMwDk37nIEGfg
https://mp.weixin.qq.com/s/C0YbdGs2SVxqDuTm1g83fw
https://mp.weixin.qq.com/s/0jPYvtfFezGLhq-S-9RqGQ
https://mp.weixin.qq.com/s/Q45cfsRz1Oa4dSzi8_2Ktg
https://www.modb.pro/db/27255
https://www.modb.pro/doc/1602
https://www.modb.pro/doc/4638
https://www.modb.pro/download/39727

————————————————————————————
公众号:JiekeXu DBA之路
墨天轮:https://www.modb.pro/u/4347
CSDN :https://blog.csdn.net/JiekeXu
腾讯云:https://cloud.tencent.com/developer/user/5645107
————————————————————————————

Oracle 12c 及以上版本补丁更新说明及下载方法(收藏版)

一线运维 DBA 五年经验常用 SQL 大全(一)

一线运维 DBA 五年经验常用 SQL 大全(二)

Oracle 21C 新特性:数据泵相关新特性汇总

震惊:Oracle 11gR2 RAC ADG 并没有高可用

如何通过 Shell 监控异常等待事件和活跃会话 

Oracle 12C 最新补丁下载与安装操作指北

DBA 常用的软件工具有哪些(分享篇)?

Oracle 每日一题系列合集

百花齐放的国产数据库

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐