Neue Aufräum-Routine für inaktive Patches in opatch

Wer kennt es nicht – man installiert ein ORACLE_HOME und installiert den aktuellen RU, ggfs. auch OJVM-Patch. Als braver DBA aktualisiert man regelmäßig, und schwuppdiewupp hat man einige (Dutzend) GB im Verzeichnis $ORACLE_HOME/.patchstorage… Das kostet nicht nur viel Platz, sondern auch immer mehr Zeit z.B. bei der Ausführung von datapatch, weshalb Oracle auch inzwischen empfiehlt, Out-of-Place zu patchen. Aber dann wiederum muss man den Platz für das neue Home bereitstellen, ggfs. Skripte anpassen usw… und alles nur, weil teilweise steinalte Patches immer noch für den Fall eines Rollbacks im .patchstorage-Ordner „für gut verwahrt“ werden.

Doch jetzt stellt opatch selbst ein neues Feature bereit, das hier Abhilfe schaffen kann. Ab opatch Version 12.2.0.37 oder neuer gibt es zwei neue Befehle, und zwar

  • opatch util listorderedinactivepatches und
  • opatch util deleteinactivepatches

Mit dem ersten Befehl kann man sich alle Patches des aktuellen ORACLE_HOME anzeigen lassen

[oracle]$ opatch util listorderedinactivepatches
Oracle Interim Patch Installer version 12.2.0.1.39
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.0.0.0/dbhome_si
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.0.0.0/dbhome_si/oraInst.loc
OPatch version    : 12.2.0.1.39
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.0.0.0/dbhome_si/cfgtoollogs/opatch/opatch2023-08-14_15-13-30PM_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  3

***** 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 32545013:Database Release Update : 19.11.0.0.210420 (32545013), installed on: Thu Apr 22 12:01:08 CEST 2021, with no overlays
-Inactive RU/BP 33192793:Database Release Update : 19.13.0.0.211019 (33192793), installed on: Fri Oct 22 09:49:30 CEST 2021, with no overlays
-Inactive RU/BP 33515361:Database Release Update : 19.14.0.0.220118 (33515361), installed on: Mon Mar 07 18:36:05 CET 2022, with no overlays
-Inactive RU/BP 34419443:Database Release Update : 19.17.0.0.221018 (34419443), installed on: Sat Dec 03 21:27:19 CET 2022, with no overlays
-Active RU/BP 34765931:DATABASE RELEASE UPDATE : 19.18.0.0.230117 (REL-JAN230131) (34765931), installed on: Wed Mar 01 08:11:53 CET 2023, with no overlays

***** There are 2 inactive RU patches in chain 2
-Inactive RU/BP 33561310:OJVM RELEASE UPDATE: 19.14.0.0.220118 (33561310), installed on: Fri Jan 21 11:34:13 CET 2022, with no overlays
-Inactive RU/BP 34411846:OJVM RELEASE UPDATE: 19.17.0.0.221018 (34411846), installed on: Sat Dec 03 21:44:27 CET 2022, with no overlays
-Active RU/BP 34786990:OJVM RELEASE UPDATE: 19.18.0.0.230117 (34786990), installed on: Wed Mar 01 08:32:49 CET 2023, with no overlays

***** There are 5 inactive RU patches in chain 3
-Inactive RU/BP 29585399:OCW RELEASE UPDATE 19.3.0.0.0 (29585399), installed on: Thu Apr 18 09:21:33 CEST 2019, with no overlays
-Inactive RU/BP 32579761:OCW RELEASE UPDATE 19.11.0.0.0 (32579761), installed on: Thu Apr 22 12:03:38 CEST 2021, with no overlays
-Inactive RU/BP 33208123:OCW RELEASE UPDATE 19.13.0.0.0 (33208123), installed on: Fri Oct 22 09:52:01 CEST 2021, with no overlays
-Inactive RU/BP 33529556:OCW RELEASE UPDATE 19.14.0.0.0 (33529556), installed on: Mon Mar 07 18:39:20 CET 2022, with no overlays
-Inactive RU/BP 34444834:OCW RELEASE UPDATE 19.17.0.0.0 (34444834), installed on: Sat Dec 03 21:28:24 CET 2022, with no overlays
-Active RU/BP 34768559:OCW RELEASE UPDATE 19.18.0.0.0 (34768559), installed on: Wed Mar 01 08:13:36 CET 2023, with no overlays

OPatch succeeded.

Mit dem zweiten Befehl werden alle inaktiven Patches bis auf den letzten gelöscht. Somit kann der aktuelle Patch immer noch auf den zuletzt aktiven Stand zurückgerollt werden. Im Beispiel konnten innerhalb eines ORACLE_HOME hier über 5GB im Verzeichnis .patchstorage eingespart werden

Vorher:

[oracle]$ du -sh /u01/app/oracle/product/19.0.0.0/dbhome_si/.patch_storage
12G     /u01/app/oracle/product/19.0.0.0/dbhome_si/.patch_storage

Jetzt der Löschbefehl:

[oracle@ldbcoec2p211 grid]$ opatch util deleteinactivepatches
...
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 32545013:Database Release Update : 19.11.0.0.210420 (32545013), installed on: Thu Apr 22 12:01:08 CEST 2021, with no overlays
-To be deleted inactive RU/BP 33192793:Database Release Update : 19.13.0.0.211019 (33192793), installed on: Fri Oct 22 09:49:30 CEST 2021, with no overlays
-To be deleted inactive RU/BP 33515361:Database Release Update : 19.14.0.0.220118 (33515361), installed on: Mon Mar 07 18:36:05 CET 2022, with no overlays
-To be retained inactive RU/BP 34419443:Database Release Update : 19.17.0.0.221018 (34419443), installed on: Sat Dec 03 21:27:19 CET 2022, with no overlays
-Active RU/BP 34765931:DATABASE RELEASE UPDATE : 19.18.0.0.230117 (REL-JAN230131) (34765931), installed on: Wed Mar 01 08:11:53 CET 2023, with no overlays

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

***** There are 5 inactive RU patches in chain 3
...

Do you want to proceed? [y|n]
y
User Responded with: Y
Deleted RU/BP patch: 29517242
Deleted RU/BP patch: 32545013
Deleted RU/BP patch: 33192793
Deleted RU/BP patch: 33515361
Deleted RU/BP patch: 33561310
Deleted RU/BP patch: 29585399
Deleted RU/BP patch: 32579761
Deleted RU/BP patch: 33208123
Deleted RU/BP patch: 33529556

OPatch succeeded.

Nachher:

[oracle]$ du -sh /u01/app/oracle/product/19.0.0.0/dbhome_si/.patch_storage
5.2G    /u01/app/oracle/product/19.0.0.0/dbhome_si/.patch_storage

In einem GI-Home eines RAC-Systems war die Platzersparnis sogar noch größer (knapp 15GB).

Die beiden Befehle können jederzeit ohne Downtime ausgeführt werden. Siehe hierzu auch MOS:

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)

Schreibe einen Kommentar