Hi all,

Hope you’re doing good!

I had a call with one of our clients, long story short, they would like to cleanup some space under $ORACLE_HOME/.patch_storage directory.

There are a lot of options to accomplish this. I will talk a little bit here about them and focus on this blog post in how to archive the patches.

But please, DON’T DELETE the content of $ORACLE_HOME/.patch_storage directory manually!!

First of all, let’s understand what is the goal to have this $ORACLE_HOME/.patch_storage directory. The info below has gathered from this note:

Can You Delete $ORACLE_HOME/.patch_storage Directory ? (Doc ID 403218.1)

—————————————————————————————————-

1) When you apply an interim patch to Oracle Home, OPatch tool stores the patch information in $ORACLE_HOME/.patch_storage directory. Inside this directory, there are separate directories created for each patch applied to the Oracle home. Interim patches are bug fixes that are made available to customers in response to specific bugs. Critical Patch Update (CPU) and Release Updates (RUs)/Patch Set Updates (PSUs) are also a kind of patches. The latest RU/CPU/PSU will rollback the previously applied RU/CPU/PSU as RU/CPU/PSU is cumulative. So this rollback information is from the .patch_storage directory.

2) You may come across a bug conflict and might want to remove the conflicting patch. This process is known as patch rollback. During patch installation, OPatch saves copies of all the files that were replaced by the new patch before the new versions of these files are loaded and stores it in $ORACLE_HOME/.patch_storage/patch_ID/. These saved files are called rollback files and are the key to making patch rollback possible.

3) Every time you apply a patch, you make changes to your inventory. Sometimes that change may corrupt the inventory. From Oracle RDBMS 10.2.0.X.X onwards when you apply a patch, OPatch creates a snapshot of your inventory and stores it in $ORACLE_HOME/.patch_storage/<patch-id_timestamp> directory. The $ORACLE_HOME/.patch_storage/<patch-id_timestamp>/restore.sh script that comes with OPatch to remove any changes that were made to the inventory after the application of the patch.

More over the .patch_storage directory is made hidden also adds to the fact that it should not be deleted.

—————————————————————————————————-

Perfect, let’s now explore some options to cleanup $ORACLE_HOME/.patch_storage directory.

As greately pinpointed by Mike Dietrich on his blog post Cleaning up older patch artifacts – improving opatch performance, starting on OPatch 12.2.0.1.37 from April 2023, we have some additional features. You can clean up the backups for the inactive patches (applied in the past and not needed for rollback anymore). This is a great feature!

So, just for demonstration purpose, I’ll not clean up the old backups using this feature. Let’s just explore it here.

We can list first what are the inactive patches eligible for deletion:

opatch listorderedinactivepatches
Oracle Interim Patch Installer version 12.2.0.1.40
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/193/grid
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/193/grid/oraInst.loc
OPatch version    : 12.2.0.1.40
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/193/grid/cfgtoollogs/opatch/opatch2024-06-25_19-23-39PM_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  5

***** 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 07:35:39 UTC 2019, with no overlays
-Inactive RU/BP 32218454:Database Release Update : 19.10.0.0.210119 (32218454), installed on: Tue Sep 28 20:37:06 UTC 2021, with no overlays
-Inactive RU/BP 33515361:Database Release Update : 19.14.0.0.220118 (33515361), installed on: Fri Sep 09 12:23:12 UTC 2022, with no overlays
-Inactive RU/BP 34419443:Database Release Update : 19.17.0.0.221018 (34419443), installed on: Thu Apr 13 16:02:58 UTC 2023, with no overlays
-Inactive RU/BP 35042068:Database Release Update : 19.19.0.0.230418 (35042068), installed on: Wed Sep 27 14:22:56 UTC 2023, with no overlays
-Active RU/BP 35643107:Database Release Update : 19.21.0.0.231017 (35643107), installed on: Sun Feb 25 04:51:29 UTC 2024, with no overlays

***** There are 5 inactive RU patches in chain 2
-Inactive RU/BP 29401763:TOMCAT RELEASE UPDATE 19.0.0.0.0 (29401763), installed on: Thu Apr 18 07:35:16 UTC 2019, with no overlays
-Inactive RU/BP 32240590:TOMCAT RELEASE UPDATE 19.0.0.0.0 (32240590), installed on: Tue Sep 28 21:00:18 UTC 2021, with no overlays
-Inactive RU/BP 33239955:TOMCAT RELEASE UPDATE 19.0.0.0.0 (33239955), installed on: Fri Sep 09 12:20:37 UTC 2022, with no overlays
-Inactive RU/BP 34580338:TOMCAT RELEASE UPDATE 19.0.0.0.0 (34580338), installed on: Thu Apr 13 16:08:18 UTC 2023, with no overlays
-Inactive RU/BP 35107512:TOMCAT RELEASE UPDATE 19.0.0.0.0 (35107512), installed on: Wed Sep 27 14:27:10 UTC 2023, with no overlays
-Active RU/BP 35553096:TOMCAT RELEASE UPDATE 19.0.0.0.0 (35553096), installed on: Sun Feb 25 04:50:10 UTC 2024, with no overlays

***** There are 6 inactive RU patches in chain 3
-Inactive RU/BP 29517247:ACFS RELEASE UPDATE 19.3.0.0.0 (29517247), installed on: Thu Apr 18 07:36:02 UTC 2019, with no overlays
-Inactive RU/BP 32218663:ACFS RELEASE UPDATE 19.10.0.0.0 (32218663), installed on: Tue Sep 28 20:55:00 UTC 2021, with no overlays
-Inactive RU/BP 33534448:ACFS RELEASE UPDATE 19.14.0.0.0 (33534448), installed on: Fri Sep 09 12:27:34 UTC 2022, with no overlays
-Inactive RU/BP 34428761:ACFS RELEASE UPDATE 19.17.0.0.0 (34428761), installed on: Thu Apr 13 16:07:08 UTC 2023, with no overlays
-Inactive RU/BP 35050325:ACFS RELEASE UPDATE 19.19.0.0.0 (35050325), installed on: Wed Sep 27 14:25:56 UTC 2023, with no overlays
-Inactive RU/BP 35652062:ACFS RELEASE UPDATE 19.21.0.0.0 (35652062), installed on: Sun Feb 25 04:55:03 UTC 2024, with no overlays
-Active RU/BP 35988503:ACFS Interim patch for 35988503, installed on: Thu Apr 18 15:58:06 UTC 2024, with no overlays

***** There are 5 inactive RU patches in chain 4
-Inactive RU/BP 29585399:OCW RELEASE UPDATE 19.3.0.0.0 (29585399), installed on: Thu Apr 18 07:36:24 UTC 2019, with no overlays
-Inactive RU/BP 32222571:OCW Interim patch for 32222571, installed on: Tue Sep 28 20:57:58 UTC 2021, with no overlays
-Inactive RU/BP 33529556:OCW RELEASE UPDATE 19.14.0.0.0 (33529556), installed on: Fri Sep 09 12:26:58 UTC 2022, with no overlays
-Inactive RU/BP 34444834:OCW RELEASE UPDATE 19.17.0.0.0 (34444834), installed on: Thu Apr 13 16:07:50 UTC 2023, with no overlays
-Inactive RU/BP 35050331:OCW RELEASE UPDATE 19.19.0.0.0 (35050331), installed on: Wed Sep 27 14:26:42 UTC 2023, with no overlays
-Active RU/BP 35655527:OCW RELEASE UPDATE 19.21.0.0.0 (35655527), installed on: Sun Feb 25 04:55:43 UTC 2024, with no overlays

***** There are 1 inactive RU patches in chain 5
-Inactive RU/BP 29340594:DBWLM RELEASE UPDATE 19.0.0.0.0 (29340594), installed on: Tue Sep 28 20:33:49 UTC 2021, with no overlays
-Active RU/BP 33575402:DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402), installed on: Fri Sep 09 12:28:18 UTC 2022, with no overlays

OPatch succeeded.

Great, isn’t?! We can save a lot of space.

Next, I will run the opatch with the option to deleteinactivepatches, but I will not delete at this point, so, I’ll add the flag -report on my OPatch operation. Let’s do it:

opatch util deleteinactivepatches -report
Oracle Interim Patch Installer version 12.2.0.1.40
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/193/grid
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/193/grid/oraInst.loc
OPatch version    : 12.2.0.1.40
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/193/grid/cfgtoollogs/opatch/opatch2024-06-25_19-26-33PM_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 07:35:39 UTC 2019, with no overlays
-To be deleted inactive RU/BP 32218454:Database Release Update : 19.10.0.0.210119 (32218454), installed on: Tue Sep 28 20:37:06 UTC 2021, with no overlays
-To be deleted inactive RU/BP 33515361:Database Release Update : 19.14.0.0.220118 (33515361), installed on: Fri Sep 09 12:23:12 UTC 2022, with no overlays
-To be deleted inactive RU/BP 34419443:Database Release Update : 19.17.0.0.221018 (34419443), installed on: Thu Apr 13 16:02:58 UTC 2023, with no overlays
-To be retained inactive RU/BP 35042068:Database Release Update : 19.19.0.0.230418 (35042068), installed on: Wed Sep 27 14:22:56 UTC 2023, with no overlays
-Active RU/BP 35643107:Database Release Update : 19.21.0.0.231017 (35643107), installed on: Sun Feb 25 04:51:29 UTC 2024, with no overlays

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

***** 4 inactive patches will be deleted
-To be deleted inactive RU/BP 29401763:TOMCAT RELEASE UPDATE 19.0.0.0.0 (29401763), installed on: Thu Apr 18 07:35:16 UTC 2019, with no overlays
-To be deleted inactive RU/BP 32240590:TOMCAT RELEASE UPDATE 19.0.0.0.0 (32240590), installed on: Tue Sep 28 21:00:18 UTC 2021, with no overlays
-To be deleted inactive RU/BP 33239955:TOMCAT RELEASE UPDATE 19.0.0.0.0 (33239955), installed on: Fri Sep 09 12:20:37 UTC 2022, with no overlays
-To be deleted inactive RU/BP 34580338:TOMCAT RELEASE UPDATE 19.0.0.0.0 (34580338), installed on: Thu Apr 13 16:08:18 UTC 2023, with no overlays
-To be retained inactive RU/BP 35107512:TOMCAT RELEASE UPDATE 19.0.0.0.0 (35107512), installed on: Wed Sep 27 14:27:10 UTC 2023, with no overlays
-Active RU/BP 35553096:TOMCAT RELEASE UPDATE 19.0.0.0.0 (35553096), installed on: Sun Feb 25 04:50:10 UTC 2024, with no overlays

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

***** 5 inactive patches will be deleted
-To be deleted inactive RU/BP 29517247:ACFS RELEASE UPDATE 19.3.0.0.0 (29517247), installed on: Thu Apr 18 07:36:02 UTC 2019, with no overlays
-To be deleted inactive RU/BP 32218663:ACFS RELEASE UPDATE 19.10.0.0.0 (32218663), installed on: Tue Sep 28 20:55:00 UTC 2021, with no overlays
-To be deleted inactive RU/BP 33534448:ACFS RELEASE UPDATE 19.14.0.0.0 (33534448), installed on: Fri Sep 09 12:27:34 UTC 2022, with no overlays
-To be deleted inactive RU/BP 34428761:ACFS RELEASE UPDATE 19.17.0.0.0 (34428761), installed on: Thu Apr 13 16:07:08 UTC 2023, with no overlays
-To be deleted inactive RU/BP 35050325:ACFS RELEASE UPDATE 19.19.0.0.0 (35050325), installed on: Wed Sep 27 14:25:56 UTC 2023, with no overlays
-To be retained inactive RU/BP 35652062:ACFS RELEASE UPDATE 19.21.0.0.0 (35652062), installed on: Sun Feb 25 04:55:03 UTC 2024, with no overlays
-Active RU/BP 35988503:ACFS Interim patch for 35988503, installed on: Thu Apr 18 15:58:06 UTC 2024, with no overlays

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

***** 4 inactive patches will be deleted
-To be deleted inactive RU/BP 29585399:OCW RELEASE UPDATE 19.3.0.0.0 (29585399), installed on: Thu Apr 18 07:36:24 UTC 2019, with no overlays
-To be deleted inactive RU/BP 32222571:OCW Interim patch for 32222571, installed on: Tue Sep 28 20:57:58 UTC 2021, with no overlays
-To be deleted inactive RU/BP 33529556:OCW RELEASE UPDATE 19.14.0.0.0 (33529556), installed on: Fri Sep 09 12:26:58 UTC 2022, with no overlays
-To be deleted inactive RU/BP 34444834:OCW RELEASE UPDATE 19.17.0.0.0 (34444834), installed on: Thu Apr 13 16:07:50 UTC 2023, with no overlays
-To be retained inactive RU/BP 35050331:OCW RELEASE UPDATE 19.19.0.0.0 (35050331), installed on: Wed Sep 27 14:26:42 UTC 2023, with no overlays
-Active RU/BP 35655527:OCW RELEASE UPDATE 19.21.0.0.0 (35655527), installed on: Sun Feb 25 04:55:43 UTC 2024, with no overlays

OPatch is in report mode. No actual deletion happened. Reporting is done.

OPatch succeeded.

Great! So, as you can see, we have several patches to be deleted (Inactive), we have basically one patch to be retained (the previous patch applied) and the active patch (which of course we’ll not touch).

As also pinpointed on Mike’s post, you can change the OPatch behavior to retain not only the previous one, but the one before as well.

For this, you need to change the file $ORACLE_HOME/OPatch/config/opatch.properties.

I will not change it as I am not going to use this feature here. But let me show the content of file to you:

cat $ORACLE_HOME/OPatch/config/opatch.properties 
OPATCH_HEAP_MEMORY=3072
PS_OBFUSCATION=true
RETAIN_INACTIVE_PATCHES=1

So, if we’d like to keep the previous patch and also the one before the previous, we need to make changes on parameter RETAIN_INACTIVE_PATCHES=n, where n is the number of previous patches you’d like to retain/keep.

Perfect!

Now, let’s talk about other feature: if you want, you can archive your old patch backup directories. This feature was added on OPatch version 12.2.0.1.23 and onwards.

Mike (he again :-)) also posted about this Can I cleanup the previous Patch Bundles with opatch?, and this is exactly what I did for this client.

OK, let’s check our .patch_storage directory (I’ll check for GI patches):

[grid@DBNODE01 ~]$ cd $ORACLE_HOME/.patch_storage

[grid@DBNODE01 .patch_storage]$ ls -ltr 
total 480
drwxr-xr-x  3 grid oinstall   4096 Apr 18  2019 29517242_Apr_17_2019_23_27_10
drwxr-xr-x  3 grid oinstall   4096 Apr 18  2019 29517247_Apr_1_2019_15_08_20
drwxr-xr-x  3 grid oinstall   4096 Apr 18  2019 29585399_Apr_9_2019_19_12_47
drwx------  4 grid oinstall   4096 Sep 28  2021 32218454_Jan_14_2021_16_24_38
drwx------  4 grid oinstall   4096 Sep 28  2021 32218663_Dec_22_2020_12_20_04
drwx------  4 grid oinstall   4096 Sep 28  2021 32222571_Jan_15_2021_01_49_46
drwx------  4 grid oinstall   4096 Sep 28  2021 32240590_Jan_7_2021_22_55_01
drwx------  4 grid oinstall   4096 Sep 28  2021 29340594_Jan_8_2021_01_44_40
drwx------  4 grid oinstall   4096 Sep  9  2022 33239955_Aug_25_2021_09_25_51
drwx------  4 grid oinstall   4096 Sep  9  2022 33515361_Jan_13_2022_06_14_07
drwx------  4 grid oinstall   4096 Sep  9  2022 33529556_Jan_9_2022_21_15_36
drwx------  4 grid oinstall   4096 Sep  9  2022 33534448_Nov_3_2021_01_41_03
drwx------  4 grid oinstall   4096 Sep  9  2022 33575402_Nov_16_2021_09_32_52
drwx------  4 grid oinstall   4096 Apr 13  2023 34419443_Oct_14_2022_05_25_14
drwx------  4 grid oinstall   4096 Apr 13  2023 34428761_Aug_29_2022_05_57_36
drwx------  4 grid oinstall   4096 Apr 13  2023 34444834_Oct_7_2022_06_08_33
drwx------  4 grid oinstall   4096 Apr 13  2023 34580338_Sep_8_2022_11_16_07
drwxr-xr-x  4 grid oinstall   4096 Aug 23  2023 NRollback
drwx------  4 grid oinstall   4096 Sep 27  2023 35042068_Apr_6_2023_15_25_04
drwx------  4 grid oinstall   4096 Sep 27  2023 35050325_Feb_5_2023_22_16_18
drwx------  4 grid oinstall   4096 Sep 27  2023 35050331_Apr_7_2023_06_10_27
drwx------  4 grid oinstall   4096 Sep 27  2023 35107512_Feb_21_2023_10_59_25
drwx------  4 grid oinstall   4096 Feb 25 04:23 35553096_Jun_30_2023_01_01_59
drwx------  4 grid oinstall   4096 Feb 25 04:23 35643107_Oct_3_2023_13_34_29
drwx------  4 grid oinstall   4096 Feb 25 04:23 35652062_Sep_25_2023_16_59_58
drwx------  4 grid oinstall   4096 Feb 25 04:23 35655527_Sep_21_2023_10_48_31
drwxr-xr-x  4 grid oinstall   4096 Mar 28 17:51 35949090_Dec_20_2023_08_34_16
drwx------  4 grid oinstall   4096 Apr 18 15:44 35988503_Dec_12_2023_18_25_33
-rw-------  1 grid oinstall 125165 Apr 18 15:43 interim_inventory.txt
-rw-------  1 grid oinstall     93 Apr 18 15:43 LatestOPatchSession.properties
drwxr-xr-x 28 grid oinstall   4096 Apr 18 15:43 NApply
-rw-------  1 grid oinstall 120469 Apr 18 15:43 record_inventory.txt
-rw-r--r--  1 grid oinstall 113135 Apr 18 15:44 newdirs.txt

Perfect, I will not archive all the patches at this moment. Let’s archive for now only the ones highlighted below:

Apr 18  2019 29517242_Apr_17_2019_23_27_10
Apr 18  2019 29517247_Apr_1_2019_15_08_20
Apr 18  2019 29585399_Apr_9_2019_19_12_47
Sep 28  2021 32218454_Jan_14_2021_16_24_38
Sep 28  2021 32218663_Dec_22_2020_12_20_04
Sep 28  2021 32222571_Jan_15_2021_01_49_46
Sep 28  2021 32240590_Jan_7_2021_22_55_01
Sep 28  2021 29340594_Jan_8_2021_01_44_40
Sep  9  2022 33239955_Aug_25_2021_09_25_51
Sep  9  2022 33515361_Jan_13_2022_06_14_07
Sep  9  2022 33529556_Jan_9_2022_21_15_36
Sep  9  2022 33534448_Nov_3_2021_01_41_03
Sep  9  2022 33575402_Nov_16_2021_09_32_52
Apr 13  2023 34419443_Oct_14_2022_05_25_14
Apr 13  2023 34428761_Aug_29_2022_05_57_36
Apr 13  2023 34444834_Oct_7_2022_06_08_33
Apr 13  2023 34580338_Sep_8_2022_11_16_07
Sep 27  2023 35042068_Apr_6_2023_15_25_04
Sep 27  2023 35050325_Feb_5_2023_22_16_18
Sep 27  2023 35050331_Apr_7_2023_06_10_27
Sep 27  2023 35107512_Feb_21_2023_10_59_25

Basically, we need to use the patch number, and, if we are planning to archive more than one patch, we can pass all patch numbers separated by comma.

What this archive feature does is compress the directories in zip format and move it to a destination defined by archive_dir parameter. Of course, you need to make sure you’ll have space on your archive_dir destination, otherwise, makes no sense you archive your inactive patches.

OK, so, basically, the command is:

opatch util archive -patches <patch_number>,[<second_patch_number>,<third_patch_number>,…] -archive_dir <destination_folder_to_archive_the_patches>

So, let’s go:

[grid@DBNODE01 .patch_storage]$ opatch util archive -patches 29517242,29517247,29585399,32218454,32218663,32222571,32240590,33239955,33515361,33529556,33534448,33575402,34419443,34428761,34444834,34580338,35042068,35050325,35050331,35107512 -archive_dir /sapcd/BKP_ORCL_PATCHES/dbnode01/
Oracle Interim Patch Installer version 12.2.0.1.40
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/193/grid
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/193/grid/oraInst.loc
OPatch version    : 12.2.0.1.40
OUI version       : 12.2.0.7.0
Log file location : /oracle/app/193/grid/cfgtoollogs/opatch/opatch2024-06-25_15-25-54PM_1.log

Invoking utility "archive"

Archiving Patch - 33515361 ....
Sucessfully archived patch - 33515361 in /sapcd/BKP_ORCL_PATCHES/dbnode01/33515361_Jan_13_2022_06_14_07.zip

Archiving Patch - 35107512 ....
Sucessfully archived patch - 35107512 in /sapcd/BKP_ORCL_PATCHES/dbnode01/35107512_Feb_21_2023_10_59_25.zip

Archiving Patch - 32222571 ....
Sucessfully archived patch - 32222571 in /sapcd/BKP_ORCL_PATCHES/dbnode01/32222571_Jan_15_2021_01_49_46.zip

Archiving Patch - 32240590 ....
Sucessfully archived patch - 32240590 in /sapcd/BKP_ORCL_PATCHES/dbnode01/32240590_Jan_7_2021_22_55_01.zip

Archiving Patch - 35042068 ....
Sucessfully archived patch - 35042068 in /sapcd/BKP_ORCL_PATCHES/dbnode01/35042068_Apr_6_2023_15_25_04.zip

Archiving Patch - 29517242 ....
Sucessfully archived patch - 29517242 in /sapcd/BKP_ORCL_PATCHES/dbnode01/29517242_Apr_17_2019_23_27_10.zip

Archiving Patch - 33575402 ....
Sucessfully archived patch - 33575402 in /sapcd/BKP_ORCL_PATCHES/dbnode01/33575402_Nov_16_2021_09_32_52.zip

Archiving Patch - 32218454 ....
Sucessfully archived patch - 32218454 in /sapcd/BKP_ORCL_PATCHES/dbnode01/32218454_Jan_14_2021_16_24_38.zip

Archiving Patch - 32218663 ....
Sucessfully archived patch - 32218663 in /sapcd/BKP_ORCL_PATCHES/dbnode01/32218663_Dec_22_2020_12_20_04.zip

Archiving Patch - 34428761 ....
Sucessfully archived patch - 34428761 in /sapcd/BKP_ORCL_PATCHES/dbnode01/34428761_Aug_29_2022_05_57_36.zip

Archiving Patch - 34580338 ....
Sucessfully archived patch - 34580338 in /sapcd/BKP_ORCL_PATCHES/dbnode01/34580338_Sep_8_2022_11_16_07.zip

Archiving Patch - 34419443 ....
Sucessfully archived patch - 34419443 in /sapcd/BKP_ORCL_PATCHES/dbnode01/34419443_Oct_14_2022_05_25_14.zip

Archiving Patch - 33534448 ....
Sucessfully archived patch - 33534448 in /sapcd/BKP_ORCL_PATCHES/dbnode01/33534448_Nov_3_2021_01_41_03.zip

Archiving Patch - 29585399 ....
Sucessfully archived patch - 29585399 in /sapcd/BKP_ORCL_PATCHES/dbnode01/29585399_Apr_9_2019_19_12_47.zip

Archiving Patch - 33239955 ....
Sucessfully archived patch - 33239955 in /sapcd/BKP_ORCL_PATCHES/dbnode01/33239955_Aug_25_2021_09_25_51.zip

Archiving Patch - 34444834 ....
Sucessfully archived patch - 34444834 in /sapcd/BKP_ORCL_PATCHES/dbnode01/34444834_Oct_7_2022_06_08_33.zip

Archiving Patch - 35050331 ....
Sucessfully archived patch - 35050331 in /sapcd/BKP_ORCL_PATCHES/dbnode01/35050331_Apr_7_2023_06_10_27.zip

Archiving Patch - 29517247 ....
Sucessfully archived patch - 29517247 in /sapcd/BKP_ORCL_PATCHES/dbnode01/29517247_Apr_1_2019_15_08_20.zip

Archiving Patch - 35050325 ....
Sucessfully archived patch - 35050325 in /sapcd/BKP_ORCL_PATCHES/dbnode01/35050325_Feb_5_2023_22_16_18.zip

Archiving Patch - 33529556 ....
Sucessfully archived patch - 33529556 in /sapcd/BKP_ORCL_PATCHES/dbnode01/33529556_Jan_9_2022_21_15_36.zip
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/33515361_Jan_13_2022_06_14_07
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/35107512_Feb_21_2023_10_59_25
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/32222571_Jan_15_2021_01_49_46
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/32240590_Jan_7_2021_22_55_01
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/35042068_Apr_6_2023_15_25_04
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/29517242_Apr_17_2019_23_27_10
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/33575402_Nov_16_2021_09_32_52
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/32218454_Jan_14_2021_16_24_38
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/32218663_Dec_22_2020_12_20_04
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/34428761_Aug_29_2022_05_57_36
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/34580338_Sep_8_2022_11_16_07
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/34419443_Oct_14_2022_05_25_14
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/33534448_Nov_3_2021_01_41_03
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/29585399_Apr_9_2019_19_12_47
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/33239955_Aug_25_2021_09_25_51
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/34444834_Oct_7_2022_06_08_33
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/35050331_Apr_7_2023_06_10_27
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/29517247_Apr_1_2019_15_08_20
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/35050325_Feb_5_2023_22_16_18
Succesfully verified the created archive. Deleting the original patch from  - /oracle/app/193/grid/.patch_storage/33529556_Jan_9_2022_21_15_36
Patch archive operation completed successfully.

OPatch succeeded.

Let’s list again the content of our directory:

[grid@DBNODE01 .patch_storage]$ ls -ltra
total 424
drwx------  4 grid oinstall   4096 Sep 28  2021 29340594_Jan_8_2021_01_44_40
drwxr-xr-x  4 grid oinstall   4096 Aug 23  2023 NRollback
drwx------  4 grid oinstall   4096 Feb 25 04:23 35643107_Oct_3_2023_13_34_29
drwx------  4 grid oinstall   4096 Feb 25 04:23 35652062_Sep_25_2023_16_59_58
drwx------  4 grid oinstall   4096 Feb 25 04:23 35553096_Jun_30_2023_01_01_59
drwx------  4 grid oinstall   4096 Feb 25 04:23 35655527_Sep_21_2023_10_48_31
drwxr-xr-x  4 grid oinstall   4096 Mar 28 17:51 35949090_Dec_20_2023_08_34_16
drwxr-xr-x 28 grid oinstall   4096 Apr 18 15:43 NApply
-rw-------  1 grid oinstall 120469 Apr 18 15:43 record_inventory.txt
-rw-------  1 grid oinstall 125165 Apr 18 15:43 interim_inventory.txt
-rw-------  1 grid oinstall     93 Apr 18 15:43 LatestOPatchSession.properties
-rw-r--r--  1 grid oinstall 113135 Apr 18 15:44 newdirs.txt
drwx------  4 grid oinstall   4096 Apr 18 15:44 35988503_Dec_12_2023_18_25_33
drwxr-xr-x 93 root oinstall   4096 Jun 20 11:08 ..
drwxr-xr-x  2 grid oinstall   4096 Jun 25 15:50 .archive_xml_bck
-rw-r--r--  1 grid oinstall   8607 Jun 25 15:50 .patch_archive_mapping.xml
drwx------ 12 grid oinstall   4096 Jun 25 15:52 .

Great, you now can see two new files and/or directories:

  • .archive_xml_bck: here we have the previous execution of archive operation
  • .patch_archive_mapping.xml: here we have the mapping of each patch archived and some additional info like: checksum for each patch archived, the archive_dir destination, the timestamp when the archiving occured and the patchdir_checksum.

Great!

If we would like to rollback one of the archived patches, we can basically unarchive them.

To unarchive an archived patch, we need basically to run this command:

opatch util unarchive -patches <patch_number>,[<second_patch_number>,<third_patch_number>,...]

We also can cleanup the archives (which is really great):

cd /sapcd/BKP_ORCL_PATCHES/dbnode01
opatch util cleanuparchives

Below we have some useful Metalink/My Oracle Support notes:

How to archive/unarchive patch directory under $ORACLE_HOME/.patch_storage ? (Doc ID 2867312.1)

How To Avoid Disk Full Issues Because OPatch Backups Take Big Amount Of Disk Space. (Doc ID 550522.1)

Can You Delete $ORACLE_HOME/.patch_storage Directory ? (Doc ID 403218.1)

OPatch 12.2.0.1.37+ Introduces a New Feature to Delete Inactive Patches in the ORACLE_HOME/.patch_storage Directory (Doc ID 2942102.1)

Hope it helps!

Peace!

Vinicius