Delete old patches from an ORACLE_HOME

It is considered good practice to delete unneeded patches from an ORACLE_HOME in order to save space and reduce the time to install new patches. I made some tests to see the effects of that. More information about the removal of inactive patches can be found in Oracle Doc ID 2942102.1 .

On a Linux System I did an software only installation of Oracle EE 19c (19.3). After that Oracle Release Updates (RU) 19.21 up to 19.25 have been installed. You can see the size of the ORACLE_HOME and the time it took to install the patches in the following table:

OH
Version
OH size
(GB)
patch duration
(min)
19.37
19.20910
19.21129
19.221411
19.231717
19.241921
19.252227

The time it took to install a Release Update increased from 10 minutes to 27 minutes! Also the size of the ORACLE_HOME increased around 3 times the size of the initial installation (19.3).

Now let’s take a look at which patches are considered Active and Inactive:

[oracle@lin2]$ $ORACLE_HOME/OPatch/opatch util listorderedinactivepatches
Oracle Interim Patch Installer version 12.2.0.1.43
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.0.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.0.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.43
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2024-12-25_09-49-57AM_1.log

Invoking utility "listorderedinactivepatches"
List Inactive patches option provided

The oracle home has the following inactive patch(es) and their respective overlay patches:

The number of RU chains is  1

***** There are 5 inactive RU patches in chain 1
-Inactive RU/BP 29517242:Database Release Update : 19.3.0.0.190416 (29517242), installed on: Thu Apr 18 09:21:17 CEST 2019, with no overlays
-Inactive RU/BP 35320081:Database Release Update : 19.20.0.0.230718 (35320081), installed on: Tue Dec 24 22:47:56 CET 2024, with no overlays
-Inactive RU/BP 35643107:Database Release Update : 19.21.0.0.231017 (35643107), installed on: Tue Dec 24 23:04:57 CET 2024, with no overlays
-Inactive RU/BP 35943157:Database Release Update : 19.22.0.0.240116 (35943157), installed on: Tue Dec 24 23:21:13 CET 2024, with no overlays
-Inactive RU/BP 36233263:Database Release Update : 19.23.0.0.240416 (36233263), installed on: Tue Dec 24 23:46:57 CET 2024, with no overlays
-Active RU/BP 36582781:Database Release Update : 19.24.0.0.240716 (36582781), installed on: Wed Dec 25 00:21:56 CET 2024, with no overlays

OPatch succeeded.
[oracle@lin2]$

Now we delete all inactive patches. If we had a running database we didn’t have to stop it:

[oracle@lin2]$ $ORACLE_HOME/OPatch/opatch util deleteinactivepatches -silent
Oracle Interim Patch Installer version 12.2.0.1.43
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.0.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.0.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.43
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2024-12-25_10-11-35AM_1.log

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

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

***** 4 inactive patches will be deleted
-To be deleted inactive RU/BP 29517242:Database Release Update : 19.3.0.0.190416 (29517242), installed on: Thu Apr 18 09:21:17 CEST 2019, with no overlays
-To be deleted inactive RU/BP 35320081:Database Release Update : 19.20.0.0.230718 (35320081), installed on: Tue Dec 24 22:47:56 CET 2024, with no overlays
-To be deleted inactive RU/BP 35643107:Database Release Update : 19.21.0.0.231017 (35643107), installed on: Tue Dec 24 23:04:57 CET 2024, with no overlays
-To be deleted inactive RU/BP 35943157:Database Release Update : 19.22.0.0.240116 (35943157), installed on: Tue Dec 24 23:21:13 CET 2024, with no overlays
-To be retained inactive RU/BP 36233263:Database Release Update : 19.23.0.0.240416 (36233263), installed on: Tue Dec 24 23:46:57 CET 2024, with no overlays
-Active RU/BP 36582781:Database Release Update : 19.24.0.0.240716 (36582781), installed on: Wed Dec 25 00:21:56 CET 2024, with no overlays

Do you want to proceed? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Deleted RU/BP patch: 29517242
Deleted RU/BP patch: 35320081
Deleted RU/BP patch: 35643107
Deleted RU/BP patch: 35943157

OPatch succeeded.
[oracle@lin2]$

The removal of the inactive patches took 20 minutes and the size of the ORACLE_HOME shrunk down to 14GB. The final test was to find out how long it takes to install RU 19.25 after the inactive patches have been deleted. So I did a rollback of 19.25 and reinstalled 19.25 on top of 19.24 in 11 minutes. Pretty impressive!