In this article , we will provide steps for rolling back a patch in non-rac standalone database.

PATCH TO BE ROLLED BACK – 27105253 – Database Jan 2018 Release Update (DB RU)


1. Check the existence of patch in oracle home inventory.

$ORACLE_HOME/OPatch/opatch lsinventory | grep 27105253
Patch  27105253     : applied on Thu Apr 05 10:04:50 AST 2018
Patch description:  "Database Release Update : (27105253)"

2. Shutdown services running from oracle_home(database , listener)

shutdown immediate;

lsnrctl stop LISTENER_TEST

3. Rollback the patch.

$ORACLE_HOME/OPatch/opatch rollback -id 27105253

$ORACLE_HOME/OPatch/opatch rollback -id 27105253

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

Oracle Home       : /oracle/app/oracle/product/12.2.0/dbhome_3
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/12.2.0/dbhome_3/oraInst.loc
OPatch version    :
OUI version       :
Log file location : /oracle/app/oracle/product/12.2.0/dbhome_3/cfgtoollogs/opatch/opatch2018-04-05_12-03-38PM_1.log

Patches will be rolled back in the following order:
The following patch(es) will be rolled back: 27105253

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/oracle/product/12.2.0/dbhome_3')

Is the local system ready for patching? [y|n]
User Responded with: Y

Rolling back patch 27105253...

RollbackSession rolling back interim patch '27105253' from OH '/oracle/app/oracle/product/12.2.0/dbhome_3'

Patching component,

Patching component oracle.rdbms.deconfig,

Patching component oracle.tfa,

Patching component oracle.rdbms,

Patching component oracle.rdbms.util,

Patching component oracle.rdbms.dbscripts,

Patching component,

Patching component oracle.has.deconfig,

Patching component oracle.xdk.rsf,

Patching component oracle.ctx.rsf,

Patching component oracle.rdbms.rman,

Patching component oracle.rdbms.dv,

Patching component oracle.rdbms.oci,

Patching component,

Patching component oracle.precomp.common,

Patching component oracle.oracore.rsf,

Patching component oracle.ctx,

Patching component oracle.xdk,

Patching component oracle.nlsrtl.rsf,

Patching component oracle.rdbms.rsf,
Deleting "kgcs.o" from archive "/oracle/app/oracle/product/12.2.0/dbhome_3/lib/libgeneric12.a"

Patching component oracle.ons,

Patching component oracle.rdbms.lbac,

Patching component oracle.precomp.lang,

Patching component oracle.rdbms.rsf.ic,

Patching component oracle.sdo,
RollbackSession removing interim patch '27105253' from inventory
Log file location: /oracle/app/oracle/product/12.2.0/dbhome_3/cfgtoollogs/opatch/opatch2018-04-05_12-03-38PM_1.log

OPatch succeeded.

4. Now start the database:


lsnrctl start LISTENER_TEST

5. Now run the post rollback script.


./datapatch -verbose

./datapatch -verbose

SQL Patching tool version Production on Thu Apr  5 12:08:00 2018
Copyright (c) 2012, 2017, Oracle.  All rights reserved.

Log file for this invocation: /oracle/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_18582_2018_04_05_12_08_00/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:
  Not installed in the binary registry and ID 180116 in the SQL registry

Adding patches to installation queue and performing prereq checks...
Installation queue:
  The following patches will be rolled back:
  Nothing to apply

Installing patches...
Patch installation complete.  Total patches installed: 1

Validating logfiles...
Patch 27105253 rollback: SUCCESS
  logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/27105253/21862380/27105253_rollback_POCD_2018Apr05_12_08_15.log (no errors)
SQL Patching tool complete on Thu Apr  5 12:10:33 2018

6. Check the registry table for the status:

SQL> select patch_id,status,action,description from dba_registry_sqlpatch;

---------- --------------- ---------------
  27105253 SUCCESS         APPLY

  27105253 SUCCESS         ROLLBACK

Rollback is successful.:)