Sunday, January 24, 2010

How to shrink a Database file

If you are using Temp tables in your stored procedure, it may leave some free or white spaces in it.

this code will shrink the database file , once you execute this code, it will remove the free spaces.


backup log Pubs with truncate_only

GO

dbcc shrinkfile(Pubs) -- Logical file name of Master File

GO

shrinkfile(Pubs_log) -- Logical file name of Log File

No comments:

Post a Comment