How to reduce the size of a mdf file?

  • Hi Everybody,

    Good Day to you all,

    I want some advice from you all regarding the following questions:

    1)Can mdf file(primary) grow as the tables,SP's,functions etc will grow?

    2)How can we reduce the size of mdf file with out effecting the data contents present in it?

    3)How can we reduce the file - By SHRINK or TRNCATE. Which one is better in case of No data loss and reduction in size?

    4)After reducing the size , is there any chance of again growing the size of mdf file?

    Thanks in Advance,

    Venu Gopal.K
    Software Engineer
    INDIA

  • venu_ksheerasagaram (7/1/2009)


    1)Can mdf file(primary) grow as the tables,SP's,functions etc will grow?

    yes as u put new objects and pump data to tables, size of your mdf will grow if there is not enough empty space available within it to accomodate changes.

    2)How can we reduce the size of mdf file with out effecting the data contents present in it?

    you generally use dbcc shrinkdatabase or dbcc shrinkfile. This will only release free space within the mdf. dont perform such operations as these causes lots of fragmentation and u'll face performance issues.

    3)How can we reduce the file - By SHRINK or TRNCATE. Which one is better in case of No data loss and reduction in size?

    the term truncating is generally associated with log files. Truncating a log means releasing space used in the log by committed transactions. this released space wont be released back to operating system, instead the physical file will remain as it is and freed up space will be reused by future transactions. Shrinking means physically reducing the size of the files by relasing the unused space back to operating system. Also, you cannot reduce the size of the mdf smaller than when what it was when it was created.

    4)After reducing the size , is there any chance of again growing the size of mdf file?

    yes, if u perform operations in the database, its size will obviously grow...

    Thanks in Advance,[/quote]



    Pradeep Singh

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply