Moneycontrol Brokerage Recos

Tuesday, October 27, 2015

How do you rollback/remove a CPU/PSU Patch from an ORACLE_HOME?

Sometimes you may be in need to rollback a CPU/PSU patch from an ORACLE_HOME you just have applied in so in order to rollback or remove a CPU/PSU patch you have to follow the following commands for rolling back a single or N number of patches at a time.


Rolling back a single CPU Patch:
========================

Pre-requisites : Oralce service should be down for ORACLE_HOME from where you are rolling back the CPU/PSU patches.

Suppose you want to remove/rollback a single interim patch from an ORACLE_HOME you just applied so what you need to do is just to invoke the Opatch from the ORACLE_HOME from where you want to rollback the patch with below syntax command.

[oracle@oem12c OPatch]$./opatch rollback -id [patch_number]

[oracle@oem12c OPatch]$ ./opatch rollback -id 12419278
Picked up _JAVA_OPTIONS: -Xms256m -Xmx512m
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-10-20_10-55-23AM.log

Patch history file: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt

Invoking utility "rollback"

Patches will be rolled back in the following order:
   12419278

Running prerequisite checks...
The following patch(es) will be rolled back: 12419278

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


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]  -- Make sure oracle services are brought down and press y to proceed here
y
User Responded with: Y
Backing up files affected by the patch 'NRollback' for restore. This might take a while...
Execution of 'sh /u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12419278_May_19_2011_06_17_30/original_patch/custom/scripts/pre -rollback 12419278 ':


Return Code = 0

Rolling back patch 12419278...

RollbackSession rolling back interim patch '12419278' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.rdbms.rsf, 11.2.0.1.0...

Patching component oracle.rdbms, 11.2.0.1.0...
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/bundledata_CPU.xml"
RollbackSession removing interim patch '12419278' from inventory

The local system has been patched and can be restarted.

UtilSession: Rollback done.

OPatch succeeded.




Rolling Back N number of patches at at time:
==============================

Now suppose you want to remove/rollback N number/multiple(set of patches) of patches from an Oracle HOme then you just have to follow the same syntex like you do to remove a single patch with set of N number of patches seprated with command as an argument for -id parameter as given below.

Note : - Here command is slightly different than previous one as "nrollback"parameter is used instead of simple "rollback". If we want to remove/rollback N number of patches at a time then we use "nrollback" along with the set of patch numbers separated with command as an argument for the parameter "-id" of nrollback command.

[oracle@oem12c OPatch]$ ./opatch nrollback -id 11794167,12534742,12534743,12534745,12534746,12534747,12534748,12534749,12534750,12534751,12534752,12534753,12534754
Picked up _JAVA_OPTIONS: -Xms256m -Xmx512m
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-10-26_12-13-43PM.log

Patch history file: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt

Invoking utility "nrollback"

Patches will be rolled back in the following order:
   11794167   12534742   12534743   12534745   12534746   12534747   12534748   12534749   12534750   12534751   12534752   12534753   12534754

Running prerequisite checks...
The following patch(es) will be rolled back: 11794167  12534742  12534743  12534745  12534746  12534747  12534748  12534749  12534750  12534751  12534752  12534753  12534754

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


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 affected by the patch 'NRollback' for restore. This might take a while...

Rolling back patch 11794167...

RollbackSession rolling back interim patch '11794167' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.ldap.rsf.ic, 11.2.0.1.0...
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so"

Patching component oracle.ldap.rsf, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libzt11.a"  with "lib/libzt11.a/nzdacval.o"
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a"  with "lib/libnnz11.a/nzu.o"
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.a"  with "lib/libnnz11.a/ssl_hshk_priv_ssl2_write_client_certificate_handler.o"

Patching component oracle.rdbms, 11.2.0.1.0...
RollbackSession removing interim patch '11794167' from inventory

Rolling back patch 12534742...

RollbackSession rolling back interim patch '12534742' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.console.db, 11.2.0.1.0...
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emCORE.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534742_May_18_2011_06_13_07/files//sysman/jlib/emCORE.jar/oracle/sysman/eml/admin/rep/UserData.class"
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emCORE.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534742_May_18_2011_06_13_07/files//sysman/jlib/emCORE.jar/oracle/sysman/eml/admin/rep/AdminResourceBundle.class"
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emCORE.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534742_May_18_2011_06_13_07/files//sysman/jlib/emCORE.jar/oracle/sysman/eml/admin/rep/AdminResourceBundleID.class"
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/oc4j_applications/applications/em/em/admin/rep/editUserSummary.uix"

Patching component oracle.sysman.oms.core, 10.2.0.4.2...
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/j2ee/OC4J_EM/applications/em/em/admin/rep/editUserSummary.uix"
RollbackSession removing interim patch '12534742' from inventory

Rolling back patch 12534743...

RollbackSession rolling back interim patch '12534743' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.console.db, 11.2.0.1.0...
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534743_May_18_2011_06_13_08/files//sysman/jlib/emDB.jar/oracle/sysman/emo/adm/schema/srctype/trigger/Trigger.class"
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534743_May_18_2011_06_13_08/files//sysman/jlib/emDB.jar/oracle/sysman/emo/adm/schema/srctype/trigger/TriggerAttributes.class"
RollbackSession removing interim patch '12534743' from inventory

Rolling back patch 12534745...

RollbackSession rolling back interim patch '12534745' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.plugin.db.main.repository, 11.2.0.1.0...
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/admin/emdrep/sql/db/latest/policy/config_util_pkgdef.sql"
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/admin/emdrep/sql/db/latest/policy/config_util_pkgbody.sql"
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/admin/emdrep/sql/db/latest/policy/config_metric_setup.sql"
RollbackSession removing interim patch '12534745' from inventory

Rolling back patch 12534746...

RollbackSession rolling back interim patch '12534746' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.console.db, 11.2.0.1.0...
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emCORE.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534746_May_18_2011_06_13_13/files//sysman/jlib/emCORE.jar/oracle/sysman/emSDK/sec/auth/EMLoginServlet.class"
RollbackSession removing interim patch '12534746' from inventory

Rolling back patch 12534747...

RollbackSession rolling back interim patch '12534747' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.console.db, 11.2.0.1.0...
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534747_May_18_2011_06_13_16/files//sysman/jlib/emDB.jar/oracle/sysman/db/adm/inst/SqlWorksheetController.class"
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emDB.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534747_May_18_2011_06_13_16/files//sysman/jlib/emDB.jar/oracle/sysman/db/rsc/DBObjectMsgID.class"
RollbackSession removing interim patch '12534747' from inventory

Rolling back patch 12534748...

RollbackSession rolling back interim patch '12534748' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.console.db, 11.2.0.1.0...
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emCORE.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534748_May_18_2011_06_13_18/files//sysman/jlib/emCORE.jar/oracle/sysman/eml/ecm/compare/CompareQuery.class"
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/admin/emdrep/sql/core/latest/ecm/ecm_util_pkgdef.sql"
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/admin/emdrep/sql/core/latest/ecm/ecm_views.sql"
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/admin/emdrep/sql/core/latest/sdk/sdk_views.sql"
RollbackSession removing interim patch '12534748' from inventory

Rolling back patch 12534749...

RollbackSession rolling back interim patch '12534749' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.sysman.console.db, 11.2.0.1.0...
Updating jar file "/u01/app/oracle/product/11.2.0/dbhome_1/sysman/jlib/emCORE.jar" with "/u01/app/oracle/product/11.2.0/dbhome_1/.patch_storage/12534749_May_18_2011_06_13_20/files//sysman/jlib/emCORE.jar/oracle/sysman/eml/mntr/vltn/AlertDetailsDataObject.class"
RollbackSession removing interim patch '12534749' from inventory

Rolling back patch 12534750...

RollbackSession rolling back interim patch '12534750' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.ldap.rsf, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libztkg11.a"  with "lib/libztkg11.a/accept_sec_context.o"

Patching component oracle.rdbms, 11.2.0.1.0...
RollbackSession removing interim patch '12534750' from inventory

Rolling back patch 12534751...

RollbackSession rolling back interim patch '12534751' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.rdbms.rsf, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libcommon11.a"  with "lib/libcommon11.a/ttcx2y.o"

Patching component oracle.rdbms, 11.2.0.1.0...
RollbackSession removing interim patch '12534751' from inventory

Rolling back patch 12534752...

RollbackSession rolling back interim patch '12534752' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.rdbms.dbscripts, 11.2.0.1.0...
Copying file to "/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvthsld.plb"
RollbackSession removing interim patch '12534752' from inventory

Rolling back patch 12534753...

RollbackSession rolling back interim patch '12534753' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.rdbms.rsf, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libpls11.a"  with "lib/libpls11.a/pef.o"
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libpls11.a"  with "lib/libpls11.a/pei.o"
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libpls11.a"  with "lib/libpls11.a/pgmc.o"

Patching component oracle.rdbms, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/libknlopt.a"  with "rdbms/lib/libknlopt.a/kkxwtp.o"
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libserver11.a"  with "lib/libserver11.a/qeroc.o"
RollbackSession removing interim patch '12534753' from inventory

Rolling back patch 12534754...

RollbackSession rolling back interim patch '12534754' from OH '/u01/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.rdbms, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0/dbhome_1/lib/libserver11.a"  with "lib/libserver11.a/qmtest_qmr.o"
RollbackSession removing interim patch '12534754' from inventory
Running make for target client_sharedlib
Running make for target ioracle
Running make for target client_sharedlib

The local system has been patched and can be restarted.

UtilSession: N-Rollback done.

OPatch succeeded.


This is how we rollback/remove CPU/PSU patches from an ORACLE_HOME and at last you can verify if patches are removed from the Oracle Inventory by using the following command.

[oracle@oem12c OPatch]$./opatch lsinventory

No comments:

Post a Comment