When you delete the team project or project artifacts from TFS 2010, the TFS collection database won’t release the space occupied to store those artifacts. Even when you shrink the database file, you won’t see any change in the TPC database (.mdf) file size.
To recover the space, follow the below steps (Please wait for couple of hours to execute this command after you deleted the artifacts):
- Delete the team project/project artifacts.
- Rebuild the index on the TPC database log file using “DBCC DBREINDEX” command. This command need to be executed for each table in the database. Use a SQL cursor to execute this for all the tables in database.
dbcc dbreindex (‘tfs_defaultcollection.dbo.Actions’)
-
Execute the “DBCC SHRINKFILE” command on TPC database log file (.ldf) and then on data file (.mdf).
dbcc shrinkfile (‘Tfs_DefaultCollection_log’)
dbcc shrinkfile (‘ Tfs_DefaultCollection ‘)
-
Now check your TPC database size, it should have reduced.