概述
OPatch 实用程序是一种允许将临时补丁应用到 Oracle 产品并将其回滚的工具。
打最新补丁
1. 安装环境准备
1.1 数据库版本: 11.2.0.4.0
1.2 安装包准备:
- patch 包:p28980129_112040_Linux-x86-64.zip
- OPatch 包:p6880880_112000_Linux-x86-64-2018apr.zip
1.3 将上述两个包上传到 /oracle/software/ 目录下
2. 打补丁
2.1 更新OPatch
su - oracle
# 查看 Opatch 的版本。安装数据库时安装在 $ORACLE_HOME/OPatch/ 目录下
test@single /home/oracle$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
# 将 OPatch 包复制到 $ORACLE_HOME 目录下
cd $ORACLE_HOME
cp /oracle/software/p6880880_112000_Linux-x86-64-2018apr.zip $ORACLE_HOME
# 将之前版本的 Opatch 目录备份
mv OPatch OPatch_100057_OLD
# 解压新的 OPatch 包
unzip p6880880_112000_Linux-x86-64-2018apr.zip
# 设置变量
export PATH=$PATH:$ORACLE_HOME/OPatch
# 查看当前的 Opatch 情况:版本-11.2.0.3.19(出现 OPatch succeeded. 即为成功)
test@single /oracle/app/oracle/product/11.2.0$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/app/oracle/product/11.2.0
Central Inventory : /oracle/app/oraInventory
from : /oracle/app/oracle/product/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.19
OUI version : 11.2.0.4.0
Log file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2021-12-20_16-18-11PM_1.log
Lsinventory Output file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/lsinv/lsinventory2021-12-20_16-18-11PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: single
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.4.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
复制
2.2 打补丁前检查
# 解压补丁包
cd $ORACLE_HOME
unzip /oracle/software/p28980129_112040_Linux-x86-64.zip
cd 28980129/
test@single /oracle/app/oracle/product/11.2.0/28980129$ ll
total 40
drwxr-xr-x 23 oracle oinstall 4096 Dec 20 2018 28729262/
drwxr-xr-x 4 oracle oinstall 67 Jan 25 2019 28790660/
-rw-rw-r-- 1 oracle oinstall 9040 Jan 25 2019 PatchSearch.xml
-rw-rw-r-- 1 oracle oinstall 21078 Jan 29 2019 README.html
# 进行冲突检查(出现 OPatch succeeded. 即为成功)
test@single /oracle/software/28980129$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /oracle/app/oracle/product/11.2.0
Central Inventory : /oracle/app/oraInventory
from : /oracle/app/oracle/product/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.19
OUI version : 11.2.0.4.0
Log file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2021-12-20_16-24-21PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
复制
2.3 应用补丁
cd 28729262/
# 出现 Composite patch 28729262 successfully applied. 即为成功
test@single /oracle/app/oracle/product/11.2.0/28980129/28729262$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/app/oracle/product/11.2.0
Central Inventory : /oracle/app/oraInventory
from : /oracle/app/oracle/product/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.19
OUI version : 11.2.0.4.0
Log file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2021-12-20_17-49-50PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 17478514 18031668 18522509 19121551 19769489 20299013 20760982 21352635 21948347 22502456 23054359 24006111 24732075 25869727 26609445 26392168 26925576 27338049 27734982 28204707 28729262
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]: Y
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/oracle/product/11.2.0')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '17478514' to OH '/oracle/app/oracle/product/11.2.0'
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.rsf, 11.2.0.4.0...
Patching component oracle.sdo, 11.2.0.4.0...
Patching component oracle.sysman.agent, 10.2.0.4.5...
Patching component oracle.xdk, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.sdo.locator, 11.2.0.4.0...
Patching component oracle.nlsrtl.rsf, 11.2.0.4.0...
Patching component oracle.xdk.rsf, 11.2.0.4.0...
Patching component oracle.rdbms.rman, 11.2.0.4.0...
Applying sub-patch '18031668' to OH '/oracle/app/oracle/product/11.2.0'
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.rsf, 11.2.0.4.0...
Patching component oracle.ldap.rsf, 11.2.0.4.0...
Patching component oracle.rdbms.crs, 11.2.0.4.0...
Patching component oracle.precomp.common, 11.2.0.4.0...
Patching component oracle.ldap.rsf.ic, 11.2.0.4.0...
Patching component oracle.rdbms.deconfig, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.rdbms.rman, 11.2.0.4.0...
……
Composite patch 28729262 successfully applied.
OPatch Session completed with warnings.
Log file location: /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2021-12-20_17-49-50PM_1.log
OPatch completed with warnings.
复制
2.4 成功后检查
检查补丁包是否应用成功有两种方式查看:
-
法一:通过
opatch lsinv
命令:可以看到补丁的应用时间以及发布时间test@single /oracle/app/oracle/product/11.2.0/28980129/28729262$ opatch lsinv Oracle Interim Patch Installer version 11.2.0.3.19 Copyright (c) 2021, Oracle Corporation. All rights reserved. Oracle Home : /oracle/app/oracle/product/11.2.0 Central Inventory : /oracle/app/oraInventory from : /oracle/app/oracle/product/11.2.0/oraInst.loc OPatch version : 11.2.0.3.19 OUI version : 11.2.0.4.0 Log file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2021-12-20_18-18-01PM_1.log Lsinventory Output file location : /oracle/app/oracle/product/11.2.0/cfgtoollogs/opatch/lsinv/lsinventory2021-12-20_18-18-01PM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: single ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Database 11g 11.2.0.4.0 There are 1 products installed in this Oracle Home. Interim patches (1) : Patch 28729262 : applied on Mon Dec 20 18:07:03 CST 2021 # 补丁的应用时间 Unique Patch ID: 22664181 # 补丁的ID Patch description: "Database Patch Set Update : 11.2.0.4.190115 (28729262)" # 补丁的发布时间 Created on 19 Dec 2018, 22:33:21 hrs PST8PDT Sub-patch 28204707; "Database Patch Set Update : 11.2.0.4.181016 (28204707)" Sub-patch 27734982; "Database Patch Set Update : 11.2.0.4.180717 (27734982)" Sub-patch 27338049; "Database Patch Set Update : 11.2.0.4.180417 (27338049)" Sub-patch 26925576; "Database Patch Set Update : 11.2.0.4.180116 (26925576)" Sub-patch 26392168; "Database Patch Set Update : 11.2.0.4.171017 (26392168)" Sub-patch 26609445; "Database Patch Set Update : 11.2.0.4.170814 (26609445)" Sub-patch 25869727; "Database Patch Set Update : 11.2.0.4.170718 (25869727)" Sub-patch 24732075; "Database Patch Set Update : 11.2.0.4.170418 (24732075)" Sub-patch 24006111; "Database Patch Set Update : 11.2.0.4.161018 (24006111)" Sub-patch 23054359; "Database Patch Set Update : 11.2.0.4.160719 (23054359)" Sub-patch 22502456; "Database Patch Set Update : 11.2.0.4.160419 (22502456)" Sub-patch 21948347; "Database Patch Set Update : 11.2.0.4.160119 (21948347)" Sub-patch 21352635; "Database Patch Set Update : 11.2.0.4.8 (21352635)" Sub-patch 20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)" Sub-patch 20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)" Sub-patch 19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)" Sub-patch 19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)" Sub-patch 18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)" Sub-patch 18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)" Sub-patch 17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)" Bugs fixed: 17184721, 21174504, 21538558, 16091637, 18092127, 17381384, 15979965 20671094, 16731148, 16314254, 13837378, 18441944, 23105538, 17291347 17835048, 28254374, 13558557, 21842740, 21656630, 17008068, 17201159 25427662, 17853498, 20717359, 17246576, 18356166, 18681862, 18440047 20569094, 20031873, 16875449, 20387265, 19788842, 17296856, 21330264 14010183, 17648596, 17025461, 17551063, 24719736, 17267114, 21063322 22507210, 17912217, 17889583, 18202441, 17040764, 17478145, 16524926 25655390, 19358317, 22730454, 22148226, 18747196, 26544823, 18641419 17036973, 18948177, 17811789, 16542886, 14285317, 18009564, 17359610 16618694, 8322815, 16832076, 18247991, 16692232, 22507234, 17570240 13871092, 24624166, 26631046, 19429927, 24348685, 17848897, 17441661 14034426, 17465741, 20273319, 19207156, 16596890, 17437634, 21343897 20506706, 18339044, 21453153, 17951233, 21795111, 22321741, 18430495 21787056, 22380919, 19469538, 19692824, 20506715, 17811429, 17903598 19721304, 18230522, 19554106, 19458377, 21281607, 17612828, 6599380 22092979, 17040527, 22321756, 17811438, 18641461, 18682983, 14657740 25635149, 13364795, 19490948, 21387964, 17346671, 17588480, 22351572 18235390, 18849970, 26474853, 17889549, 19309466, 16472716, 25775213 20596234, 18331850, 18641451, 17019356, 17344412, 19461270, 21179898 17546761, 24842886, 17231779, 14521849, 18203835, 18203838, 18964939 18203837, 17313525, 22195457, 18139690, 16837842, 14106803, 22296366 17842825, 22657942, 21352646, 16360112, 22594718, 20657441, 22195441 17389192, 26198926, 14565184, 17019345, 17205719, 18740837, 18440095 14764829, 22195448, 14354737, 17019086, 13944971, 16571443, 21868720 17186905, 17080436, 18673342, 22905130, 17027426, 27374796, 19972569 19972568, 20144308, 19972566, 17282229, 19972564, 16870214, 16410570 21629064, 19615136, 26039623, 21354456, 17390431, 18762750, 23007241 16613964, 17957017, 18098207, 17484762, 18471685, 19730508, 18264060 21538485, 17323222, 17754782, 17600719, 18317531, 17852463, 17596908 17655634, 18166013, 16228604, 20074391, 27053456, 24790914, 19972570 20856766, 19891090, 18090142, 18996843, 16042673, 19854503, 22901797 17835627, 20334344, 17393683, 20861693, 18000422, 17551709, 26575788 23315889, 20506699, 19006849, 18277454, 18456514, 19174430, 17258090 17174582, 25654936, 17242746, 27097854, 16399083, 17824637, 21132297 22465352, 17762296, 22168163, 18604692, 17397545, 16450169, 12364061 20067212, 18856999, 19211724, 19463893, 19463897, 21343775, 17853456 18673304, 20004021, 26030218, 21668627, 16194160, 17477958, 23140259 16538760, 12982566, 24570598, 20828947, 18259031, 20296213, 28855981 18293054, 17610798, 19699191, 23065323, 17311728, 18135678, 18774543 23294548, 16785708, 10136473, 24560906, 19777862, 22551446, 17786518 25879984, 18315328, 18334586, 12747740, 18096714, 19032867, 21641760 17390160, 18899974, 17232014, 20598042, 26245237, 26679352, 16354467 17484731, 18673325, 16422541, 18155762, 19827973, 14015842, 22683225 17726838, 18554871, 23177648, 18051556, 20803583, 21972320, 15990359 17922254, 18282562, 16855292, 16668584, 21343838, 20299015, 17446237 18043064, 18093615, 23713236, 17694209, 17288409, 20475845, 18308268 17274537, 13955826, 16934803, 17634921, 17501491, 16315398, 23725036 22683212, 17006183, 13829543, 18191164, 26746894, 22809871, 17655240 28819280, 18384391, 19393542, 21538567, 16198143, 21847223, 25823754 17892268, 20142975, 19584068, 17165204, 25165496, 18604493, 21756699 18508861, 18554763, 16901385, 21532755, 18189036, 17443671, 17385178 14829250, 17936109, 20925795, 20509482, 17478514, 27441326, 16850630 13951456, 16595641, 14054676, 15861775, 21142837, 16912439, 17299889 17297939, 23003979, 16833527, 18619917, 17798953, 19697993, 17816865 25914276, 18607546, 17571306, 21286665, 17341326, 26910644, 17851160 17586955, 20558005, 19049453, 21051840, 17587063, 16956380, 18328509 25423453, 29033139, 14133975, 19718981, 18061914, 18522509, 17518652 21051833, 20294666, 18765602, 20860659, 18272672, 20324049, 18199537 17332800, 13609098, 22502493, 18384537, 14338435, 17945983, 16392068 21067387, 17752995, 21051862, 16863422, 17237521, 25505382, 18244962 19544839, 24433711, 24717859, 17156148, 18973907, 23026585, 17449815 17877323, 18180390, 17088068, 17037130, 20004087, 21422580, 19466309 11733603, 25505371, 18610915, 21051858, 18084625, 18674024, 26243698 21051852, 18091059, 18306996, 25369547, 16306373, 17787259, 18193833 19915271, 20513399, 20631274, 16344544, 25879656, 14692762, 18614015 17346091, 18228645, 17721717, 13960236, 18685892, 18436307, 19888853 21756677, 11883252, 17891943, 19475971, 22353199, 16384983, 19121551 25634317, 27825893, 12816846, 17982555, 17761775, 22243719, 17265217 25505394, 17071721, 16721594, 18262334, 21756661, 17891946, 15913355 17672719, 17602269, 17239687, 17042658, 25555252, 17238511, 17811456 17284817, 17752121, 20879889, 28806384, 21380789, 17394950, 17011832 16579084, 22195465, 14602788, 28790634, 18325460, 27567477, 24476265 26569225, 24476274, 12611721, 18674465, 16903536, 17006570, 19689979 28076295, 16043574, 18783224, 24662775, 16494615, 21526048, 17392698 19197175, 16069901, 17811447, 27870645, 28876684, 17308789, 24835538 22195477, 17865671, 17343514, 19013183, 17325413, 18316692, 16180763 17348614, 14368995, 21983325, 17393915, 16285691, 19211433, 20331945 17883081, 17705023, 24316947, 17614227, 19578350, 22195485, 14084247 24975421, 26078387, 23115139, 13645875, 16777840, 19727057, 14852021 18744139, 18674047, 17716305, 19285025, 18482502, 17622427, 19289642 27534509, 25947799, 22195492, 14458214, 20869721, 21172913, 17767676 18723434, 25505407, 17786278, 19258504, 17082983, 17365043, 21351877 13498382, 18331812, 16065166, 25489607, 16685417, 18031668, 22893153 17551674, 16943711, 19272701, 21517440, 25897615, 17649265, 13866822 18094246, 24528741, 17783588, 14245531, 17082359, 18280813, 20448824 23330119, 16268425, 19487147, 25600421, 18018515, 17302277, 17215560 24411921, 19271443, 14176370, 25764020, 17016369, 20777150, 16756406 23330124, 20441797, 19769489, 28100487, 17545847, 25093656, 18260550 13853126, 17227277, 17551699, 23536835, 25957038, 24652769, 20725343 19207117, 9756271, 18868646, 17614134, 26667023, 17546973, 18704244 19680952, 26667015, 17050888, 18273830, 18828868, 17360606, 16992075 24563422, 17375354, 12905058, 18362222, 21429602, 26667032, 28364007 27086138, 17571039, 17468141, 18436647, 17570606, 17235750, 21168487 17279227, 16220077, 16929165 -------------------------------------------------------------------------------- OPatch succeeded.
复制 -
法二:连接数据库通过视图查看
# 前提:在数据库安装完成之后创建了 test 数据库 su - oracle sqlplus / as sysdba # 启动 test 数据库 startup nomount; SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ test STARTED alter database mount; SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ test MOUNTED alter database open; SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ test OPEN # 设置参数 set pages 100 lines 200 col action format a6 col namespace format a10 col version format a10 col comments format a20 col action_time format a30 col bundle_series format a15 alter session set nls_timestamp_format = 'yyyy-mm-dd hh24:mi:ss.ff'; # 在视图中查看 select * from dba_registry_history; ACTION_TIME ACTION NAMESPACE VERSION ID BUNDLE_SERIES COMMENTS ------------------------------ ------ ---------- ---------- ---------- --------------- -------------------- 2013-08-24 12:03:45.119862 APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0 2021-12-16 21:01:36.653233 APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0
复制
补丁出现的问题及解决
问题:在检查时通过,但在进行应用补丁时出现:
ZOP-51: The patch location is not valid for apply, because it doesn't have correct metadata, or it points to a patch directory.
Argument(s) Error... Patch location is not valid for apply
Please check the arguments and try again.
OPatch failed with error code 135
复制
按照在网上查询的步骤:
1)查看权限:
2)在应用补丁时,在后面加上 -local 选项还是报错
问题未解决!!!
解决方法:需进入到补丁的下一层目录执行opatch apply
注意的问题
-
在打补丁之前需要关闭数据库
-
在进行应用补丁时可以参考
README.html
文件-
查看所需的 Opatch 工具的版本,并确保升级后的 Opatch 工具满足条件
-
参考文档中的安装步骤
-
附:该例使用的两个包:
(如需提取码请在评论区留言)
最后修改时间:2021-12-21 10:15:39
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
1
1年前

评论
这差不多是最后一个补丁了吧,后面的补丁要高级用户才可以下载。
2年前

评论
您好,您的文章已入选合格奖,10墨值奖励已经到账请查收!
❤️我们还会实时派发您的流量收益。
3年前

评论
相关阅读
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
733次阅读
2025-04-18 14:18:38
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
644次阅读
2025-04-15 17:24:06
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
563次阅读
2025-04-20 10:07:02
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
510次阅读
2025-04-22 00:13:51
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
506次阅读
2025-04-17 17:02:24
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
494次阅读
2025-04-22 00:20:37
一页概览:Oracle GoldenGate
甲骨文云技术
477次阅读
2025-04-30 12:17:56
火焰图--分析复杂SQL执行计划的利器
听见风的声音
435次阅读
2025-04-17 09:30:30
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
378次阅读
2025-04-15 14:48:05
OR+DBLINK的关联SQL优化思路
布衣
369次阅读
2025-05-05 19:28:36
TA的专栏
目录