According to this Doc, I can remove the patch folder in .patch_storage if the patch is not listed in opatch inventory.
How To Avoid Disk Full Issues Because OPatch Backups Take Big Amount Of Disk Space. (Doc ID 550522.1)
The following two scripts work the same way, they list the patch number that has zero match in opatch inventory.
#3: this will display the ls command of those patch number that can be deleted:
sample output:
drwxr-xr-x 4 grid oinstall 4096 Jul 20 2015 20299018_Mar_4_2015_23_52_42
drwxr-xr-x 4 grid oinstall 4096 Jul 20 2015 20831113_Jun_22_2015_07_20_06
drwxr-xr-x 4 grid oinstall 4096 Nov 10 2016 23854735_Sep_29_2016_23_50_00
drwxr-xr-x 4 grid oinstall 4096 Nov 10 2016 24007012_Aug_30_2016_00_17_17
rm -rf thefoldername
How To Avoid Disk Full Issues Because OPatch Backups Take Big Amount Of Disk Space. (Doc ID 550522.1)
The following two scripts work the same way, they list the patch number that has zero match in opatch inventory.
#1:
$ORACLE_HOME/OPatch/opatch
lsinventory>dropit; for patch in `ls|cut -d "_" -f 1|grep
[0-9]`; do echo $patch:`grep -c $patch
dropit`; done|awk -F":" '{if ($2==0) print $0}'
#2
ls $ORACLE_HOME/.patch_storage|cut -d
"_" -f 1|grep [0-9] > patchstorage.txt; $ORACLE_HOME/OPatch/opatch
lsinventory>opatchinventory.txt; for patch in `cat patchstorage.txt`; do
echo $patch:`grep -c $patch opatchinventory.txt`; done|awk -F":" '{if
($2==0) print $0}'
sample output:
19872484:0
20299018:0
20831113:0
21436941:0
23854735:0
run as $oracle_home owner, do not run as root, otherwise "opatch lsinventory" will fail and ends up listing all folders can be deleted.
ls -lrt $ORACLE_HOME/.patch_storage > patchstoragelist.txt; ls -rt $ORACLE_HOME/.patch_storage|cut -d "_" -f 1|grep [0-9] > patchstoragenumber.txt; $ORACLE_HOME/OPatch/opatch lsinventory>opatchinventory.txt; for patch in `cat patchstoragenumber.txt`; do echo $patch:`grep -c $patch opatchinventory.txt`; done|awk -F":" '{if ($2==0) print $0}'|cut -d ":" -f 1 > candeletepatch.txt; for patch in `cat candeletepatch.txt` ; do grep $patch patchstoragelist.txt; done
sample output:
drwxr-xr-x 4 grid oinstall 4096 Jul 20 2015 20299018_Mar_4_2015_23_52_42
drwxr-xr-x 4 grid oinstall 4096 Jul 20 2015 20831113_Jun_22_2015_07_20_06
drwxr-xr-x 4 grid oinstall 4096 Nov 10 2016 23854735_Sep_29_2016_23_50_00
drwxr-xr-x 4 grid oinstall 4096 Nov 10 2016 24007012_Aug_30_2016_00_17_17
Now you can remove the folders:
Comments
Post a Comment