一、使用opatch工具分析补丁冲突
[oracle@ogg2 ~]$ export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
[oracle@ogg2 ~]$ opatch lsinv
Oracle Interim Patch Installer version 12.2.0.1.6
Copyright (c) 2018, Oracle Corporation. All rights reserved.
Oracle Home : /u01/oracle/product/12.2.0/db_1
Central Inventory : /u01/oraInventory
from : /u01/oracle/product/12.2.0/db_1/oraInst.loc
OPatch version : 12.2.0.1.6
OUI version : 12.2.0.1.4
Log file location : /u01/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2018-03-13_13-31-30PM_1.log
Lsinventory Output file location : /u01/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-03-13_13-31-30PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: ogg2
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 12c 12.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
将lsinventory2018-03-13_13-31-30PM.txt工具下载到本地
登录my oracle support网站,选择到指定补丁页面,并“使用OPATCH工具进行分析”
将文件附加到服务器中,并点击“分析”进行分析。
二、OPATCH更新
Database Release Update (DB RU) 12.2.0.1.180116 patches are cumulative. That is, the content of all previous DB RUs is included in the latest DB RU patch. 该补丁是积累型,包含以往补丁
To install the DB RU 12.2.0.1.180116 patch, the Oracle home must have the 12.2.0.1.0 Database installed.
要求数据库软件必须为11.2.0.1
You must use the OPatch utility version 12.2.0.1.6 or later to apply this patch。
必须使用opatch12.2.0.1.7以上(12.2.0.1默认opatch为12.2.0.1.6)。
[oracle@ogg2 db_1]$ mv OPatch/ OPatchbk
[oracle@ogg2 db_1]$ unzip p6880880_122010_Linux-x86-64.zip -d /u01/oracle/product/12.2.0/db_1/
[oracle@ogg2 db_1]$ opatch version
OPatch Version: 12.2.0.1.12
OPatch succeeded.
三、安装说明
If you are using a Data Guard Physical Standby database, you must install this patch on both the primary database and the physical standby database, as described by My Oracle Support Document 278641.1.
若是db环境,需要主备库均安装补丁;
If this is a RAC environment, install the DB RU patch using the OPatch rolling (no downtime) installation method as the DB RU patch is rolling RAC installable. Refer to My Oracle Support Document 244241.1 Rolling Patch - OPatch Support for RAC.
若是rac环境,使用opatch滚动安装补丁,不停机情况。
If this is not a RAC environment, shut down all instances and listeners associated with the Oracle home that you are updating. For more information, see Oracle Database Administrator's Guide.
若为单实例,关闭监听及实例。
Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following commands:
安装方式:
unzip p27105253_12201_
.zip
cd 27105253
opatch apply
[oracle@ogg2 27105253]$ opatch apply
Oracle Interim Patch Installer version 12.2.0.1.12
Copyright (c) 2018, Oracle Corporation. All rights reserved.
Oracle Home : /u01/oracle/product/12.2.0/db_1
Central Inventory : /u01/oraInventory
from : /u01/oracle/product/12.2.0/db_1/oraInst.loc
OPatch version : 12.2.0.1.12
OUI version : 12.2.0.1.4
Log file location : /u01/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2018-03-13_14-43-27PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 27105253
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/oracle/product/12.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '27105253' to OH '/u01/oracle/product/12.2.0/db_1'
ApplySession: Optional component(s) [ oracle.has.crs, 12.2.0.1.0 ] , [ oracle.ons.daemon, 12.2.0.1.0 ] , [ oracle.network.cman, 12.2.0.1.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.network.rsf, 12.2.0.1.0...
Patching component oracle.rdbms.deconfig, 12.2.0.1.0...
Patching component oracle.tfa, 12.2.0.1.0...
Patching component oracle.rdbms, 12.2.0.1.0...
Patching component oracle.rdbms.util, 12.2.0.1.0...
Patching component oracle.rdbms.dbscripts, 12.2.0.1.0...
Patching component oracle.xdk.parser.java, 12.2.0.1.0...
Patching component oracle.has.deconfig, 12.2.0.1.0...
Patching component oracle.xdk.rsf, 12.2.0.1.0...
Patching component oracle.ctx.rsf, 12.2.0.1.0...
Patching component oracle.rdbms.rman, 12.2.0.1.0...
Patching component oracle.rdbms.dv, 12.2.0.1.0...
Patching component oracle.rdbms.oci, 12.2.0.1.0...
Patching component oracle.rdbms.crs, 12.2.0.1.0...
Patching component oracle.precomp.common, 12.2.0.1.0...
Patching component oracle.oracore.rsf, 12.2.0.1.0...
Patching component oracle.ctx, 12.2.0.1.0...
Patching component oracle.xdk, 12.2.0.1.0...
Patching component oracle.nlsrtl.rsf, 12.2.0.1.0...
Patching component oracle.rdbms.rsf, 12.2.0.1.0...
Patching component oracle.ons, 12.2.0.1.0...
Patching component oracle.rdbms.lbac, 12.2.0.1.0...
Patching component oracle.precomp.lang, 12.2.0.1.0...
Patching component oracle.rdbms.rsf.ic, 12.2.0.1.0...
Patching component oracle.sdo, 12.2.0.1.0...
Patch 27105253 successfully applied.
Log file location: /u01/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2018-03-13_14-43-27PM_1.log
OPatch succeeded.
[oracle@ogg2 27105253]$ opatch lspatches
27105253;Database Release Update : 12.2.0.1.180116 (27105253)
OPatch succeeded.
四、查看补丁信息
[oracle@ogg2 27105253]$ opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.12
Copyright (c) 2018, Oracle Corporation. All rights reserved.
Oracle Home : /u01/oracle/product/12.2.0/db_1
Central Inventory : /u01/oraInventory
from : /u01/oracle/product/12.2.0/db_1/oraInst.loc
OPatch version : 12.2.0.1.12
OUI version : 12.2.0.1.4
Log file location : /u01/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2018-03-13_14-53-14PM_1.log
Lsinventory Output file location : /u01/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-03-13_14-53-14PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: ogg2
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 12c 12.2.0.1.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch 27105253 : applied on Tue Mar 13 14:45:58 CST 2018
Unique Patch ID: 21862470
Patch description: "Database Release Update : 12.2.0.1.180116 (27105253)"
Created on 9 Jan 2018, 07:49:55 hrs PST8PDT
Bugs fixed:
23026585, 24336249, 24929210, 24942749, 25036474, 25110233, 25410877
25417050, 25427662, 25459958, 25547901, 25569149, 25600342, 25600421
25606091, 25655390, 25662088, 24385983, 24923215, 25099758, 25429959
25662101, 25728085, 25823754, 22594071, 23665623, 23749454, 24326846
24334708, 24560906, 24573817, 24578797, 24609996, 24624166, 24668398
24674955, 24744686, 24811725, 24827228, 24831514, 24908321, 24976007
25184555, 25210499, 25211628, 25223839, 25262869, 25316758, 25337332
25455795, 25457409, 25539063, 25546608, 25612095, 25643931, 25410017
22729345, 24485174, 24509056, 24714096, 25329664, 25410180, 25607726
25957038, 25973152, 26024732, 24376878, 24589590, 24676172, 23548817
24796092, 24907917, 25044977, 25736747, 25766822, 25856821, 25051628
24534401, 24835919, 25050160, 25395696, 25430120, 25616359, 25715167
25967985, 26546754, 26546664, 26544823, 26575788, 26271001, 26198926
26025681, 26078437, 25789579, 25034396, 24655717, 25124363, 23527363
25530814, 21981529, 25062592, 25057811, 23179662, 25530080, 25528838
25417056, 25100579, 25739065, 25700654, 25655966, 25631933, 25616645
25616417, 25594901, 25825910, 25789041, 22568728, 21159907, 20736227
19327292, 14690846, 25099497, 24938784, 25257085, 25237577, 25230945
25425760, 25337640, 25263960, 22654475, 21186167, 23491861, 23300142
23234232, 23151677, 22981722, 23733981, 24556967, 24485161, 24457597
24737064, 24578718, 24792678, 20324049, 17533661, 17027695, 22645009
22628825, 23521523, 23499160, 24289874, 24421668, 24332831, 24425998
24555417, 24737403, 25121089, 25192729, 25164293, 25150925, 25579761
25570929, 25980605, 25954022, 25797124, 26308650, 26261327, 26088836
25874050, 25178179, 25176408, 22072543, 23735292, 21985256, 22950945
23746128, 25175723, 25451531, 25575628, 25838361, 25932524, 26479173
26526726, 26609942, 24717183, 26362821, 25397936, 25554787, 26523432
26599395, 26331743, 26476244, 26388538, 25498930, 26421667, 26446098
26108080, 25648731, 25087436, 24812047, 25382812, 25695903, 25797092
22179537, 26111842, 19285025, 25558986, 25551676, 24642495, 25633101
25852885, 25897615, 26486365, 26333141, 26537307, 26444887, 26396790
26358670, 26244115, 25489607, 25947799, 26095405, 26492866, 25248384
26430737, 26187943, 26426526, 22898198, 23581777, 25694206, 26088426
26045732, 24693290, 26153977, 25654936, 25870579, 20003668, 24912588
25638456, 25320555, 25240590, 23599216, 25182817, 24735430, 25872127
25192044, 20620169, 26324769, 24960044, 24677696, 25995938, 23125560
23061453, 25166187, 25722608, 25662524, 25598473, 25774077, 19614243
24664211, 25145215, 25123585, 24968162, 25241625, 25472112, 25463844
25410802, 25383204, 22446455, 23481673, 23055900, 26249718, 25967544
22087683, 23730961, 24376875, 24368004, 25162645, 25029022, 25099339
25093872, 25433696, 25392535, 25357142, 25328518, 25553616, 25970731
25953857, 26169345, 26169341, 26091640, 26032573, 22503297, 24341675
24850622, 25186079, 25602488, 25861398, 25980770, 26096382, 26765212
23035249, 24797119, 25405813, 24443539, 25098160, 25384462, 24593740
25241448, 26751171, 26751106, 26545688, 26367012, 25871639, 25597525
25546580, 25063971, 24654629, 23105538, 24401351, 25764020, 25259611
25244807, 25265499, 26650226, 26330994, 26658759, 26351334, 22347493
25140197, 26659182, 25990907, 25660847, 25411036, 24845157, 25888073
20591151, 25954054, 25822410, 25788879, 25335790, 25199585, 24717859
22564336, 24461826, 24337882, 24010030, 22826067, 26680105, 26626879
26641610, 26189861, 25826740, 25335249, 25335360, 25100063, 21216226
26327624, 25977302, 26597140, 26493289, 26435073, 25895224, 25634317
24617969, 19211433, 25911724, 22599050, 24843188, 24486059, 24922704
18594510, 19649997, 24680959, 25107662, 25964954, 23645516, 26237431
25754606, 23572982, 25045228, 25462714, 25722720, 24848746, 24760407
25203656, 25444961, 21520266, 23600861, 24600330, 24415926, 24423416
17947871, 23066146, 24326444, 24346821, 24623975, 24699619, 24801152
24786669, 24710696, 25065563, 25179774, 25129925, 25417958, 26237773
27087426, 27009164, 26969321, 26366517, 26898563, 26784509, 26522439
23271203, 22364044, 25307368, 26758193, 26542135, 15931756, 26548363
25710420, 26434999, 25207410, 26223039, 25524955, 25579458, 25489367
25313411, 24554533, 20756305, 25478885, 25858672, 26036748, 24966788
24766309, 21178363, 23715460, 23197730, 23602213, 25072986, 25729507
25890056, 25807997, 25206864, 23065002, 24345420, 24303148, 22864303
24435982, 24848923, 24978100, 24953434, 25210268, 25209912, 25981498
25919622, 25871177, 26569225, 26744595, 26908788, 25313154, 27135993
26635897, 26939314, 26983259, 26820076, 25785441, 27142373, 26729494
20532077, 23249829, 27073314, 26629381, 27079140, 26911000, 26944190
25305405, 23741944, 25348956, 25768681, 26794786, 25646373, 24570598
26399626, 25674386, 25225795, 25224242, 25536819, 25296876, 26375250
25963024, 26615690, 26442308, 25476149, 26170715, 25685152, 24307571
19526548, 24468470, 24744383, 25171084, 24713381, 24827654, 24343905
21433452, 24373756, 24923790, 24911709, 26019148, 24940060, 24595699
25691904, 25687460, 25672640, 25874678, 25785331, 22379010, 18521691
8480838, 25159176, 25227381, 25561296, 25440818, 23588722, 24470606
24692973, 24674197, 20118035, 24563422, 24759556, 25201454, 27165231
--------------------------------------------------------------------------------
OPatch succeeded.
五、加载sql文件到数据库
The following steps load modified SQL files into the database. For a RAC environment, perform these steps on only one node.
Table 1-2 Steps to Run the Datapatch Utility for Standalone DB Versus Single/Multitenant (CDB/PDB) DB
Steps
Standalone DB
Steps
Single/Multitenant (CDB/PDB) DB
1 % sqlplus /nolog 1 % sqlplus /nolog
2 SQL> Connect / as sysdba 2 SQL> Connect / as sysdba
3 SQL> startup 3 SQL> startup
4 SQL> quit 4 SQL> alter pluggable database all open;
5 % cd $ORACLE_HOME/OPatch 5 SQL> quit
6 % ./datapatch -verbose 6 % cd $ORACLE_HOME/OPatch
7 % ./datapatch -verbose
The datapatch utility will then run the necessary apply scripts to load the modified SQL files into the database. An entry will be added to the dba_registry_sqlpatch view reflecting the patch application. In the dba_registry_sqlpatch view, verify the Status for the APPLY is "SUCCESS".
补丁更新情况可通过dba_registry_sqlpatch查看。
[oracle@ogg2 27105253]$ cd /u01/oracle/product/12.2.0/db_1/OPatch
[oracle@ogg2 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.2.0.1.0 Production on Tue Mar 13 15:01:08 2018
Copyright (c) 2012, 2017, Oracle. All rights reserved.
Log file for this invocation: /u01/oracle/cfgtoollogs/sqlpatch/sqlpatch_129090_2018_03_13_15_01_08/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 DBRU:
ID 180116 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:
27105253 (DATABASE RELEASE UPDATE 12.2.0.1.180116)
Installing patches...
Patch installation complete. Total patches installed: 1
Validating logfiles...
Patch 27105253 apply: SUCCESS
logfile: /u01/oracle/cfgtoollogs/sqlpatch/27105253/21862470/27105253_apply_OGG2_2018Mar13_15_01_35.log (no errors)
SQL Patching tool complete on Tue Mar 13 15:06:47 2018
六、查看组件状态
SQL> col comp_id for a30
SQL> col version for a30
SQL> col comp_name for a30
SQL> col valid for a30
SQL> select COMP_ID,COMP_NAME,VERSION,STATUS from DBA_REGISTRY;
COMP_ID
COMP_NAME
VERSION
STATUS
------------------------------ ------------------------------ ------------------------------ --------------------------------------------
CATALOG
Oracle Database Catalog Views 12.2.0.1.0
VALID
CATPROC
Oracle Database Packages and T 12.2.0.1.0
VALID
ypes
JAVAVM
JServer JAVA Virtual Machine 12.2.0.1.0
VALID
XML
Oracle XDK
12.2.0.1.0
VALID
CATJAVA
Oracle Database Java Packages 12.2.0.1.0
VALID
APS
OLAP Analytic Workspace
12.2.0.1.0
VALID
RAC
Oracle Real Application Cluste 12.2.0.1.0
OPTION OFF
rs
COMP_ID
COMP_NAME
VERSION
STATUS
------------------------------ ------------------------------ ------------------------------ --------------------------------------------
XDB
Oracle XML Database
12.2.0.1.0
VALID
OWM
Oracle Workspace Manager 12.2.0.1.0
VALID
CONTEXT
Oracle Text
12.2.0.1.0
VALID
ORDIM
Oracle Multimedia
12.2.0.1.0
VALID
SDO
Spatial
12.2.0.1.0
VALID
XOQ
Oracle OLAP API
12.2.0.1.0
VALID
OLS
Oracle Label Security
12.2.0.1.0
VALID
DV
Oracle Database Vault
12.2.0.1.0
VALID
七、卸载补丁
单实例环境
Shut down all instances and listeners associated with the Oracle home that you are updating. For more information, see Oracle Database Administrator's Guide.
Run the OPatch utility specifying the rollback argument as follows.
opatch rollback -id 27105253
Run the datapatch Utility
Datapatch is run to complete the post-deinstall SQL deployment for the DB RU.
运行Datapatch以完成DB RU的卸载后SQL部署。
Steps
Standalone DB
Steps
Single/Multitenant (CDB/PDB) DB
1 % sqlplus /nolog 1 % sqlplus /nolog
2 SQL> Connect / as sysdba 2 SQL> Connect / as sysdba
3 SQL> startup 3 SQL> startup
4 SQL> quit 4 SQL> alter pluggable database all open;
5 % cd $ORACLE_HOME/OPatch 5 SQL> quit
6 % ./datapatch -verbose 6 % cd $ORACLE_HOME/OPatch
7 % ./datapatch -verbose