Quantcast
Channel: Oracle DBA - RajaBaskar Blog
Viewing all articles
Browse latest Browse all 25

opatch util Cleanup or how to cleanup the oracle home

$
0
0

I have faced several times Oracle Home size seems to be very high. I cleaned some unnecessary trace/log files in OH under $ORACLE_HOME/dbs.  Few times due to old patch can occupied the lot of spaces in $ORACLE_HOME/.patch_storage/

On oracle 9i, we can manually remove these old patch files directories. Oracle 10g onwards we can follow the below methods for OH cleanup.

How to clean up the oracle home?

While before applying the PSU patch, I am planning to take Oracle Home backup. I have checked Oracle Home size and felt Oracle Home size to be very high.

Oracle10gR2 (10.2.0.X) having new feature to clean up the Oracle Home.
 opatch util –help   ----à command will show the lot of options.

$ opatch util Cleanup
Invoking OPatch 10.2.0.5.1
 Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation.  All rights reserved.
 UTIL session
 Oracle Home       : /u01/oracle/product/10.2.0
Central Inventory : /u01/oracle/product/10.2.0/oraInventory
   from           : /var/opt/oracle/oraInst.loc
OPatch version    : 10.2.0.5.1
OUI version       : 10.2.0.4.0
OUI location      : /u01/oracle/product/10.2.0/oui
Log file location : /u01/oracle/product/10.2.0/cfgtoollogs/opatch/opatch2012-03-20_09-17-38AM.log
 Patch history file: /u01/oracle/product/10.2.0/cfgtoollogs/opatch/opatch_history.txt
 Invoking utility "cleanup"
OPatch will clean up 'restore.sh,make.txt' files and 'rac,scratch,backup' directories.
You will be still able to rollback patches after this cleanup.
Do you want to proceed? [y|n]
Y
User Responded with: Y
Size of directory "/u01/oracle/product/10.2.0/.patch_storage" before cleanup is 1222290337 bytes.
Size of directory "/u01/oracle/product/10.2.0/.patch_storage" after cleanup is 474926793 bytes.
 UtilSession: Backup area for restore has been cleaned up. For a complete list of files/directories
deleted, Please refer log file.
 OPatch succeeded.

 While running Opatch util Cleanup what internally happen?

 Its deleting the old patch related files from $Oracle_HOME/.patch_storage directories.
 I saw some details on some forum.. I would like to share here..

Why should we keep the $Oracle_HOME/.patch_storage directory files?
1.    
  If we apply the oracle interim patches, OPATCH utility stores the information in $ORACLE_HOME/.patch_storage directories. Inside this directory, there are separate directory created for each patch applied to the oracle home. Its having CPU/PSU patch information in these directories and while rollback the patch from oracle home, it will get the information from  .patch_storage directory.

2.      If we are removing/rollback the  bug conflict patch  from oracle home, oracle saves copies of all the files that were replaced by the new patch in $ORACLE_HOME/.patch_storage/directory before the new patch applied on oracle home.
 
3.      If we apply the patch, we make some changes on inventory.  There is a chance we may corrupt the inventory.  From 10gR2 onwards, while apply a patch, Opatch create the snapshot of our inventory and stores in $ORACLE_HOME/.patch_storage/ directory. The $ORACLE_HOME/.patch_storage//restore.sh script that comes with Opatch to remove any changes that were made to the inventory after the application of the patch.


        I Hope this article helped you. Suggestions are welcome.





Viewing all articles
Browse latest Browse all 25

Trending Articles