Sunday, June 11, 2023

Use Oracle supported methods to clean up old/inactive patches and free up space in Oracle Home

Check the patch store size after Apr2023 (19.19) RU patch

[oracle@ol ~]$ du -sh $ORACLE_HOME/.*_storage
12K	/u01/db19c/.opatchauto_storage
7.2G	/u01/db19c/.patch_storage

Check the patch version

[oracle@ol ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.37

OPatch succeeded.

List Inactive Patches

[oracle@ol ~]$ $ORACLE_HOME/OPatch/opatch ListOrderedInactivePatches
Oracle Interim Patch Installer version 12.2.0.1.37
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/db19c
Central Inventory : /u01/app/oraInventory
   from           : /u01/db19c/oraInst.loc
OPatch version    : 12.2.0.1.37
OUI version       : 12.2.0.7.0
Log file location : /u01/db19c/cfgtoollogs/opatch/opatch2023-06-11_21-33-42PM_1.log

Invoking utility "listorderedinactivepatches"
List Inactive patches option provided

The oracle home has the following inactive patch(es) and their respective overlay patches:
-Inactive RU/CPU 34419443, installed on: Sun Nov 06 11:28:33 SGT 2022, with no overlays
-Inactive RU/CPU 34765931, installed on: Sun Jan 22 12:30:46 SGT 2023, with no overlays
-Inactive RU/CPU 34411846, installed on: Sun Nov 06 11:36:34 SGT 2022, with no overlays
-Inactive RU/CPU 34786990, installed on: Sun Jan 22 12:43:31 SGT 2023, with no overlays
Total: 4 inactive RU/CPU patch(es) and 0 inactive overlay patch(es).

OPatch succeeded.

Delete Inactive Patches

[oracle@ol ~]$ $ORACLE_HOME/OPatch/opatch DeleteInactivePatches
Oracle Interim Patch Installer version 12.2.0.1.37
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/db19c
Central Inventory : /u01/app/oraInventory
   from           : /u01/db19c/oraInst.loc
OPatch version    : 12.2.0.1.37
OUI version       : 12.2.0.7.0
Log file location : /u01/db19c/cfgtoollogs/opatch/opatch2023-06-11_21-35-24PM_1.log

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

Opatch will delete the following inactive patch(es) and their overlays:
-Inactive RU/CPU 34419443, installed on: Sun Nov 06 11:28:33 SGT 2022, with no overlays
-Inactive RU/CPU 34765931, installed on: Sun Jan 22 12:30:46 SGT 2023, with no overlays
-Inactive RU/CPU 34411846, installed on: Sun Nov 06 11:36:34 SGT 2022, with no overlays
Total: 3 inactive RU/CPU patch(es) and 0 inactive overlay patch(es).

OPatch will keep the following inactive patch(es) and their overlays:
-Inactive RU/CPU 34786990, installed on: Sun Jan 22 12:43:31 SGT 2023, with no overlays
Total: 1 inactive RU/CPU patch(es) and 0 inactive overlay patch(es).

Do you want to proceed? [y|n]
y
User Responded with: Y
y
Deleted patch: 34419443
Deleted patch: 34765931
Deleted patch: 34411846

OPatch succeeded.

Check the patch store size again, size reduced from 7.2GB to 2.8GB.

[oracle@ol 19.19]$ du -sh $ORACLE_HOME/.*_storage
12K	/u01/db19c/.opatchauto_storage
2.8G	/u01/db19c/.patch_storage

List installed patches

[oracle@ol 19.19]$ $ORACLE_HOME/OPatch/opatch lspatches
35050341;OJVM RELEASE UPDATE: 19.19.0.0.230418 (35050341)
35042068;Database Release Update : 19.19.0.0.230418 (35042068)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

Other advanced util commands comes with OPatch

[oracle@ol 35042068]$ $ORACLE_HOME/OPatch/opatch util -help
Oracle Interim Patch Installer version 12.2.0.1.37
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


DESCRIPTION
    This operation invokes the chosen utilities on an ORACLE_HOME.
    This command doesnt support System Patch.

SYNTAX
opatch util [ -help ] [ COMMAND ]

Use opatch util [ COMMAND ] -help to get help on a particular command.

COMMANDS
        ApplySql
              Apply sql, sql procedure related actions for patches, which
              are already applied using Apply or NApply operation.

        CheckMinimumOpatchVersion
              Check if patch is compatible with the given user input version.

        CheckComponents
	      Check if the given patch is suitable for the Oracle Homes
              registered in the central inventory by components check

	CheckMemory
              Return the required memory for the specified online patch(es)

        Cleanup
              Remove the backup for restore area of the given patch
              or for all the patches.

        CopyListedDirs
             Recursively copy all directories listed in
             ORACLE_HOME/.patch_storage/<ID>/rac/copy_dirs.txt
             to remote nodes.

        CopyListedDirsTest
             Recursively copy a single directory to remote nodes.

        CopyListedFiles
              Copy all files listed in
              ORACLE_HOME/.patch_storage/<ID>/rac/copy_files.txt
              to remote nodes.

        CopyListedFilesTest
             Copy a single file to remote nodes.

        DeleteInactivePatches
	     Delete inactive patches from ORACLE_HOME

        DisableOnlinePatch
             Disable and remove the specified online patch(es)
             on the given database instances.

        EnableOnlinePatch
             Install and enable the specified online patch(es)
             on the given database instances.

        GetPatchLevel
             Return the patching level on Local Grid Home.

        InstallOCM
             Install and configure OCM.

	ListOrderedInactivePatches
	     List inactive patches and its overlays
	     present in ORACLE_HOME

        LoadXML
             Prompt for path/name of the XML file, then check if the
             XML is correct.

        Obfuscate
             Obfuscate the backed up files under ORACLE_HOME/.patch_storage.

        RemoveListedDirs
             Recursively remote directories listed in
             ORACLE_HOME/.patch_storage/<ID>/rac/remove_dirs.txt
             on remote nodes.

        RemoveListedDirsTest
             Recursively remove a directory on remote nodes.

        RemoveListedFiles
             Remove files listed in
             ORACLE_HOME/.patch_storage/<ID>/rac/remove_files.txt
             on remote nodes.

        RemoveListedFilesTest
             Remove a single file on remote nodes.

        RestoreOH
             Restore the OracleHome to the previous state.

        RollbackSql
              Rollback sql, sql procedure related actions for patches, which
              are already rolled back using Rollback or NRollback operation.

        RunAnyCommand
             Run any command on remote nodes.

        RunLocalMake
             Invoke re-link on the local node. Commands are stored in
             ORACLE_HOME/.patch_storage/<ID>/make.txt.

        RunRemoteMake
             Invoke re-link on remote nodes. Commands are stored in
             ORACLE_HOME/.patch_storage/<ID>/rac/make_cmds.txt.

        UpdateRemoteNodes
             Propagate/Remove files/directories to/on remote nodes
             using files under ORACLE_HOME/.patch_storage/<ID>/rac/*.

        UpdateOPatchVersion
             Update the version of OPatch in the inventory of
             Oracle Home.

        Verify
             Using the defined ORACLE_HOME and given patch location via
             -ph, the program will check to make sure the patch was
             applied to the ORACLE_HOME.
             Example: opatch util verify -ph /tmp/patchLoc

OPatch succeeded.

No comments:

Post a Comment