Home » SQL Server

Unable to shrink Data file sql server 2008

Unable to shrink datafile. tried dbcc shrink commands no luck.I still see huge unused space.The databse is setup under Transactional Replication.On the other hand the replicated database is already shrunk .Any ideas?

9 Answers Found


Answer 1

When you say unable what exactly do you mean? i.e. do you get errors or does it timeout? If you try shrinking by only a small amount does that work? Can you see if you are being blocked? Also are you trying to shrink the log or data files?




Answer 2


Have you tried DBCC SHRINKFILE with TRUNCATEONLY option?



Answer 3

It doesnt time out or error out.I tried doing it in small chunks  but no luck.Its not blocked either.I get the result immedietly.Im trying to shrink the data files. The data data files Im trying to shrink belongs to SQL Partition filegroup.

Answer 4

Yes I tried the TRUNCATEONLY  option only. Doesnt work.

Answer 5

I hope  you do understand why it "does not work" even with TRUNCATEONLY option

Answer 6

I hope  you do understand why it "does not work" even with TRUNCATEONLY option

Answer 7

Sorry I dont understand.Please explain me.

Answer 8

Yep, in addition, there is enough that at least one page at the end has a data TRUNCATEONLY won't be usefull

Answer 9

During database maintenance period take database offline, then online.

Use Object Explorer GUI shrink file to shrink each file in the database. Image follows:

Log shrinking link: http://sqlusa.com/bestpractices2005/shrinklog/


Kalman Toth, Microsoft Community Contributor 2011; SQL 2008 GRAND SLAM



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure