oracle 补丁下载,更新相关的文章已经介绍过多篇了,从 11g 单机,rac 到 19c 均有涉及,今天应该是这个系列的最后一篇文章介绍了,也来说说 linux7 下的 oracle 19c rac ru15 补丁更新详细步骤,其他 ru 更新步骤均一样,都可以从 19.3 更新到最新的 ru,也可以在 ru15 的基础上更新最新的 ru17。值得一说的是最新的 ru 已经到 19.17 了,前面一篇文章介绍了今年。
注意:本文已经生成 pdf 文档了,有需要的可使用此链接下载 https://www.modb.pro/doc/79585
这里要注意 ru(release update)和 rur (release update revisions) 的区别:
1.ru 是主动,高度测试,捆绑了许多重要修复,能够使客户避免许多已知问题。
2.rur 包含对 ru 的安全性和回退修复,将 ru 的生命周期延长两个季度。每个 rur 只针对特定的 ru。
release update introduction and faq (文档 id 2285040.1)
assistant: download reference for oracle database/gi update, revision, psu, spu(cpu), bundle patches, patchsets and base releases (文档 id 2118136.2)
但是值得注意的是:从 2022 年 10 月开始,19.17.0 及以上版本将不再提供 19c rur。在 2023 年 1 月 oracle database 19c rur 19.16.2 发布后,任何平台上都不会发布额外的rur。详情请参阅 19c rurs 的终止及常见问题解答(注2898381.1)。
下面来一起看看 rac 下 ru 补丁更新的两种方法,节点 1 和 节点 2 是两种不同的方法。
下载补丁和 opatch
ru15 下载(包括 gi 和 db 以及 ojvm 补丁包):https://www.modb.pro/download/541101
--19c patch 33803476 - gi release update 19.15.0.0.220419
p33859214_190000_linux-x86-64.zip
opatch 12.2.0.1.30 for db 12.2.0.1.0 (apr 2022)
p6880880_122010_linux-x86-64.zip
上传到 /u01/backup 然后使用 grid 用户解压。
chmod 777 p33859214_190000_linux-x86-64.zip
( asm1)$ unzip p33859214_190000_linux-x86-64.zip
( asm1)$ scp -r 33859214 rac19c-r2:/u01/backup
( asm1)$ scp -r opatch rac19c-r2:/u01/backup
可参考文档:
停止集群件备份家目录
----两节点分别操作
/u01/app/19.0.0/grid/bin/crsctl stop crs
tar -zcvf /u01/app.tar.gz /u01/app
/u01/app/19.0.0/grid/bin/crsctl start crs
两节点 gi、db opatch 替换
----# 表示 root 用户,$ 表示 oracle 用户提示符,(asm1)$ 表示 grid 用户
# cd /u01/app/19.0.0/grid/
# mv opatch opatch.bak19
(asm1)$ unzip p6880880_122010_linux-x86-64.zip
# cp -r opatch /u01/app/19.0.0/grid/
# chown grid:oinstall -r /u01/app/19.0.0/grid/opatch
$ opatch version
opatch version: 12.2.0.1.30
opatch succeeded.
db:
$ cd $oracle_home
$ mv opatch/ opatch_bak19
cp -r /u01/backup/opatch ./
复制 oui-patch.xml 到远程节点 2 注意权限
( asm2)$ cd /u01/app/orainventory/contentsxml/
( asm2)$ scp -p rac19c-r1:/u01/app/orainventory/contentsxml/oui-patch.xml ./
oracle inventory 验证
$ /opatch/opatch lsinventory -detail -oh
如果是 rac 环境分别指定 $gi_home 和 $oracle_home
( asm1)$ opatch lsinventory -detail -oh $oracle_home
(db1)$ opatch lsinventory -detail -oh $oracle_home
( asm2)$ opatch lsinventory -detail -oh $oracle_home
(db2)$ opatch lsinventory -detail -oh $oracle_home
空间检查和补丁冲突检查这里就不做了,因为是新环境,这些都没有问题。 如果有需要可参考我以前的文章或者补丁 readme.html 。
补丁分析
这里一定要看补丁 readme.html 的各个补丁介绍,有的只涉及到 db,有的只涉及到 gi,有的只是 ojvm,例如 33806152 这个补丁则 gi 和 db 都涉及,也是主要补丁;33815596 这个则是 ocw 这个补丁则 gi 和 db 都可以使用;33815607 acfs 补丁,33911149 tomcat 补丁,33575402 补丁,这三个补丁仅在 gi 上适用,且不支持 hp-ux itanium 和 linux on ibm system z 系统,我这里是 rhel7 没有问题。
补丁号 | 描述 | 适用于 |
---|---|---|
33806152 | database release update 19.15.0.0.220419 | both oracle home and grid home |
33815596 | ocw release update 19.15.0.0.220419 | both oracle home and grid home |
33815607 | acfs release update 19.15.0.0.220419 | only grid home |
33911149 | tomcat release update 19.0.0.0.0 | only grid home |
33575402 | tomcat release update 19.0.0.0.0 | only grid home |
使用 root 用户分析补丁 33806152
提前分析补丁,可以避免一些错误,如下检测出来 gi 和 db 的 opatch 版本不一样;注意这里的路径深入到 33803476 即可,不必更深一层,不然就需要如下办法一个个子补丁去分析和单独应用,节点 2 则正常到 33803476 层。
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33806152 -analyze
打补丁分析补丁时,个人建议将连接到操作系统 oracle 或者 grid 用户的会话都退出到 root 或者直接断开,以前遇到过由于有连接导致打补丁失败。下面是一个完整的日志输出,其他补丁日志输出则省略。
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33806152 -analyze
opatchauto session is initiated at wed may 11 10:57:46 2022
system initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2022-05-11_10-57-48am.log.
following home(s) will not be included as part of current opatchauto session as it's software only rac home:
home path:/u01/app/oracle/product/19.0.0/dbhome_1, host:rac19c-r2
session log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2022-05-11_10-58-35am.log
the id for this session is hd5u
executing opatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/dbhome_1
executing opatch prereq operations to verify patch applicability on home /u01/app/19.0.0/grid
patch applicability verified successfully on home /u01/app/19.0.0/grid
patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/dbhome_1
executing patch validation checks on home /u01/app/19.0.0/grid
patch validation checks successfully completed on home /u01/app/19.0.0/grid
executing patch validation checks on home /u01/app/oracle/product/19.0.0/dbhome_1
patch validation checks successfully completed on home /u01/app/oracle/product/19.0.0/dbhome_1
verifying sql patch applicability on home /u01/app/oracle/product/19.0.0/dbhome_1
sql patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/dbhome_1
opatchauto successful.
--------------------------------summary------------------------------
analysis for applying patches has completed successfully:
host:rac19c-r1
crs home:/u01/app/19.0.0/grid
version:19.0.0.0.0
==following patches were successfully analyzed to be applied:
patch: /u01/backup/33859214/33803476/33806152
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_10-58-54am_1.log
host:rac19c-r1
rac home:/u01/app/oracle/product/19.0.0/dbhome_1
version:19.0.0.0.0
==following patches were successfully analyzed to be applied:
patch: /u01/backup/33859214/33803476/33806152
log: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_10-58-55am_1.log
opatchauto session completed at wed may 11 10:59:38 2022
time taken to complete the session 1 minute, 53 seconds
ocw 分析
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33815596 -analyze
--省略日志输出
acfs 补丁分析
[root@rac19c-r1 33803476]# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33815607 -analyze
--省略日志输出
reason: /u01/backup/33859214/33803476/33815607 is not required to be applied to oracle home /u01/app/oracle/product/19.0.0/dbhome_1
tomcat 补丁分析
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33911149 -analyze
--省略日志输出
reason: /u01/backup/33859214/33803476/33911149 is not required to be applied to oracle home /u01/app/oracle/product/19.0.0/dbhome_1
dbwlm 补丁分析
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33575402 -analyze
--省略日志输出
reason: /u01/backup/33859214/33803476/33575402 is not required to be applied to oracle home /u01/app/oracle/product/19.0.0/dbhome_1
节点一分开打各个补丁
root 自动打补丁 33806152
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33806152
opatchauto successful.
--------------------------------summary------------------------------
patching is completed successfully. please find the summary as follows:
host:rac19c-r1
rac home:/u01/app/oracle/product/19.0.0/dbhome_1
version:19.0.0.0.0
summary:
==following patches were successfully applied:
patch: /u01/backup/33859214/33803476/33806152
log: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_11-36-47am_1.log
host:rac19c-r1
crs home:/u01/app/19.0.0/grid
version:19.0.0.0.0
summary:
==following patches were successfully applied:
patch: /u01/backup/33859214/33803476/33806152
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_11-41-34am_1.log
opatchauto session completed at wed may 11 12:04:15 2022
time taken to complete the session 32 minutes, 25 seconds
ocw 补丁
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33815596
acfs 补丁
[root@rac19c-r1 33803476]# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33815607 -oh /u01/app/19.0.0/grid
tomcat 补丁
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33911149 -oh /u01/app/19.0.0/grid
dbwlm 补丁
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476/33575402 -oh /u01/app/19.0.0/grid
opatchauto session is initiated at wed may 11 15:03:56 2022
system initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2022-05-11_03-04-00pm.log.
session log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2022-05-11_03-04-45pm.log
the id for this session is 1gy2
executing opatch prereq operations to verify patch applicability on home /u01/app/19.0.0/grid
patch applicability verified successfully on home /u01/app/19.0.0/grid
executing patch validation checks on home /u01/app/19.0.0/grid
patch validation checks successfully completed on home /u01/app/19.0.0/grid
performing prepatch operations on crs - bringing down crs service on home /u01/app/19.0.0/grid
prepatch operation log file location: /u01/app/grid/crsdata/rac19c-r1/crsconfig/crs_prepatch_apply_inplace_rac19c-r1_2022-05-11_03-05-08pm.log
crs service brought down successfully on home /u01/app/19.0.0/grid
start applying binary patch on home /u01/app/19.0.0/grid
binary patch applied successfully on home /u01/app/19.0.0/grid
performing postpatch operations on crs - starting crs service on home /u01/app/19.0.0/grid
postpatch operation log file location: /u01/app/grid/crsdata/rac19c-r1/crsconfig/crs_postpatch_apply_inplace_rac19c-r1_2022-05-11_03-07-52pm.log
crs service started successfully on home /u01/app/19.0.0/grid
opatchauto successful.
--------------------------------summary--------------------------------
patching is completed successfully. please find the summary as follows:
host:rac19c-r1
crs home:/u01/app/19.0.0/grid
version:19.0.0.0.0
summary:
==following patches were successfully applied:
patch: /u01/backup/33859214/33803476/33575402
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_15-07-26pm_1.log
opatchauto session completed at wed may 11 15:10:32 2022
time taken to complete the session 6 minutes, 36 seconds
节点二应用补丁
直接分析 33803476 整个补丁集
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476 -analyze
opatchauto successful.
--------------------------------summary--------------------------------
analysis for applying patches has completed successfully:
host:rac19c-r2
crs home:/u01/app/19.0.0/grid
version:19.0.0.0.0
==following patches were successfully analyzed to be applied:
patch: /u01/backup/33859214/33803476/33815596
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_17-47-44pm_1.log
patch: /u01/backup/33859214/33803476/33815607
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_17-47-44pm_1.log
patch: /u01/backup/33859214/33803476/33575402
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_17-47-44pm_1.log
patch: /u01/backup/33859214/33803476/33911149
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_17-47-44pm_1.log
patch: /u01/backup/33859214/33803476/33806152
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_17-47-44pm_1.log
opatchauto session completed at wed may 11 17:48:08 2022
time taken to complete the session 2 minutes, 20 seconds
root 打补丁 33803476
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476
注意看这里提示自动打失败了,但是根绝这个错误看不出问题,那么就需要看上图中标黄的日志了。
more /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_17-55-12pm_1.log
检查日志发现节点 2 补丁 33815596 缺少文件 ocrcheck.bin
# ll /u01/backup/33859214/33803476/33815596/files/bin/ocrcheck.bin
ls: cannot access /u01/backup/33859214/33803476/33815596/files/bin/ocrcheck.bin: no such file or directory
很是奇怪,补丁包是从节点1 解压后 scp 过来的,怎么会出现缺少文件的问题呢?那就直接 scp zip 包然后在节点 2 解压吧。
rac1$ scp p33859214_190000_linux-x86-64.zip rac19c-r2:/u01/backup
rac2# chown grid:oinstall p33859214_190000_linux-x86-64.zip
su - grid
( asm2)$ unzip p33859214_190000_linux-x86-64.zip
( asm2)$ chmod 777 -r 33859214
然后使用 root 继续打补丁吧。
# /u01/app/19.0.0/grid/opatch/opatchauto apply /u01/backup/33859214/33803476
--------------------------------summary--------------------------------
patching is completed successfully. please find the summary as follows:
host:rac19c-r2
crs home:/u01/app/19.0.0/grid
version:19.0.0.0.0
summary:
==following patches were successfully applied:
patch: /u01/backup/33859214/33803476/33575402
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_18-37-20pm_1.log
patch: /u01/backup/33859214/33803476/33806152
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_18-37-20pm_1.log
patch: /u01/backup/33859214/33803476/33815596
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_18-37-20pm_1.log
patch: /u01/backup/33859214/33803476/33815607
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_18-37-20pm_1.log
patch: /u01/backup/33859214/33803476/33911149
log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-05-11_18-37-20pm_1.log
opatchauto session completed at wed may 11 18:46:27 2022
time taken to complete the session 11 minutes, 49 seconds
注意:如果有其他问题,补丁已经开始进行了,中途出现问题报错,需检查日志修复问题后使用 resume 执行补丁。
# /u01/app/19.0.0/grid/opatch/opatchauto resume
检查补丁信息
( asm1)$ opatch lspatches
33575402;dbwlm release update 19.0.0.0.0 (33575402)
33911149;tomcat release update 19.0.0.0.0 (33911149)
33815607;acfs release update 19.15.0.0.0 (33815607)
33815596;ocw release update 19.15.0.0.0 (33815596)
33806152;database release update : 19.15.0.0.220419 (33806152)
( asm2)$ opatch lspatches
33911149;tomcat release update 19.0.0.0.0 (33911149)
33815607;acfs release update 19.15.0.0.0 (33815607)
33815596;ocw release update 19.15.0.0.0 (33815596)
33806152;database release update : 19.15.0.0.220419 (33806152)
33575402;dbwlm release update 19.0.0.0.0 (33575402)
检查发现 rac2 acfs 和 dbwlm 没有变过来而已,不过已经打上补丁了。
rac1$ opatch lspatches
33815596;ocw release update 19.15.0.0.0 (33815596)
33806152;database release update : 19.15.0.0.220419 (33806152)
rac2$ opatch lspatches
29585399;ocw release update 19.3.0.0.0 (29585399)
29517242;database release update : 19.3.0.0.190416 (29517242)
手动打补丁
检查发现 rac2 db 没有打上补丁,那么手动来打吧。
# chown -r oracle:oinstall 33859214
su - oracle
rac2$ /u01/backup/33859214/33803476/33815596/custom/scripts/prepatch.sh -dbhome /u01/app/oracle/product/19.0.0/dbhome_1
rac2$ opatch apply -oh /u01/app/oracle/product/19.0.0/dbhome_1 /u01/backup/33859214/33803476/33806152
rac2$ opatch apply -oh /u01/app/oracle/product/19.0.0/dbhome_1 /u01/backup/33859214/33803476/33815596
rac2$ /u01/backup/33859214/33803476/33815596/custom/scripts/postpatch.sh -dbhome /u01/app/oracle/product/19.0.0.0/dbhome_1
oracle 用户再次检查 19.15 已没有问题了。
$ opatch lspatches
33815596;ocw release update 19.15.0.0.0 (33815596)
33806152;database release update : 19.15.0.0.220419 (33806152)
opatch succeeded.
ojvm 补丁
检查 ojvm 是否安装,是否使用? 这个很早之前也说过了。
sql> select version, status from dba_registry where comp_id='javavm';
16:55:52 sql>
version status
------------------------------ --------------------------------------------
19.0.0.0.0 valid
sql> select count(*) from x$kglob where kglobtyp = 29 or kglobtyp = 56;
count(*)
----------
0
为了确定 ojvm 的用户,我们可以通过下面的 sql 检查 v$session 来显示数据库中调用 java 的 service, program 或 user。 此 sql 将只显示活动用户(因此可能必须定期运行以充分收集数据)。
col service_name format a20
col username format a20
col program format a20
set num 8
select sess.service_name, sess.username,sess.program, count(*)
from
v$session sess,
dba_users usr,
x$kgllk lk,
x$kglob
where kgllkuse=saddr
and kgllkhdl=kglhdadr
and kglobtyp in (29,56)
and sess.user# = usr.user_id
and usr.oracle_maintained = 'n' -- omit this line on 11.2.0.4
group by sess.service_name, sess.username, sess.program
order by sess.service_name, sess.username, sess.program;
--如果您希望报告除您自己的应用程序之外正在使用的 oracle 实用程序(以便oracle 实用程序也可以暂停),请使用以下 sql select 语句。 即时编译器(jit)在滚动过程中停止。
col service_name format a20
col username format a20
col program format a20
set num 8
select sess.service_name, sess.username,sess.program, count(*)
from
v$session sess,
x$kgllk lk,
x$kglob
where kgllkuse=saddr
and kgllkhdl=kglhdadr
and kglobtyp in (29,56)
group by sess.service_name, sess.username, sess.program
order by sess.service_name, sess.username, sess.program;
ojvm psu 补丁将补丁文件放到 oracle_home 中,重新链接 oracle_home,然后修改 oracle 可执行文件。 然后,oracle 数据库编排 java 系统类的更新。
使用 rac 滚动步骤在主数据库中停止、清空和禁用所有使用 ojvm 的服务。 应用ojvm patch 和所有 post sql (data patch)步骤。 重启数据库,启用并重启使用ojvm 的服务。通俗易懂的意思就是停止数据库实例应用 ojvm 补丁。
--关闭实例 1
$ srvctl stop instance -d jiekedb -instance jiekedb1
--应用 ojvm 补丁
cd /u01/backup/33859214/33808367
opatch apply -local
opatch lsinventory
--启动实例执行 datapatch 脚本
$ srvctl start instance -d jiekedb -instance jiekedb1
cd $oracle_home/opatch
./datapatch -verbose
检查数据库补丁信息
set line 456
col action_time for a30
col status for a10
col description for a55
select patch_id, patch_uid, target_version, action, action_time, status, description from dba_registry_sqlpatch order by action_time;
patch_id patch_uid target_version action action_time status description
---------- ---------- --------------- --------------- ------------------------------ ---------- -------------------------------------------------------
29517242 22862832 19.3.0.0.0 apply 09-may-22 05.18.12.723309 pm success database release update : 19.3.0.0.190416 (29517242)
33806152 24713297 19.15.0.0.0 apply 11-may-22 12.04.14.679266 pm success database release update : 19.15.0.0.220419 (33806152)
33808367 24680225 19.15.0.0.0 apply 11-may-22 05.36.54.859534 pm success ojvm release update: 19.15.0.0.220419 (33808367)
补丁回退
回退补丁也比较简单,具体请查看 readme.html 。新安装的数据库一般情况下是不需要回退的,这里以备不时之需,请使用 root 用户执行:
# /opatch/opatchauto rollback /33803476
然后启动数据库,使用 oracle 用户仅在其中一个节点执行下面脚本。
cd $oracle_home/opatch
./datapatch -verbose
然后检查日志:
33806152_rollback___.log
然后编译无效对象:
cd $oracle_home/rdbms/admin
sqlplus / as sysdba
sql> @utlrp.sql
如果是单机环境,关闭数据库实例和监听,直接:
opatch rollback -id 33806152
其他补丁相关的资料
https://mp.weixin.qq.com/s/_z8boxe3ztxq37rsayzgea
https://mp.weixin.qq.com/s/vgyb-ujbi1ifo1llefvduq
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/download/1033988
https://www.modb.pro/download/541101
https://www.modb.pro/download/39727
https://www.modb.pro/doc/46149
https://www.modb.pro/db/27255
https://www.modb.pro/doc/1602
https://www.modb.pro/doc/4638
全文完,希望可以帮到正在阅读的你,如果觉得此文对你有帮助,可以分享给你身边的朋友,同事,你关心谁就分享给谁,一起学习共同进步~~~
注意:本文已经生成 pdf 文档了,有需要的可使用此链接下载 https://www.modb.pro/doc/79585
❤️ 欢迎关注我的公众号【jiekexu dba之路】,一起学习新知识!
————————————————————————————
公众号:jiekexu dba之路
csdn :https://blog.csdn.net/jiekexu
墨天轮:https://www.modb.pro/u/4347
腾讯云:https://cloud.tencent.com/developer/user/5645107
————————————————————————————