Link to home
Start Free TrialLog in
Avatar of SeTech
SeTechFlag for United States of America

asked on

Shrink Database/File 2005

Using SMSS I have started Shrink Database (selected database in question, right click, chose task --> shrink --> database) The problem is that it never finishes. The green activate wheel has been spinning for days as if it never activated. I have heard not to just stop a shrink, so should I do a restart with SQL Services. Also am I better off doing a shirnk file on the .mdf?
Thanks
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Your best approach is never to use the GUI and especially for something like this.  First KILL the connection.  Do it as follows:
exec sp_who

Identify yourself and then use:
KILL x     -- Where x is the connection shrinking the database.

Once you have that resolved in order to shrink the data file I would do something like this:
DBCC SHRINKFILE('YourLogicalDataFileNameGoesHere',  10000)   -- Where 10000 = 10GB

You can stop it at any time.

If you are in Full Recovery Model, make sure you have plenty of space for your Transaction Log as it will use a lot.
Just detach and attach the database willl do the trick.
>>Just detach and attach the database willl do the trick.<<
You may want to double check that.
ASKER CERTIFIED SOLUTION
Avatar of FrancoCarusi
FrancoCarusi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial