Search This Blog

Tuesday, March 26, 2013

Cleans all pages in all files of the SQL Server database

SQL Server > System Stored Procedures > sp_clean_db_free_space

Cleans all pages in all files of the database.


Under some circumstances, the deleted rows can physically remain on the data page as a ghost records.
You can use sp_clean_db_free_space to clean these ghost records.
Before you run sp_clean_db_free_space,  it is recommend to create a full database backup.

Example


USE Master


GO


EXEC sp_clean_db_free_space  @dbname = N'YourDBName';