什么是OJVM PSU?
CPU: Critical Patch Update
Oracle对于其产品每个季度发行一次的安全补丁包,通常是为了修复产品中的安全隐患。
PSU: Patch Set Updates
Oracle对于其产品每个季度发行一次的补丁包,包含了bug的修复。Oracle选取被用户下载数量多的,并且被验证过具有较低风险的补丁放入到每个季度的PSU中。在每个PSU中不但包含Bug的修复而且还包含了最新的CPU。OJVM PSU主要是针对oracle java VM
从2014年10月开始Oracle Java VM组件作为一个单独的部分来进行安装。之前是包含在oracle rdbms psu中。只要oracle db中安装jvm组件,就需要安装对应版本的oracle JavaVM
PSU。如果只是打了rdbms的PSU,安全漏洞检查就会检查出jvm的安全漏洞。“Oracle JavaVM Component Database PSU” (OJVM PSU) Patches (文档 ID 1929745.1)
单实例安装
上传并解压补丁包
[oracle@oracle ~]$ ls p31668908_112040_Linux-x86-64.zip
p31668908_112040_Linux-x86-64.zip
[oracle@oracle ~]$ pwd
/home/oracle
[oracle@oracle ~]$ ll 31668908
total 56
drwxr-x--- 3 oracle oinstall 20 Sep 8 2020 etc
drwxr-x--- 9 oracle oinstall 96 Sep 8 2020 files
-rw-rw-r-- 1 oracle oinstall 51108 Oct 19 16:08 README.html
-rw-r--r-- 1 oracle oinstall 21 Sep 8 2020 README.txt
验证与当前环境是否有冲突
[oracle@oracle ~]$ cd 31668908
[oracle@oracle 31668908]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /opt/oracle/product/11.2.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /opt/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-03-31_16-56-46PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
停库停监听
SQL> shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
[oracle@oracle 31668908]$ lsnrctl stop
安装
[oracle@oracle 31668908]$ $ORACLE_HOME/OPatch/opatch napply -local /home/oracle/31668908/ -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /opt/oracle/product/11.2.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /opt/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-03-31_17-02-01PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 31668908
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/11.2.0/dbhome_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '31668908' to OH '/opt/oracle/product/11.2.0/dbhome_1'
ApplySession: Optional component(s) [ oracle.sqlj, 11.2.0.4.0 ] , [ oracle.sqlj.companion, 11.2.0.4.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.javavm.server, 11.2.0.4.0...
Patching component oracle.precomp.common, 11.2.0.4.0...
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.javavm.client, 11.2.0.4.0...
Patching component oracle.dbjava.jdbc, 11.2.0.4.0...
Patching component oracle.dbjava.ic, 11.2.0.4.0...
Patch 31668908 successfully applied.
Log file location: /opt/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-03-31_17-02-01PM_1.log
OPatch succeeded.
[oracle@oracle 31668908]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /opt/oracle/product/11.2.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /opt/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-03-31_17-11-06PM_1.log
Lsinventory Output file location : /opt/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2021-03-31_17-11-06PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: oracle.node.com
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 (2) :
Patch 31668908 : applied on Wed Mar 31 17:02:23 CST 2021
Unique Patch ID: 23800881
Patch description: "OJVM PATCH SET UPDATE 11.2.0.4.201020"
Created on 8 Sep 2020, 03:18:03 hrs PST8PDT
Bugs fixed:
23727132, 19554117, 19006757, 14774730, 18933818, 18458318, 18166577
19231857, 19153980, 19058059, 19007266, 17285560, 17201047, 17056813
19223010, 19852360, 19909862, 19895326, 19374518, 20408829, 21047766
21566944, 19176885, 17804361, 17528315, 21811517, 22253904, 19187988
21911849, 22118835, 22670385, 23265914, 22675136, 24448240, 25067795
24534298, 25076732, 25494379, 26023002, 19699946, 26637592, 27000663
25649873, 27461842, 27952577, 27642235, 28502128, 28915933, 29254615
29774367, 29992392, 29448234, 30160639, 30534664, 30855121, 31306274
30772207, 31476032, 30561292, 28394726, 26716835, 24817447, 23082876
31668867
Patch 31537677 : applied on Mon Mar 29 17:52:08 CST 2021
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, 17325413, 17082359
12747740, 30517516, 22168163, 16091637, 20569094, 31492144, 17468141
30365745, 29962939, 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, 28079127, 22568797
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, 18331850, 17945983
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, 17545847, 16837842, 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, 19121551, 17570240
19788842, 18382302, 27086138, 21330264, 21197626, 14338435, 13944971
21656630, 22826067, 18886413, 17156148, 17936109, 20509482, 27255377
24717859, 18762750, 21526048, 24560906, 18096714, 17238511, 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@oracle 31668908]$ cd $ORACLE_HOME/sqlpatch/31668908
[oracle@oracle 31668908]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 31 17:17:13 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area 4977278976 bytes
Fixed Size 2261768 bytes
Variable Size 1006636280 bytes
Database Buffers 3959422976 bytes
Redo Buffers 8957952 bytes
Database mounted.
Database opened.
SQL> @postinstall.sql
--执行的时间有点长,耐心等待,输出也很多,不全粘贴出来
24-FEB-20 03.08.30.126863 PM
APPLY
SERVER
11.2.0.4
0
Patchset 11.2.0.2.0
PSU
31-MAR-21 05.24.49.900871 PM
APPLY
SERVER
11.2.0.4.201020OJVMPSU
0
OJVM PSU post-install
31-MAR-21 05.24.48.577499 PM
jvmpsu.sql
SERVER
11.2.0.4.201020OJVMPSU
0
RAN jvmpsu.sql
29-MAR-21 06.05.28.701273 PM
APPLY
SERVER
11.2.0.4
201020
PSU 11.2.0.4.201020
PSU
31-MAR-21 05.24.49.904952 PM
APPLY
31668908
Patch 31668908 applied
6 rows selected.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 4977278976 bytes
Fixed Size 2261768 bytes
Variable Size 1040190712 bytes
Database Buffers 3925868544 bytes
Redo Buffers 8957952 bytes
Database mounted.
Database opened.
执行了postinstall.sql
之后可能会有新的无效对象,编译一下
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
--最后一部分输出如下
ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
启动监听验证
DataGuard
环境打OJVM
环境是双节点RAC
+单实例DG
核心步骤
1.主库禁用日志传送到备库
2.关闭备库应用补丁,但不执行脚本(catpatch.sql等),启动到mount,不启用日志恢复
3.关闭主库应用补丁,执行脚本(run catpatch/catbundle/catcpu等)
4.启动主库,重新开启日志传送到备库
5.备库开启日志恢复
6.检查补丁应用情况
主库任一节点执行
SYS@racdb2> alter system set log_archive_dest_state_2=defer scope=both sid='*';
System altered.
备库执行
SQL>alter database recover managed standby database cancel;
SQL>shu immediate;
[oracle@173adg soft]$ lsnrctl stop
上传解压补丁包(注意权限)
[oracle@173adg soft]$ ll
total 16
drwxr-xr-x 4 oracle oinstall 67 Sep 8 2020 31668908
校验与当前环境是否冲突
[oracle@173adg soft]$ cd 31668908/
[oracle@173adg 31668908]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-04-01_11-17-06AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
应用补丁
[oracle@173adg 31668908]$ $ORACLE_HOME/OPatch/opatch napply -local /u01/soft/31668908/ -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-04-01_11-17-44AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 31668908
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 = '/u01/app/oracle/product/11.2.0/dbhome_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '31668908' to OH '/u01/app/oracle/product/11.2.0/dbhome_1'
ApplySession: Optional component(s) [ oracle.sqlj, 11.2.0.4.0 ] , [ oracle.sqlj.companion, 11.2.0.4.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.javavm.server, 11.2.0.4.0...
Patching component oracle.precomp.common, 11.2.0.4.0...
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.javavm.client, 11.2.0.4.0...
Patching component oracle.dbjava.jdbc, 11.2.0.4.0...
Patching component oracle.dbjava.ic, 11.2.0.4.0...
Patch 31668908 successfully applied.
Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-04-01_11-17-44AM_1.log
OPatch succeeded.
备库查询验证
[oracle@173adg 31668908]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2021-04-01_11-27-16AM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2021-04-01_11-27-16AM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: 173adg
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 (2) :
Patch 31668908 : applied on Thu Apr 01 11:18:02 CST 2021
Unique Patch ID: 23800881
Patch description: "OJVM PATCH SET UPDATE 11.2.0.4.201020"
Created on 8 Sep 2020, 03:18:03 hrs PST8PDT
Bugs fixed:
--输出太长,不全粘贴
备库启动到mount
状态,不开启应用
SQL> startup mount;
ORACLE instance started.
Total System Global Area 8.0973E+10 bytes
Fixed Size 2261968 bytes
Variable Size 1.1006E+10 bytes
Database Buffers 6.9793E+10 bytes
Redo Buffers 171487232 bytes
Database mounted.
启动监听
[oracle@173adg soft]$ lsnrctl start
RAC
应用OJVM
两个节点都上传并解压patch
(注意权限)
只粘贴一个节点,其他节点也验证一下
[oracle@racbj01 soft]$ pwd
/u01/soft
[oracle@racbj01 soft]$ ll
total 47452
drwxr-xr-x 4 oracle oinstall 4096 Sep 8 2020 31668908
节点一
验证当前环境有没有冲突(其他节点输出一样,不粘贴了)
[oracle@racbj01 soft]$ cd 31668908/
[oracle@racbj01 31668908]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2021-04-01_11-33-56AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
根据MOS
,RAC
环境所有节点要停instance
,但是没有提到listener
Ensure that you shut down all the services running from the Oracle
home.For a Non Oracle RAC environment, shut down all databases and
listeners associated with the Oracle home that you are updating. For
more information, see Oracle Database Administrator’s Guide.For an Oracle RAC environment, shut down all the services (database)
running from the Oracle home on all the nodes you want to patch. After
all nodes are patched, start all services. OPatch is used on only one
node at a time.
RAC其中一个节点执行
[grid@racbj01 ~]$ srvctl stop database -d racdb
应用补丁,两个节点都执行,只粘贴一个节点
[oracle@racbj01 31668908]$ $ORACLE_HOME/OPatch/opatch napply -local /u01/soft/31668908/ -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.25
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version : 11.2.0.3.25
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2021-04-01_11-35-59AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 31668908
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 = '/u01/app/oracle/product/11.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '31668908' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.sqlj, 11.2.0.4.0 ] , [ oracle.sqlj.companion, 11.2.0.4.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.javavm.server, 11.2.0.4.0...
Patching component oracle.precomp.common, 11.2.0.4.0...
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.javavm.client, 11.2.0.4.0...
Patching component oracle.dbjava.jdbc, 11.2.0.4.0...
Patching component oracle.dbjava.ic, 11.2.0.4.0...
Patch 31668908 successfully applied.
Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2021-04-01_11-35-59AM_1.log
OPatch succeeded.
RAC
其中一个节点执行
/u01/soft/31668908/files/sqlpatch/31668908
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
这里注意上面的命令alert
有可能报错ORA-15025
,具体是因为一个文件属性权限的问题,参考
https://blog.csdn.net/weixin_34308389/article/details/85831155
SYS@racdb2> alter system set cluster_database=false scope=spfile;
System altered.
SYS@racdb2> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@racdb2> startup upgrade
ORACLE instance started.
Total System Global Area 8.0973E+10 bytes
Fixed Size 2261968 bytes
Variable Size 1.5032E+10 bytes
Database Buffers 6.5767E+10 bytes
Redo Buffers 171487232 bytes
Database mounted.
Database opened.
SQL> @postinstall.sql
21-MAR-21 07.25.01.086133 PM
APPLY SERVER
11.2.0.4 0
Patchset 11.2.0.2.0
PSU
01-APR-21 12.09.43.822423 PM
APPLY SERVER
11.2.0.4.201020OJVMPSU 0
OJVM PSU post-install
01-APR-21 12.09.42.587503 PM
jvmpsu.sql SERVER
11.2.0.4.201020OJVMPSU 0
RAN jvmpsu.sql
31-MAR-21 03.51.43.080749 PM
APPLY SERVER
11.2.0.4 201020
PSU 11.2.0.4.201020
PSU
01-APR-21 12.09.43.826342 PM
APPLY
31668908
Patch 31668908 applied
6 rows selected.
SYS@racdb2> alter system set cluster_database=true scope=spfile;
System altered.
SYS@racdb2> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@racdb2> startup
Total System Global Area 8.0973E+10 bytes
Fixed Size 2261968 bytes
Variable Size 1.5032E+10 bytes
Database Buffers 6.5767E+10 bytes
Redo Buffers 171487232 bytes
Database mounted.
Database opened.
安装修补程序的 SQL
部分后,某些包可能会失效。这将在访问后重新组合,或者您可以运行以使其恢复到有效状态。utlrp.sql
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
--输出很长,粘贴最后一部分
ERRORS DURING RECOMPILATION
---------------------------
46
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
最后RAC
所有节点都启动,验证一下
SELECT *
FROM dba_registry_history
DG重新恢复应用
主库恢复传输日志
SYS@racdb2> alter system set log_archive_dest_state_2=enable scope=both sid='*';
System altered.
备库执行,开启介质恢复
SQL> alter database recover managed standby database disconnect from session;
备库alert
的一部分
Media Recovery Log /u01/app/oracle/arch2_106_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_107_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_108_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_109_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_110_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_111_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_112_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_113_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_114_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_115_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_116_1067800873.arc
Thu Apr 01 12:35:06 2021
Media Recovery Log /u01/app/oracle/arch2_117_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_118_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_119_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_120_1067800873.arc
Media Recovery Log /u01/app/oracle/arch2_121_1067800873.arc
只读打开备库
SQL> alter database open read only;
Database altered.
备库开启实时应用
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
查看备库状态
SQL> select process,client_process,thread#,sequence#,status from v$managed_standby;
PROCESS CLIENT_PROCESS THREAD# SEQUENCE# STATUS
--------------------------- ------------------------ ---------- ---------- ------------------------------------
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 1 172 CLOSING
ARCH ARCH 1 170 CLOSING
ARCH ARCH 1 173 CLOSING
ARCH ARCH 2 85 CLOSING
ARCH ARCH 1 174 CLOSING
ARCH ARCH 0 0 CONNECTED
RFS ARCH 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS LGWR 1 175 IDLE
RFS ARCH 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS LGWR 2 130 IDLE
MRP0 N/A 1 175 APPLYING_LOG
18 rows selected.
验证备库的补丁信息
set line 200
col ACTION_TIME for a30
col ACTION for a15
col NAMESPACE for a10
col VERSION for a30
col BUNDLE_SERIES for a10
col COMMENTS for a30
SQL> select * from dba_registry_history;
ACTION_TIME ACTION NAMESPACE VERSION ID BUNDLE_SER COMMENTS
------------------------------ --------------- ---------- ------------------------------ ---------- ---------- ------------------------------
24-AUG-13 12.03.45.119862 PM APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0
21-MAR-21 07.25.01.086133 PM APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0
31-MAR-21 03.51.43.080749 PM APPLY SERVER 11.2.0.4 201020 PSU PSU 11.2.0.4.201020
01-APR-21 12.09.42.587503 PM jvmpsu.sql SERVER 11.2.0.4.201020OJVMPSU 0 RAN jvmpsu.sql
01-APR-21 12.09.43.822423 PM APPLY SERVER 11.2.0.4.201020OJVMPSU 0 OJVM PSU post-install
01-APR-21 12.09.43.826342 PM APPLY 31668908 Patch 31668908 applied
6 rows selected.