Announcements

Oracle training based on real-time expertise as per industry standards. Upcoming batch details are here.

View batch schedule

Free Oracle mock interview. Register using the link.

Register

#DBAchallenge: submit your questions.

Ask questions
Swipe for more →
Browse by Topic
Latest Posts

    Saturday, March 14, 2020

    Estimate the folder size without unzipping zip file


    Estimate the folder size without unzipping zip file

    Many times, we may face disk or mount point running out of the storage during unzipping the tar or zip file. We need to estimate the space required for unzipping the file.

    Below the is the sample shell script which will estimates the space requirement for the unzipping the zip files or patches.

    Notes: 
    This is the best practice for the all kind of patching activities, OH patching, APPS patching. DBAs has to make sure adequate space is available before the patching activity.

    Shell script: 
    folder_size_estimation.sh 


    #!/bin/ksh
    #===============================================================================================#
    # Name          : folder_size_estimation.sh                                                     #
    # Written by    : Mallik                                                                        #
    # Purpose       : This script will Estimate the folder size without unzipping zip file          #
    # Pending       : NONE                                                                          #
    # Creation Date : 14-MAR-2019                                                                   #
    # Version       : 1                                                                             #
    # ==============================================================================================#
    TODAY_DATE=`date +%d%m%Y_%H%M%S`
    find /home/mramadur/patches -name "p*.zip" -print > /home/mramadur/patches/zipfiles.lst
    totalsize=0
    div=1073741824
    for zipfiles in `cat /home/mramadur/patches/zipfiles.lst`
    do
    size=`unzip -l $zipfiles | tail -1 | awk'{ print $1 }'`
    totalsize=`expr "$size" + "$totalsize"`
    done
    TS=$(echo "scale=2; $totalsize/$div" |bc)
    echo $TS GB is needed to unzip the patches


    Regards,
    Mallik

    No comments:

    Post a Comment

    🌟 Proud to be an Oracle ACE Pro! 🚀

    🌟 Proud to be an Oracle ACE Pro! 🚀 I’m excited to share my official Oracle ACE Profile with the Oracle community. 👨‍💻 Mallikarjun ...