Shrink database file

  • I've a database size of 50GB, we drop some tables that we dont use anymore. The database is now around 3GB. My physical database file still shows 50GB.

    I tried to shrink the file, but the size is still on 50GB.

    We are running out of space and I dont know how to change the physical size to the desire size.

    What should I do ?

  • Since this will be a one-time operation, you can use SHRINKFILE to shrink the data file. What you'll have to do first is try rebuilding all indexes. You might have allocated space for text data columns that can be released with a rebuild.

    If you have tables that do not have clustered indexes, try creating a clustered index and then dropping it.

    Make sure you leave enough space in the data file for normal operations (e.g. index rebuilds) and data growth (at least 6 months, more if you can afford it).

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Don't forget to rebuild your indexes after the shrink operation as they will likely be fragmented.

  • Thank you all 🙂

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

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