Oracle 12C数据库PSU补丁安装方式的变化---新增datapatch
需求:安装Oracle 12.1.0.2数据库的PSU 20160719补丁
一.安装步骤:
1.补丁下载
将/usr/ccs/bin和OPatch路径加到$PATH中:
csssit@msuu335:/csssitarch$ echo $PATH
/usr/bin:/usr/sbin:/usr/local/bin:/csssitapp/oracsssit/12.1.0/bin:/usr/ccs/bin:/csssitapp/oracsssit/12.1.0/OPatch
MOS上下载最新的opatch补丁:p6880880_122010_SOLARIS64.zip
cd $ORACLE_HOME
mv OPatch OPatch_old
uzip p6880880_122010_SOLARIS64.zip -d $ORACLE_HOME/
chown -R csssit:dba $ORACLE_HOME/OPatch
MOS上下载12.1.0.2的PSU 20160719补丁:p23273629_121020_SOLARIS64.zip
2.补丁安装
cd /csssitarch/software
mkdir psu
unzip p23273629_121020_SOLARIS64.zip ./psu
cd psu
cd 23273629
cd 23054246
opatch apply
根据提示输入Y,直到安装提示成功.
cd ..
cd 23054327
opatch apply
根据提示输入Y,直到安装提示成功.
csssit@msuu335:/csssitarch/software/psu/23273629$ opatch lsinventory
Installed Top-level Products (1):
Oracle Database 12c 12.1.0.2.0
There are 1 products installed in this Oracle Home.
Interim patches (2) :
Patch 23054327 : applied on Mon Sep 12 17:47:47 CST 2016
Unique Patch ID: 20235292
Patch description: "OCW Patch Set Update : 12.1.0.2.160719 (23054327)"
Created on 16 Jul 2016, 15:20:37 hrs UTC
Bugs fixed:
21339083, 19701617, 18589889, 20768643, 19139608, 19280860, 19061429
21453435, 19133945, 19341538, 19521169, 20011424, 18946768, 19135521
18604143, 19361757, 19187207, 19302350, 19627476, 19130141, 19530755
20568884, 20317221, 19699720, 20177779, 19620918, 19168690, 19266658
18899171, 19244316, 19653795, 18330979, 19027351, 18634372, 19471722
21227730, 18707416, 19536337, 19184188, 19131709, 21113068, 20235486
19925992, 20160490, 20006646, 20995001, 18991776, 18439295, 15922206
21131037, 19380733, 21245437, 18943696, 20552947, 19591984, 19550195
19163425, 18135723, 20014326, 19524857, 18849021, 18890943, 18861196
19154753, 17940721, 18524834, 18748932, 18835283, 19522313, 19184765
19499021, 21639478, 19046190, 20923930, 14851828, 20028666, 19051385
19050688, 19682695, 19831611, 20598625, 19226141, 21607972, 19053891
18871287, 18998228, 18922918, 18980002, 21087799, 18956780, 19683886
19325604, 19682778, 23757020, 19026993, 18777835, 20110156, 17338864
21269977, 18261648, 18362971, 19558324, 22651583, 18945906, 19513650
20185476, 18952577, 19702758, 18882642, 19478119, 19414274, 17447588
19262534, 20752167, 19147513, 21242118, 19514085, 19473088, 20758997
19178517, 18729269, 19529729, 19659885, 19455563, 19319904, 20877072
18703978, 18536826, 20340620, 19700256, 19703246, 19292605, 20467806
22264951, 19192901, 21527118, 20920711, 20660273, 20011635, 17592037
22989069, 19479503, 19147751, 19029647, 19179158, 22302421, 18901356
19140712, 20012766, 21232394, 18964974, 22162062, 18835366, 19184276
19013789, 19207286, 20001507, 20510208, 18950232, 22583325, 19259765
19148791, 19680763, 20079414, 19556820, 16505171, 22135419, 19449737
18962892, 21646169, 19187515, 19513888, 19230771, 14661880, 21519340
20218012, 21222147, 20795241, 19453778, 19853036, 19551830, 19068333
21616278, 18843572, 18520351, 18945435, 19185148, 19232454, 20775015
21220597, 18541110, 19319192, 18834955, 19204743, 19178629, 20839581
19304104, 21694237, 19140891, 18747335, 19284357, 20676340, 19270660
19457575, 20725084, 21297657, 19021575, 19069755, 18715884, 18798573
19584688, 19018001, 19812592, 19325701, 19270956, 19292272, 21967791
20877003, 21794779, 18700893, 19222693, 19662663, 21276514, 18406774
19684131, 20607821, 19010177, 21082737, 19272663, 18910576, 18907170
21694632, 19426384, 9372680, 20115586, 20883009, 19700294, 19164099
20289828, 19331454, 18283792, 20278216, 20827053, 19155350, 20119857
19703199, 22456393, 20588164, 18955644, 20991879, 18508710, 19908346
18798432, 19146822, 19589221, 21123424, 18952857, 19471836, 19537762
20936562, 21152052, 16286734, 18750781, 20669114, 18762843, 18945249
19045143, 19146980, 22483804, 19184799, 19205086, 19601003, 20099624
19351363, 21378016, 20091753, 18862203, 19281106, 19537547, 19031737
19079087, 19148367, 18968981, 19150517, 20231741, 19954372, 19217019
18730096, 18235274, 18975620, 19205617, 19513351, 18843054, 19150313
20219458, 18708349, 19332386, 18953639, 19067804, 21423055, 21259359
19371270, 19203996, 19054979, 19209951, 19318983, 18747382, 20038431
19154673, 18752378, 22905714, 19150088, 19370846, 19013444, 19234177
21053036, 18998379, 20157569, 21357522, 18999857, 19273577, 19075747
19367276, 19632437, 18990354, 19288396, 19874047, 19612597, 19557558
20620581, 19427050, 19127078, 18910443, 20900588, 22088198, 20053557
20033787, 19315567, 19444471, 19148982, 20953798, 18290252, 18813323
19915945, 19777496, 19500293, 20730170, 18643483, 19277814, 19134098
18523468, 20562133, 19071526, 21420753, 18965694, 19226858, 18850051
20433932, 19602208, 19591356, 22884308, 20061168, 18417590, 19370739
18920408, 20822591, 18636884, 19609388, 20136892, 18776786, 18989446
22289350, 19148793, 19043795, 19585454, 20746507, 18260170, 18317489
19955755, 18919682, 19059053, 19807548, 19124972, 18678829, 19147509
18849896, 19617592, 18910748, 18953878, 19273758, 19319357, 19076165
18999195, 19498411, 19704993, 18759724, 21294273, 19459023, 20634511
21474380, 19066844, 21484367, 20276459, 17208793, 19234907, 20290467
13843841, 19538714, 19649640, 19383028, 19062675, 21924910, 19513969
22195657, 18859710, 20862812, 19504641, 19341481, 18304090, 20293730
19986391, 19343245, 19314048, 18834934, 19473851, 19241655, 19458082
18242738, 19470791, 18894342, 20649573, 18372060, 19522067, 18953889
18827679, 19259290, 19023430, 19140711, 19045388, 20186278, 19241857
19522571, 19076778, 18875012, 19709663, 18861564, 19066699, 19273760
19225265, 15885689, 20853464, 18819158, 21696068, 19068003, 18937186
20267877, 19049721, 21394146, 19916737, 19368917, 22393909, 21255373
19635215, 18868829, 19613533, 20579351, 20408163, 20350915, 21327402
21057239, 22024217, 20783416, 19315522, 19141785, 23101338, 19163887
19885321, 19820247, 18715868, 18852058, 20363708, 19538241, 19804032
Patch 23054246 : applied on Mon Sep 12 17:44:03 CST 2016
Unique Patch ID: 20274131
Patch description: "Database Patch Set Update : 12.1.0.2.160719 (23054246)"
Created on 13 Jul 2016, 06:40:56 hrs PST8PDT
Sub-patch 22291127; "Database Patch Set Update : 12.1.0.2.160419 (22291127)"
Sub-patch 21948354; "Database Patch Set Update : 12.1.0.2.160119 (21948354)"
Sub-patch 21359755; "Database Patch Set Update : 12.1.0.2.5 (21359755)"
Sub-patch 20831110; "Database Patch Set Update : 12.1.0.2.4 (20831110)"
Sub-patch 20299023; "Database Patch Set Update : 12.1.0.2.3 (20299023)"
Sub-patch 19769480; "Database Patch Set Update : 12.1.0.2.2 (19769480)"
Bugs fixed:
19189525, 21847223, 21099555, 21649497, 19075256, 19141838, 22762046
22075064, 20117253, 19865345, 19791273, 18845653, 19280225, 19248799
19243521, 20951038, 18988834, 21756699, 21281532, 19238590, 21184223
18921743, 20245930, 18799063, 19134173, 20373598, 19571367, 20476175
20925795, 19018206, 20509482, 20711718, 20387265, 20588502, 19149990
21263635, 18849537, 18886413, 17551063, 22507210, 19183343, 19366375
19703301, 21917884, 19001390, 18202441, 19189317, 20267166, 19644859
19390567, 19358317, 19279273, 19706965, 18549238, 16863642, 19068970
22528741, 18797519, 20825533, 19619732, 18607546, 20348653, 19649152
19670108, 18940497, 18948177, 19315691, 19676905, 18964978, 19176326
20165574, 19035573, 20413820, 17867700, 20558005, 19176223, 19532017
20904530, 20134339, 19450314, 19074147, 22353346, 20868862, 18411216
22507234, 20361671, 20425790, 18966843, 20009833, 22366558, 21329301
20294666, 18191823, 19333670, 19195895, 19371175, 19307662, 19154375
20043616, 20124446, 18914624, 19468991, 19883092, 21291274, 19382851
19520602, 19174521, 21875360, 19676012, 19326908, 19658708, 19591608
19402853, 20093776, 20618595, 21787056, 22380919, 21246723, 17835294
19721304, 19068610, 19791377, 21665897, 22178855, 22173980, 20048359
20746251, 19143550, 20898391, 19185876, 19627012, 20281121, 19577410
22092979, 19001359, 14283239, 19518079, 18610915, 19490948, 17532734
18674024, 18306996, 19309466, 19081128, 19524158, 19915271, 20122715
21188532, 18791688, 20284155, 20890311, 21442094, 20596234, 18973548
21296029, 19303936, 19597439, 20936905, 20235511, 21220620, 20880215
18964939, 21756677, 19888853, 19534363, 19430401, 19354335, 19044962
19639483, 22296366, 22353199, 21153266, 19409212, 19879746, 20657441
19684504, 20528052, 19024808, 20977794, 20378086, 18799993, 21756661
21260431, 18740837, 22923409, 19028800, 20877664, 20228093, 20879889
19065556, 19723336, 19077215, 19604659, 21421886, 19524384, 17722075
19308965, 18288842, 19048007, 19689979, 20446883, 18952989, 16870214
19928926, 19835133, 21629064, 21526048, 19197175, 19180770, 20466628
19902195, 19931709, 20318889, 19013183, 19730508, 19012119, 19067244
20074391, 20356733, 14643995, 19512341, 19841800, 20331945, 19587324
19065677, 19547370, 19578350, 21225209, 19637186, 20397490, 18967382
19174430, 21241829, 19054077, 18674047, 20898997, 19708632, 19536415
21091431, 19289642, 20869721, 22168163, 19335438, 19258504, 20447445
17365043, 18856999, 19468347, 19869255, 20471920, 21373473, 21620471
16359751, 18990693, 17890099, 19769480, 19439759, 19272708, 18990023
19978542, 19329654, 20101006, 21300341, 20402832, 19873610, 20848335
23229229, 21744290, 21668627, 21517440, 13542050, 19304354, 19052488
20794034, 19291380, 21915719, 23260854, 18681056, 20952966, 19896336
19076343, 19561643, 18618122, 19990037, 20440930, 18456643, 19699191
19201867, 19487147, 18909599, 20831538, 19016730, 18250893, 20798891
18743542, 20347562, 16619249, 18354830, 22551446, 19777862, 19687159
21373076, 19174942, 20424899, 21188584, 19989009, 17414008, 20688221
21899588, 20441797, 19157754, 19058490, 19032777, 22815955, 19399918
18885870, 19434529, 21273804, 19018447, 21450666, 18893947, 18851894
16923858, 18417036, 20919320, 19022470, 19284031, 20474192, 20173897
22046677, 22062026, 19501299, 19385656, 20920911, 17274537, 20899461
21315084, 19440586, 16887946, 22374754, 17319928, 19606174, 20708701
18436647, 17655240, 19023822, 19124589, 19178851, 16439813, 19805359
19597583, 18499088, 19155797, 19050649, 19393542
--------------------------------------------------------------------------------
OPatch succeeded.
3.补丁注册
将补丁注册到数据字典中:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
执行成功后,查看:
SQL> select * from dba_registry_history;
no rows selected
没有记录,查阅资料显示12C改为查看:
SQL> select patch_id,action,status from dba_registry_sqlpatch;
no rows selected
同样没有记录,后面从网上查到12C的补丁注册改成了用datapatch工具。
改为datapatch执行操作:
csssit@msuu335:cd $ORACLE_HOME/OPatch
csssit@msuu335:~/12.1.0/OPatch$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 on Tue Sep 13 08:51:19 2016
Copyright (c) 2016, Oracle. All rights reserved.
Log file for this invocation: /csssitapp/oracsssit/cfgtoollogs/sqlpatch/sqlpatch_21004_2016_09_13_08_51_19/sqlpatch_invocation.log
Connecting to database...OK
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of SQL patches:
Bundle series PSU:
ID 160719 in the binary registry and not installed in the SQL registry
Adding patches to installation queue and performing prereq checks...
Installation queue:
Nothing to roll back
The following patches will be applied:
23054246 (Database Patch Set Update : 12.1.0.2.160719 (23054246))
Installing patches...
Patch installation complete. Total patches installed: 1
Validating logfiles...
Patch 23054246 apply: SUCCESS
logfile: /csssitapp/oracsssit/cfgtoollogs/sqlpatch/23054246/20274131/23054246_apply_CSSSIT_2016Sep13_08_52_27.log (no errors)
SQL Patching tool complete on Tue Sep 13 08:52:57 2016
SQL> select patch_id,action,status from dba_registry_sqlpatch;
PATCH_ID ACTION STATUS
---------- --------------- ---------------
23054246 APPLY SUCCESS
SQL> select * from dba_registry_history;
no rows selected
现在通过dba_registry_sqlpatch已查看到了注册的补丁,而通过dba_registry_history依然没有记录。
二.Datapatch工具说明:
数据库 12c Datapatch 是 Oracle 数据库 12c 中的另一个新工具,它可以自动为数据库补丁执行 post-patch SQL 操作。
Datapatch 通过匹配一个内部存储库与 patch inventory 来决定所需的应用/回滚操作。 Datapatch 驻留在的 opatch 目录,即 $ORACLE_HOME/OPatch 文件夹(在 Windows 平台上: %ORACLE_HOME%\OPatch)。
数据库 12c Datapatch 支持 Oracle 多租户,并且简化并加快了多个数据库打补丁的过程。
哪些补丁工具使用了 Datapatch?
Opatchauto
OPatchAuto 自动调用 datapatch 完成安装数据库的二进制补丁并重启后 post patch 的操作。
企业管理云控制(Enterprise Manager Cloud Control)
从 12.1 版本开始,EMCC 现在调用 datapatch 来完成任何 12c 或者更高版本的数据库重启之后的 post patch 的操作
升级
Catctl.pl 和 DBUA 现在在升级过程中调用 Datapatch
OPatch
Datapatch 与 OPatch 的整合是不可能的。因为 OPatch 在数据库关闭时执行,而 datapatch 要求数据库是打开以完成其活动。
SQL 补丁注册表(SQL Patch Registry table)
该表包含了哪些 SQL 补丁已经被应用和/或回滚在给定的数据库的信息。每个数据库都有一个 SQL 补丁注册表,因此,如果在同一个 Oracle 主目录中运行多个数据库,每个数据库都有自己的 SQL 补丁注册表。
要在注册表中检查 datapatch 条目,从 SQL 提示符下键入以下命令:
select * from dba_registry_sqlpatch;
数据库 12.1.0.2 功能增强
下列的功能增强是在数据库 12c 补丁集 12.1.0.2 引入:
dba_registry_history 不再用作为补丁信息
datapatch -rollbackall 选项可用来回滚当前已安装的所有 SQL 补丁
Catbundle 被整合到 datapatch
Datapatch 支持的补丁类型:
"Napply" Patch
Composite Patches
One-off Patches