Oracle: cleanup after patching (in-place)

Oracle: cleanup after patching (in-place)

Patching your Oracle systems is essential for a stable, secure and up-to-date environment.

Oracle recommends to patch out-of-place, which means that you just add another software home and switch to it.

But in many environments, traditional (in-place) patching is still needed. So the software needs to be stopped, the patch will be instralled, and the software is started again.

Pros of in-place patching:

  • software directories will stay the same
  • less space needed on disk

Cons of traditional patching:

  • longer downtime
  • no easy way back

And the biggest disadvantage: the disk space needed by the software home is growing, especially in these folders:

# cd $ORACLE_HOME
# du -sh .omspatcher_storage .patch_storage
152M    .omspatcher_storage/  
5,3G    .patch_storage/

As soon as you plan to never go back to a patch level years ago, you can easily remove old versions which are backed up in the software home (except the one before the latest installed software patch).

This example shows an Oracle database home:

# $ORACLE_HOME/OPatch/opatch util deleteinactivepatches -silent
Oracle Interim Patch-Installationsprogramm Version 12.2.0.1.49  
Copyright (c) 2026, Oracle Corporation.  All rights reserved. Alle Rechte vorbehalten.  
  
  
Oracle Home: /oracle/19/db  
Zentrales Bestandsverzeichnis: /oracle/oraInventory  
   von: /oracle/19/db/oraInst.loc  
OPatch-Version: 12.2.0.1.49  
OUI-Version : 12.2.0.7.0  
Speicherort der Logdatei: /oracle/19/db/cfgtoollogs/opatch/opatch2026-04-16_11-02-51AM_1.log  
  
Invoking utility "deleteinactivepatches"  
Inactive Patches Cleanup option provided  
Delete Inactive Patches .......  
  
***** There are 4 inactive RU patches in chain 1  
  
***** 3 inactive patches will be deleted  
-To be deleted inactive RU/BP 37260974:Database Release Update : 19.26.0.0.250121 (37260974), installed on: Thu Mar 13 14:11:57 CET 2025, with overlays: 34814223, 37860476, 37203569, 37542054, 36534155, 37421153, 37213431, 36124707  
-To be deleted inactive RU/BP 37642901:Database Release Update : 19.27.0.0.250415 (37642901), installed on: Tue May 20 11:11:47 CEST 2025, with overlays: 37860476, 37542054  
-To be deleted inactive RU/BP 37960098:Database Release Update : 19.28.0.0.250715 (37960098), installed on: Wed Sep 03 16:04:55 CEST 2025, with overlays: 37860476  
-To be retained inactive RU/BP 38291812:Database Release Update : 19.29.0.0.251021 (38291812), installed on: Wed Nov 05 12:47:04 CET 2025, with no overlays  
-Active RU/BP 38632161:Database Release Update : 19.30.0.0.260120(REL-JAN260130) (38632161), installed on: Thu Apr 02 07:50:34 CEST 2026, with no overlays  
  
***** There are 3 inactive RU patches in chain 2  
  
***** 2 inactive patches will be deleted  
-To be deleted inactive RU/BP 37102264:OJVM RELEASE UPDATE: 19.26.0.0.250121 (37102264), installed on: Thu Mar 13 14:24:19 CET 2025, with no overlays  
-To be deleted inactive RU/BP 37499406:OJVM RELEASE UPDATE: 19.27.0.0.250415 (37499406), installed on: Tue May 20 11:27:56 CEST 2025, with no overlays  
-To be retained inactive RU/BP 37847857:OJVM RELEASE UPDATE: 19.28.0.0.250715 (37847857), installed on: Wed Sep 03 16:24:44 CEST 2025, with no overlays  
-Active RU/BP 38523609:OJVM RELEASE UPDATE: 19.30.0.0.260120 (38523609), installed on: Thu Apr 02 07:49:13 CEST 2026, with no overlays  
  
Möchten Sie fortfahren? [y|n]  
Y (auto-answered by -silent)  
User Responded with: Y  
Deleted overlay patch: 34814223  
Deleted overlay patch: 37860476  
Deleted overlay patch: 37203569  
Deleted overlay patch: 37542054  
Deleted overlay patch: 36534155  
Deleted overlay patch: 37421153  
Deleted overlay patch: 37213431  
Deleted overlay patch: 36124707  
Deleted RU/BP patch: 37260974  
Deleted RU/BP patch: 37642901  
Deleted RU/BP patch: 37960098  
Deleted RU/BP patch: 37102264  
Deleted RU/BP patch: 37499406  
  
OPatch succeeded.

But you can also do the same for an Enterprise Manager Cloud Control installation (although pathing is done using OMSPatcher, OPatch exists as it is internally used):

# $ORACLE_HOME/OPatch/opatch deleteinactivepatches -silent
Oracle Interim Patch-Installationsprogramm Version 13.9.4.2.22
Copyright (c) 2026, Oracle Corporation.  All rights reserved. Alle Rechte vorbehalten.

Oracle Home: /oracle/mw135
Zentrales Bestandsverzeichnis: /oracle/oraInventory
von: /oracle/mw135/oraInst.loc
OPatch-Version: 13.9.4.2.22
OUI-Version : 13.9.4.0.0
Speicherort der Logdatei: /oracle/mw135/cfgtoollogs/opatch/opatch2026-04-16_10-49-15AM_1.log

OPatch detects the Middleware Home as "/oracle/mw135"

Invoking utility "deleteinactivepatches"
Inactive Patches Cleanup option provided
Delete Inactive Patches .......

***** There are 3 inactive RU patches in chain 1

***** 2 inactive patches will be deleted
-To be deleted inactive RU/BP 36752879:Oracle Enterprise Manager for Systems Infrastructure 13c Release 5 Plug-in Update 24 (13.5.1.24) for Oracle Management Service, installed on: Thu Nov 28 11:27:39 CET 2024, with no overlays
-To be deleted inactive RU/BP 37051110:Oracle Enterprise Manager for Systems Infrastructure 13c Release 5 Plug-in Update 25 (13.5.1.25) for Oracle Management Service, installed on: Mon Mar 17 13:23:55 CET 2025, with no overlays
-To be retained inactive RU/BP 37736852:Oracle Enterprise Manager for Systems Infrastructure 13c Release 5 Plug-in Update 27 (13.5.1.27) for Oracle Management Service, installed on: Wed Sep 03 18:34:22 CEST 2025, with no overlays
-Active RU/BP 38478094:Oracle Enterprise Manager for Systems Infrastructure 13c Release 5 Plug-in Update 29 (13.5.1.29) for Oracle Management Service, installed on: Thu Apr 02 08:45:09 CEST 2026, with no overlays
[...]
Deleted RU/BP patch: 37736768
Deleted RU/BP patch: 37202254
Deleted overlay patch: 36925662
Deleted RU/BP patch: 37526122
Deleted RU/BP patch: 1221424
Deleted RU/BP patch: 1221425
Deleted RU/BP patch: 1221426
Deleted RU/BP patch: 37096063
Deleted RU/BP patch: 37297691
Deleted RU/BP patch: 38042142

And this also works for Cloud Control agent homes:

$ORACLE_HOME/OPatch/opatch deleteinactivepatches -silent  
Oracle Interim Patch-Installationsprogramm Version 13.9.4.2.20  
Copyright (c) 2026, Oracle Corporation.  All rights reserved. Alle Rechte vorbehalten.  
  
  
Oracle Home: /oracle/agent/agent_13.5.0.0.0  
Zentrales Bestandsverzeichnis: /oracle/oraInventory  
   von: /oracle/agent/agent_13.5.0.0.0/oraInst.loc  
OPatch-Version: 13.9.4.2.20  
OUI-Version : 13.9.4.0.0  
Speicherort der Logdatei: /oracle/agent/agent_13.5.0.0.0/cfgtoollogs/opatch/opatch2026-04-16_10-59-19AM_1.log  
  
  
OPatch detects the Middleware Home as "/oracle/agent"  
  
Invoking utility "deleteinactivepatches"  
Inactive Patches Cleanup option provided  
Delete Inactive Patches .......

[...]

***** 2 inactive patches will be deleted  
-To be deleted inactive RU/BP 37102264:OJVM RELEASE UPDATE: 19.26.0.0.250121 (37102264), installed on: Thu Mar 13 14:24:19 CET 2025, with no overlays  
-To be deleted inactive RU/BP 37499406:OJVM RELEASE UPDATE: 19.27.0.0.250415 (37499406), installed on: Tue May 20 11:27:56 CEST 2025, with no overlays  
-To be retained inactive RU/BP 37847857:OJVM RELEASE UPDATE: 19.28.0.0.250715 (37847857), installed on: Wed Sep 03 16:24:44 CEST 2025, with no overlays  
-Active RU/BP 38523609:OJVM RELEASE UPDATE: 19.30.0.0.260120 (38523609), installed on: Thu Apr 02 07:49:13 CEST 2026, with no overlays  
  
Möchten Sie fortfahren? [y|n]  
Y (auto-answered by -silent)  
User Responded with: Y  
Deleted overlay patch: 34814223  
Deleted overlay patch: 37860476  
Deleted overlay patch: 37203569  
Deleted overlay patch: 37542054  
Deleted overlay patch: 36534155  
Deleted overlay patch: 37421153  
Deleted overlay patch: 37213431  
Deleted overlay patch: 36124707  
Deleted RU/BP patch: 37260974  
Deleted RU/BP patch: 37642901  
Deleted RU/BP patch: 37960098  
Deleted RU/BP patch: 37102264  
Deleted RU/BP patch: 37499406