• george sibbald (12/30/2013)


    if you use truncateonly the shrinkfile will not attempt to move any pages around so no fragmentation will be caused in this case.

    Therefore this is safe to do and worth a shot as a first attempt to see what you get back. However the chances are you will not get anything back in my experience. I do not know of a query to determine is the last extent is in use.

    I would advise doing the shrink in chunks rather than trying to get all the space back in one go.

    I've heard a few people suggest doing this in chunks, but how is that done? For example one file is 950Gigs with about 200 Gigs free, so would this be running something like this (given the TRUNCATEONLY option yields no results):

    DBCC SHRINKFILE (DATA1,900000) then DBCC SHRINKFILE (DATA1,850000) then DBCC SHRINKFILE (DATA1,800000) and so forth until I get it to the desired size? I'll definitely be monitoring the log files while this runs, and I assume I can gauge an appropriate size to use based on when the logs start growing too large.

    Sam