Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

#sp_shrinkdata

By acedba,

Unlike shrinking transaction log, shrinking a data file seems to be tough. A lot of people complained about the "shrink database" option in EM not working, or DBCC SHRINKDATABASE not working, or DBCC SHRINKFILE not working. I have found that a data file will eventually shrink given enough try, time and patience. I've put everything together in a temporary stored procedure. I don't want to use a permanent stored proc due to the need to access sysfiles table in each database. It has been tested on both SQL 7 and 2000.

Note: the accuracy of size depends on how update the statistics on data usage.   

Total article views: 368 | Views in the last 30 days: 1
 
Related Articles
FORUM

shrinking

shrinking

FORUM

Shrink database

Shrink database

FORUM

Shrink database

Shrink database

FORUM

Shrink Db

Shrink database

FORUM

Shrink database

Shrink database

 
Contribute