上传补丁及opatch工具
创建目录并上传opatch工具和补丁包
[oracle@rhel64 ~]$ mkdir /u01/psu
[oracle@rhel64 ~]$ cd /u01/psu
[oracle@rhel64 psu]$ ll
total 514572
-rw-r--r-- 1 oracle oinstall 391781147 Sep 23 17:37 p31537677_112040_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 135128916 Sep 23 17:35 p6880880_112000_Linux-x86-64.zip
[oracle@rhel64 psu]$
解压补丁包
[oracle@rhel64 psu]$ unzip p31537677_112040_Linux-x86-64.zip
[oracle@rhel64 psu]$ unzip p6880880_112000_Linux-x86-64.zip
[oracle@rhel64 psu]$ ll
total 514720
drwxr-xr-x 30 oracle oinstall 4096 Sep 24 2020 31537677
drwxr-x--- 16 oracle oinstall 4096 Jun 28 15:25 OPatch
-rw-r--r-- 1 oracle oinstall 391781147 Sep 23 17:37 p31537677_112040_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 135128916 Sep 23 17:35 p6880880_112000_Linux-x86-64.zip
-rw-rw-r-- 1 oracle oinstall 139382 Oct 20 2020 PatchSearch.xml
[oracle@rhel64 psu]$
关监听停库
[oracle@rhel64 ~]$ lsnrctl stop
[oracle@rhel64 ~]$ sqlplus / as sysdba
SQL> shutdown immediate;
停止控制台
[oracle@rhel64 ~]$ emctl stop dbconsole
[oracle@rhel64 ~]$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://rhel64:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
... Stopped.
[oracle@rhel64 ~]$
检查oracle相关进程
[oracle@rhel64 ~]$ ps -ef |grep ora_
oracle 50543 49965 0 18:16 pts/5 00:00:00 grep ora_
[oracle@rhel64 ~]$
OPatch工具替换
查看当前数据库OPatch版本
cd $ORACLE_HOME/OPatch
./opatch version
[oracle@rhel64 ~]$ cd $ORACLE_HOME/OPatch
[oracle@rhel64 OPatch]$ ./opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
[oracle@rhel64 OPatch]$ pwd
/u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch
备份数据库自带的OPatch工具
[oracle@rhel64 dbhome_1]$ mv OPatch OPatch_old
将新版OPatch工具复制到当前路径
[oracle@rhel64 OPatch]$ cd ..
[oracle@rhel64 dbhome_1]$ cp -r /u01/psu/OPatch .
再次查看OPatch版本
[oracle@rhel64 dbhome_1]$ cd OPatch
[oracle@rhel64 OPatch]$ ./opatch version
OPatch Version: 11.2.0.3.47
OPatch succeeded.
[oracle@rhel64 OPatch]$
修改环境变量
将OPatch路径(/u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch)配置到环境变量中
vi ~/.bash_profile
cat ~/.bash_profile |grep export
source ~/.bash_profile
检测补丁是否冲突
opatch prereq CheckConflictAgainstOHWithDetail -ph ./
[oracle@rhel64 31537677]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.47
Copyright (c) 2024, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0.4/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.47
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2024-09-23_19-24-14PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
[oracle@rhel64 31537677]$
安装补丁
执行安装补丁命令
[oracle@rhel64 31537677]$ opatch apply
输入y默认进行下一步
打完补丁提示如下告警忽略即可
查看已安装补丁
opatch lsinventory
[oracle@rhel64 ~]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.47
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0.4/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.47
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2024-09-23_20-05-42PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2024-09-23_20-05-42PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: rhel64
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 31537677 : applied on Mon Sep 23 19:51:22 CST 2024
Unique Patch ID: 23828543
Patch description: "Database Patch Set Update : 11.2.0.4.201020 (31537677)"
Created on 24 Sep 2020, 06:02:11 hrs PST8PDT
Sub-patch 31103343; "Database Patch Set Update : 11.2.0.4.200714 (31103343)"
Sub-patch 30670774; "Database Patch Set Update : 11.2.0.4.200414 (30670774)"
Sub-patch 30298532; "Database Patch Set Update : 11.2.0.4.200114 (30298532)"
Sub-patch 29913194; "Database Patch Set Update : 11.2.0.4.191015 (29913194)"
Sub-patch 29497421; "Database Patch Set Update : 11.2.0.4.190716 (29497421)"
Sub-patch 29141056; "Database Patch Set Update : 11.2.0.4.190416 (29141056)"
Sub-patch 28729262; "Database Patch Set Update : 11.2.0.4.190115 (28729262)"
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:
18619917, 19309466, 28876684, 28855981, 18189036, 19781326, 13609098
16285691, 16756406, 18430495, 17323222, 13854364, 29483723, 19915271
22468255, 19516448, 14458214, 23713236, 23140259, 29434301, 22502493
19540573, 18272672, 16410570, 16494615, 19174430, 21352646, 16901385
16596890, 22243719, 18996843, 21387964, 20334344, 17174582, 22250006
17798953, 24307571, 14015842, 18031668, 15955387, 30758943, 21534893
16832076, 16065166, 16579084, 25427662, 21179898, 24589081, 11786053
15990359, 17982832, 18685892, 20142975, 24835538, 16315398, 20861693
30018017, 17037130, 17284817, 17643573, 18832544, 17891946, 17279227
17588480, 17291347, 16731148, 21097043, 24528741, 22321741, 17165204
26245237, 17891943, 25205368, 17359610, 17265217, 17465741, 29621961
22551446, 31492176, 18191164, 16721594, 18614015, 27825893, 18440095
19769489, 20596234, 25115178, 18482502, 16043574, 20936905, 17360606
22321756, 19211724, 17392698, 19463893, 31492164, 29033139, 17477958
17040764, 18362222, 19463897, 24624166, 17853456, 14521849, 17816865
19692824, 21868720, 17951233, 25505407, 17040527, 31022191, 24975421
19888853, 18009564, 20882568, 20803583, 23026585, 18604692, 17622427
16903536, 29483771, 17865671, 17883081, 16228604, 17082359, 17325413
12747740, 30517516, 22168163, 16091637, 20569094, 31492144, 17468141
29962939, 30365745, 19469538, 29633753, 20598042, 16042673, 23302839
17437634, 24473736, 28734355, 19049453, 16941434, 20387265, 16833527
21343775, 17297939, 16069901, 14285317, 22380919, 18436647, 23065323
31885190, 21983325, 17853498, 24790914, 23571055, 16542886, 21286665
17365043, 17752995, 25914276, 17296856, 18783224, 22353199, 22083366
28305362, 21419850, 16180763, 23294548, 26679352, 13960236, 25328093
25423453, 18339044, 17282229, 28384353, 25600421, 18856999, 31031715
18259031, 28806384, 21354456, 23725036, 18471685, 31885162, 30237239
17258090, 16344544, 17903598, 17011832, 18135678, 18704244, 17786518
19718981, 25655390, 17242746, 20250147, 19197175, 17390431, 17835627
17672719, 31125948, 17393915, 21566639, 18765602, 21425496, 26544823
22228324, 29962927, 18682983, 30179644, 25165496, 12816846, 31885179
18774543, 18747196, 31885173, 17824637, 21834568, 19429927, 21429602
16524926, 17343514, 19271443, 17019345, 18681862, 17186905, 23330119
17811438, 26474853, 17215560, 16875449, 21380789, 17184721, 18508861
19466309, 23330124, 17811429, 17019356, 25654936, 17754782, 17752121
22809871, 17201159, 18308268, 19777862, 16198143, 29027694, 18828868
17586955, 28076295, 19445860, 26654363, 22977256, 16692232, 30200680
27374796, 21142837, 20869721, 17649265, 24555417, 17847764, 25879656
21756699, 19697993, 28364007, 17787259, 23628685, 30578221, 30252098
23007241, 27351628, 18094246, 18460587, 20031873, 17375354, 21698350
26513067, 21538567, 18232865, 22683212, 16450169, 17478145, 17311728
17648596, 17308789, 22836801, 21756677, 18674047, 14084247, 19788303
22683225, 27534509, 16833845, 18948177, 17205719, 21756661, 20004021
17922254, 13837378, 18084625, 17912217, 11883252, 24842886, 12982566
26203182, 14176370, 14764829, 21847223, 16875230, 22568797, 28079127
17237521, 29511611, 25635149, 16934803, 17848897, 20441797, 20175161
19831647, 16613964, 17532245, 18334586, 17288409, 17341326, 31338362
17449815, 15913355, 16399083, 18740837, 20294666, 27404573, 14565184
21517440, 17614134, 19854503, 14245531, 16194160, 18325460, 15979965
30562923, 20671094, 29965888, 27870645, 25093656, 18247991, 16912439
30562936, 17047404, 24433711, 19930276, 22092979, 20506715, 31884535
23003979, 20506706, 13871092, 19272701, 17397545, 16785708, 19461270
21051862, 13829543, 16220077, 17008068, 18061914, 20448824, 30275359
18674024, 29343156, 19689979, 24411921, 30275351, 23184013, 17596908
17036973, 22175564, 22499356, 17612828, 20725343, 31001455, 28199085
23194294, 17630484, 21051858, 20017509, 21051852, 17767676, 17232014
22893153, 12611721, 25555252, 18356166, 17071721, 19315668, 25764020
16863422, 21051840, 17820741, 17267114, 18043064, 21538558, 26243698
20324049, 21612959, 30305880, 16392068, 18744139, 24348685, 26746894
17806696, 18628388, 27072923, 14010183, 16595641, 17080436, 17332800
20777150, 21453153, 20299015, 18413820, 18264060, 16819962, 22465352
21351877, 21051833, 18673342, 30393318, 30562907, 30562909, 29200700
27441326, 16571443, 18328509, 27567477, 18674465, 16422541, 18306996
19359219, 21424824, 17443671, 17478514, 21067387, 16268425, 17381384
18723434, 17235750, 23328639, 22195448, 24570598, 21172913, 17655240
18384391, 16992075, 22195441, 17025461, 30562891, 16472716, 19289642
21502702, 22195457, 20475845, 22148226, 26030218, 17945983, 18331850
13498382, 24652769, 31885230, 18673304, 17610798, 19891090, 25369547
18456514, 8322815, 22657942, 17313525, 17050888, 18317531, 19835133
17495022, 11733603, 18798250, 19285025, 18260550, 17390160, 18316692
19458377, 14368995, 17551063, 21343838, 12905058, 14735792, 28612674
16855292, 23315889, 13364795, 18235390, 18293054, 18673325, 30215130
19393542, 14657740, 17532729, 17393683, 17389192, 17783588, 17852463
19358317, 17441661, 14034426, 28254374, 20631274, 19207117, 26569225
17518652, 24662775, 19475971, 31885201, 18282562, 30421204, 19896336
17348614, 19827973, 31883489, 17346671, 31022281, 19791273, 24476274
22296366, 13853126, 18273830, 17570606, 13558557, 26007010, 20425790
16685417, 31885223, 18180390, 14692762, 18159793, 17027426, 24476265
23177648, 17851160, 16870214, 18202441, 17227073, 20657411, 19006849
22606521, 20506699, 28000269, 23536835, 17761775, 20382309, 16306373
31885213, 17801017, 19680952, 16850630, 17694209, 26667015, 17877323
18230522, 24563422, 17446237, 17889549, 17551674, 16233738, 22730454
17571039, 26667023, 19972570, 18849970, 21532755, 20860659, 22905130
21168487, 17016369, 21263635, 17231779, 17717883, 21343897, 27710072
18522509, 23209741, 17484731, 21972320, 19972569, 19972568, 17716305
21059919, 19972566, 19972564, 26667032, 17394950, 26318200, 20657441
17551699, 17006570, 18051556, 12364061, 18029658, 17546973, 18262334
19699191, 30387666, 17227277, 18018515, 16943711, 18388363, 17982555
20828947, 18098207, 18436307, 19584068, 16898135, 13936038, 19601762
31010960, 14054676, 25505394, 18228645, 19013183, 29782211, 25042823
17721717, 17239687, 25248384, 25634317, 20134113, 20273319, 28501075
30624864, 21063322, 31834759, 17344412, 22507210, 16354467, 21795111
25505371, 16777840, 25879984, 17811456, 19730508, 17385178, 18166013
17484762, 10136473, 6599380, 20717359, 20296213, 27097854, 13955826
18193833, 16837842, 17545847, 18964939, 19871910, 25505382, 14786201
17811447, 18554763, 21132297, 25957038, 20004087, 17889583, 19544839
26631046, 22507234, 24719736, 18868646, 17042658, 20627866, 14106803
13951456, 18139690, 18277454, 13680635, 22750215, 25823754, 18554871
18515268, 20169408, 24908321, 17274537, 17602269, 26575788, 19032867
17762296, 14829250, 16929165, 14602788, 28849751, 21794615, 18899974
29944660, 18441944, 14521218, 17811789, 20074391, 14852021, 17705023
13645875, 24316947, 16668584, 17786278, 25947799, 20879889, 19578350
28022101, 22594718, 16384983, 26439748, 17957017, 17570240, 19121551
19788842, 18382302, 27086138, 21330264, 21197626, 14338435, 13944971
21656630, 22826067, 18886413, 17156148, 17936109, 20509482, 27255377
24717859, 18762750, 21526048, 24560906, 17238511, 18096714, 26078387
27053456, 20144308, 25364628, 18244962, 19433930, 20476175, 19297917
19330795, 21174504, 18280813, 31506720, 28819280, 17614227, 28357401
21911701, 25809524, 17006183, 18092127, 19727057, 17695685, 26039623
22820579, 20856766, 15861775, 17258582, 21668627, 19487147, 20925795
28100487, 22760679, 26482376, 19554106, 21629064, 18199537, 18091059
17299889, 26999139, 21538485, 17546761, 26336977, 25775213, 18155762
30803210, 16956380, 31194264, 19207156, 14705949, 23105538, 26198926
19258504, 16314254, 17890099, 17246576, 17655634, 16989630, 20067212
19721304, 25077278, 19490948, 18203835, 18203838, 18973907, 18203837
29483672, 19615136, 17587063, 18000422, 18641451, 18090142, 21641760
17019086, 30559616, 19373893, 18373438, 21820934, 18641461, 17346091
21422580, 22351572, 18604493, 23008056, 22901797, 18610915, 22666802
17892268, 31668061, 17501491, 20907061, 14354737, 17835048, 21787056
22195485, 22782647, 17082983, 23266217, 18641419, 16618694, 14133975
22195492, 18331812, 18093615, 24385983, 25897615, 20513399, 21281607
13866822, 18841764, 17600719, 17842825, 20558005, 17088068, 9756271
22195465, 18440047, 19211433, 21515534, 20331945, 22686674, 18384537
18607546, 17254374, 18315328, 31172207, 23115139, 28790634, 21394225
16360112, 22195477, 17726838, 18510194, 17571306, 24766121, 17302277
21842740, 17551709, 26910644, 17634921, 28566241, 25489607, 16538760
--------------------------------------------------------------------------------
OPatch succeeded.
[oracle@rhel64 ~]$
编译无效对象,确保无效对象为零
对于正在打补丁的Oracle主机上运行的每个数据库实例,使用SQL*Plus连接到数据库。作为SYSDBA连接,确保无效对象设置为零,如果无效对象不为零,则使用utlrp.sql。然后运行catbundle
cd $ORACLE_HOME/rdbms/admin
[oracle@rhel64 admin]$ sqlplus / as sysdba
SQL>@catbundle.sql psu apply
如果OJVM PSU应用于以前的PSU补丁,则在执行catbundle后可能会看到无效的Java类。上一步中的SQL脚本。如果是这种情况,请运行utlrp。sql来重新验证这些Java类
SQL> @utlrp.sql
此补丁现在包含OJVM缓解补丁(补丁:19721304)。如果已安装OJVM PSU或计划安装OJVM PSU,则无需进一步操作。否则,可以激活使用OJVM缓解补丁的解决方案
SQL>@dbmsjdev.sql
补丁卸载
非Oracle RAC环境补丁卸载,运行OPatch实用程序,指定回滚参数
opatch rollback -id 31537677