数据库要安装新的补丁,发现新补丁中的某些包和原有补丁冲突,需要将原有补丁进行回退。
1、进行新补丁安装前的冲突检查,发现与原有补丁冲突。
[oracle@PJKMISDB patch]$ cd 20760982/
[oracle@PJKMISDB 20760982]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, 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.6
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch3015-11-23_16-11-26PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
ZOP-40: The patch(es) has conflicts with other patches installed in the Oracle Home (or) among themselves.
Prereq "checkConflictAgainstOHWithDetail" failed.
Summary of Conflict Analysis:
There are no patches that can be applied now.
Following patches have conflicts. Please contact Oracle Support and get the merged patch of the patches :
16902043, 20760982
Following patches will be rolled back from Oracle Home on application of the patches in the given list :
16902043
Conflicts/Supersets for each patch are:
Patch : 20760982
Bug Conflict with 16902043
Conflicting bugs are:
17332800
Conflict with 16619892
2
、查看安装补丁的补丁 ID。
[oracle@PJKMISDB OPatch]$ ./opatch lsinventory -patch_id
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, 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.6
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch3015-11-23_14-19-55PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2015-11-23_14-19-55PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.3.0
There are 1 product(s) installed in this Oracle Home.
Interim patches (1) :
Patch 16902043 : applied on Sun Mar 02 11:41:20 CST 2014
Unique Patch ID: 16676143
Patch description: "Database Patch Set Update : 11.2.0.3.8 (16902043)"
Created on 24 Sep 2013, 23:20:58 hrs PST8PDT
Sub-patch 13343438; "Database Patch Set Update : 11.2.0.3.1 (13343438)"
Sub-patch 13696216; "Database Patch Set Update : 11.2.0.3.2 (13696216)"
Sub-patch 13923374; "Database Patch Set Update : 11.2.0.3.3 (13923374)"
Sub-patch 14275605; "Database Patch Set Update : 11.2.0.3.4 (14275605)"
Sub-patch 14727310; "Database Patch Set Update : 11.2.0.3.5 (14727310)"
Sub-patch 16056266; "Database Patch Set Update : 11.2.0.3.6 (16056266)"
Sub-patch 16619892; "Database Patch Set Update : 11.2.0.3.7 (16619892)"
3、关闭数据库和监听。
4、将冲突的补丁包回退。
执行下面命令的时候报错,这是由于 oracle 的进程没有被关闭干净,需要把 oracle 进程关闭干净。
[oracle@PJKMISDB OPatch]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch rollback -id 16619892
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation. All rights reserved.
Argument(s) Error... ERROR: OPatch would not rollback a sub-patch that is not active. The patch id 16619892 is a sub-patch of the active composite 16902043. OPatch will not rollback patch(es) 16619892 until you have rolled back 16902043.
Please check the arguments and try again.
OPatch failed with error code 135
找到没有关闭的 oracle 进程,使用 kill -9 将其杀掉。
[oracle@PJKMISDB OPatch]$ ps -ef |grep oracle
oracle 3466 9981 0 Sep11 ? 01:06:59 /u01/app/oracle/product/11.2.0/db_1/bin/emagent
root 6481 1 0 2014 ? 00:00:01 /usr/local/oracle/backup/.etc.linux86_64/observiced -b
oracle 9981 1 0 May13 ? 00:32:46 /u01/app/oracle/product/11.2.0/db_1/perl/bin/perl /u01/app/oracle/product/11.2.0/db_1/bin/emwd.pl dbconsole /u01/app/oracle/product/11.2.0/db_1/PJKMISDB.localdomain_misdb/sysman/log/emdb.nohup
root 11189 6416 0 13:23 ? 00:00:00 sshd: oracle [priv]
oracle 11194 11189 0 13:23 ? 00:00:00 sshd: oracle@pts/2
oracle 11195 11194 0 13:23 pts/2 00:00:00 -bash
root 11379 6416 0 13:26 ? 00:00:00 sshd: oracle [priv]
oracle 11383 11379 0 13:26 ? 00:00:00 sshd: oracle@pts/3
oracle 11384 11383 0 13:26 pts/3 00:00:00 -bash
root 12726 6416 0 13:36 ? 00:00:00 sshd: oracle [priv]
oracle 12731 12726 0 13:36 ? 00:00:00 sshd: oracle@pts/4
oracle 12732 12731 0 13:36 pts/4 00:00:00 -bash
root 14545 6416 0 13:50 ? 00:00:00 sshd: oracle [priv]
oracle 14549 14545 0 13:50 ? 00:00:00 sshd: oracle@pts/1
oracle 14550 14549 0 13:50 pts/1 00:00:00 -bash
oracle 17234 14550 0 14:14 pts/1 00:00:00 vim 01.txt
root 17722 6416 0 14:18 ? 00:00:00 sshd: oracle [priv]
oracle 17726 17722 0 14:18 ? 00:00:00 sshd: oracle@pts/5
oracle 17727 17726 0 14:18 pts/5 00:00:00 -bash
oracle 19613 12732 0 14:25 pts/4 00:00:00 vim /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/16902043_Nov_23_2015_14_24_23/rollback2015-11-23_14-24-23PM_1.log
oracle 20088 9981 43 14:28 ? 00:00:20 /u01/app/oracle/product/11.2.0/db_1/jdk/bin/java -server -Xmx384M -XX:MaxPermSize=400M -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -DORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 -Doracle.home=/u01/app/oracle/product/11.2.0/db_1/oc4j -Doracle.oc4j.localhome=/u01/app/oracle/product/11.2.0/db_1/PJKMISDB.localdomain_misdb/sysman -DEMSTATE=/u01/app/oracle/product/11.2.0/db_1/PJKMISDB.localdomain_misdb -Doracle.j2ee.dont.use.memory.archive=true -Djava.protocol.handler.pkgs=HTTPClient -Doracle.security.jazn.config=/u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_PJKMISDB.localdomain_misdb/config/jazn.xml -Djava.security.policy=/u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_PJKMISDB.localdomain_misdb/config/java2.policy -Djavax.net.ssl.KeyStore=/u01/app/oracle/product/11.2.0/db_1/sysman/config/OCMTrustedCerts.txt-Djava.security.properties=/u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/home/config/jazn.security.props -DEMDROOT=/u01/app/oracle/product/11.2.0/db_1/PJKMISDB.localdomain_misdb -Dsysman.md5password=true -Drepapi.oracle.home=/u01/app/oracle/product/11.2.0/db_1 -Ddisable.checkForUpdate=true -Doracle.sysman.ccr.ocmSDK.websvc.keystore=/u01/app/oracle/product/11.2.0/db_1/jlib/emocmclnt.ks -Dice.pilots.html4.ignoreNonGenericFonts=true -Djava.awt.headless=true -jar /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/home/oc4j.jar -config /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_PJKMISDB.localdomain_misdb/config/server.xml
kill -9 20088
之后再次执行回退命令。
[oracle@PJKMISDB OPatch]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch rollback -id 16902043
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, 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.6
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/16902043_Nov_23_2015_14_31_43/rollback2015-11-23_14-31-43PM_1.log
Patches will be rolled back in the following order:
16902043 16619892 16056266 14727310 14275605 13923374 13696216 13343438
The following patch(es) will be rolled back: 16902043 16619892 16056266 14727310 14275605 13923374 13696216 13343438
Sub-patches of a composite series are being rolled back. The system will be returned to a state where all subpatches are rolled back.
The following bug fixes will be removed: 14523004,16902043,14198511,12865902,14695377,14191508,16710324,17333197,13072654,13834065,11868640,13605839,14189694,16372203,14007968,13686047,13092220,14003090,14095982,16024441,17333200,12755231,9397635,13440516,13723052,17230530,12784406,15910002,17333202,16362358,13040943,12748538,13843646,12747437,17082364,14128555,14755945,14393728,14762511,17333198,14751895,14188650,13945708,13591624,12899768,12744759,13725395,13642044,16710363,12821418,17333203,12621588,13972394,14791477,16344758,13483354,12796518,12312133,13060271,14351566,16212405,17333199,12815057,17332800,9547706,16794239,14053457,16794240,13790109,12772404,13791364,9095696,16279211,13814739,12395918,12912137,16619892,14512189,16794238,13063120,13907462,16742095,15841373,12731940,16382448,12925089,14571027,16794244,16794241,13855490,16794242,14467061,16703112,15869211,14398795,13489024,13493847,13561750,16694777,12755116,16794243,12940620,14127231,6690853,13015379,7509451,13579992,16306019,16279401,13724193,16014985,15905421,14668670,14301592,13848402,16530565,13857111,13923995,13427062,12974860,11071989,14207317,16344871,16231699,14841558,14176879,14273397,13913630,16056266,13496884,13914613,16382353,16299830,14589750,16314469,14841812,13632809,11715084,16314466,13812031,10242202,13910420,14207163,14644185,13680405,14110275,13584130,16175381,16314467,14220725,14472647,13860201,13561951,16314468,8547978,16314470,14088346,16368108,13582702,9706792,13911821,13786142,13616375,13958038,16294378,12983611,13596521,14459552,14226599,13810393,13098318,15862019,10263668,14040433,13448206,13645875,15862023,15862017,14841409,13719081,13685544,15862016,14023636,12791981,13026410,12857027,14263073,13732226,12873183,13011409,13534412,12345082,13038684,12959852,9659614,13787482,12964067,15853081,14262913,13399435,13559697,15862018,13593999,14546575,13524899,14258925,15862021,14546638,15862020,14546673,15862022,14263036,14727310,14205448,14035825,15862024,14052474,13454210,13936424,13544396,13645917,13807411,14469008,14138130,13099577,14076523,13699124,13612575,13566938,13358781,13773133,13705338,14480675,14409183,13059165,14613900,14664355,13430938,12585543,13624984,12794305,14548763,12594032,13377816,13397104,13080778,13649031,13257247,11708510,14480676,13250244,13476583,12583611,14275605,14480674,13804294,13464002,13484963,13550185,13385346,12693626,13737746,12971775,13384182,13718279,14390252,13572659,13467683,14062793,14062794,14062795,12401111,14062796,13502183,14062797,12797420,12913474,10133521,12678920,13340388,12976376,12617123,13923374,13457582,13103913,11840910,13527323,13035360,12879027,13588248,13419660,14038787,13001379,13370330,12658411,9761357,14063280,9858539,14063281,13981051,13366202,13903046,13657605,13338048,12535346,13916709,12646784,12880299,13326736,14062792,13036331,11877623,12845115,12829021,13554409,12923168,13742464,13332439,12780098,12656535,13070939,12960925,10350832,12612118,13696216,12919564,13632717,12780983,13742433,13742434,13742435,13742436,13742437,13742438,12588744,12748240,12894807,12764337,12582664,12662040,12849688,13354082,13420224,11063191,13772618,13503598,12998795,13466801,13492735,12834027,12620823,13035804,13362079,12718090,13528551,13041324,13343438,12917230,12847466,9703627,12797765,12950644,12905058,13499128,12861463,9873405,12938841
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
Rolling back patch 16902043...
RollbackSession rolling back interim patch '16902043' from OH '/u01/app/oracle/product/11.2.0/db_1'
Patching component oracle.ldap.rsf, 11.2.0.3.0...
Deleting "ssl_modifycountermeasurescbcchosenplaintextattack.o" from archive "/u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.a"
Deleting "ssl_setcountermeasurescbcchosenplaintextattack.o" from archive "/u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.a"
Patching component oracle.ldap.rsf.ic, 11.2.0.3.0...
Patching component oracle.owb.rsf, 11.2.0.3.0...
Patching component oracle.rdbms, 11.2.0.3.0...
Patching component oracle.rdbms.rsf, 11.2.0.3.0...
Patching component oracle.sysman.console.db, 11.2.0.3.0...
Updating jar file "/u01/app/oracle/product/11.2.0/db_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/db_1/.patch_storage/16902043_Sep_24_2013_23_20_58/files//sysman/jlib/emDB.jar/oracle/sysman/db/adm/DatabaseObjectsSearchController.class"
Updating jar file "/u01/app/oracle/product/11.2.0/db_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/db_1/.patch_storage/16902043_Sep_24_2013_23_20_58/files//sysman/jlib/emDB.jar/oracle/sysman/db/adm/inst/ResponseController.class"
Updating jar file "/u01/app/oracle/product/11.2.0/db_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/db_1/.patch_storage/16902043_Sep_24_2013_23_20_58/files//sysman/jlib/emDB.jar/oracle/sysman/emo/adm/storage/tablespace/TSDatafiles.class"
Updating jar file "/u01/app/oracle/product/11.2.0/db_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/db_1/.patch_storage/16902043_Sep_24_2013_23_20_58/files//sysman/jlib/emDB.jar/oracle/sysman/emo/adm/storage/tablespace/TablespaceSQLList.class"
RollbackSession removing interim patch '16902043' from inventory
Rolling back patch 16619892...
RollbackSession rolling back interim patch '16619892' from OH '/u01/app/oracle/product/11.2.0/db_1'
Patching component oracle.marvel, 11.2.0.3.0...
Patching component oracle.precomp.common, 11.2.0.3.0...
Patching component oracle.rdbms, 11.2.0.3.0...
Deleting "kstst.o" from archive "/u01/app/oracle/product/11.2.0/db_1/lib/libserver11.a"
Deleting "kststqad.o" from archive "/u01/app/oracle/product/11.2.0/db_1/lib/libserver11.a"
Patching component oracle.rdbms.rman, 11.2.0.3.0...
Patching component oracle.rdbms.rsf, 11.2.0.3.0...
Patching component oracle.sysman.agent, 10.2.0.4.3...
Patching component oracle.sysman.console.db, 11.2.0.3.0...
Updating jar file "/u01/app/oracle/product/11.2.0/db_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/db_1/.patch_storage/16619892_Jun_23_2013_09_03_20/files//sysman/jlib/emDB.jar/oracle/sysman/emo/adm/showdep/DependQuery.class"
Updating jar file "/u01/app/oracle/product/11.2.0/db_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/db_1/.patch_storage/16619892_Jun_23_2013_09_03_20/files//sysman/jlib/emDB.jar/oracle/sysman/emo/adm/showdep/TableDependQuery.class"
Patching component oracle.sysman.repository.core, 10.2.0.4.4...
Patching component oracle.xdk, 11.2.0.3.0...
Patching component oracle.xdk.parser.java, 11.2.0.3.0...
Patching component oracle.xdk.rsf, 11.2.0.3.0...
RollbackSession removing interim patch '16619892' from inventory
Rolling back patch 16056266...
RollbackSession rolling back interim patch '16056266' from OH '/u01/app/oracle/product/11.2.0/db_1'
5、打开登录数据库,执行相关的包。
[oracle@PJKMISDB admin]$ cd /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/
[oracle@PJKMISDB admin]$ ls -l catbundle*
-rw-r----- 1 oracle oinstall 1498 Mar 2 2014 catbundle_PSU_MISDB_APPLY.sql
-rw-r----- 1 oracle oinstall 1507 Mar 2 2014 catbundle_PSU_MISDB_ROLLBACK.sql
-rw-r--r-- 1 oracle oinstall 29922 Aug 8 2011 catbundle.sql
[oracle@PJKMISDB admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Nov 23 16:35:44 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> @catbundle_PSU_MISDB_ROLLBACK.sql