DB SHRINK

  • Hi ,

    Please let me know about Target_percent in DBCC SHRINKDATABASE command. My DB is of size 500 MB. And the initial size when this DB is created is 100 MB. What is the Target _percent should i give to shrink the DB optimisely. What would be the outcome.

  • Please post in the appropriate forum in the future and not just anywhere you feel like.

    Why do you want to shrink? Databases tend to grow as more data gets put in them. It's in their nature.

    Shrinking causes massive fragmentation and will just result in the data file growing again next time data gets added. When that happens, the entire system will slow down as the file is expanded. Also repeated shrinks and grows will cause fragmentation at the file-system level, which is hard to fix.

    See - http://sqlinthewild.co.za/index.php/2007/09/08/shrinking-databases/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Before shrinking you need to ask yourself why you are doing it ?

    If your database has grown naturally then you will end up back where you started and worse (due to fragmentation) as Gila has pointed out.

    If you have cleared out a load of data then and you need the disk space only then should you consider shrinking it.

    As for the percentage free, only you can answer that.

    Consider how long the database has been in use and its current size then work out the average growth figure.

    You can then use this to set a sensible % age (or an actual value).

    It's best to allocate as much space as possible to databases to save them having to 'grow'.

    Also consider, if your database uses the Full Recovery model you may wish to tweak the allocated space of the log file instead. For this, use DBCC SHRINKFILE instead.

    Hope this helps.

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

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