by XDK
20. December 2013 07:17
Todeleteorphanworkspaces.sql (2.93 kb)
To delete orphan workspaces.sql (2.93 kb)
Explanation:
Deleting a team project through tfsdeleteproject command will result making the associated workspaces and shelvesets as orphan records in TFS collection database. The collection database size may not reduce as expected even after team project delete.
tfsdeleteproject /force /q /excludewss /collection:"<Collection Name>" "<Project Name>"
Solution:
The attached script finds and deletes the workspaces\shelvesets that only have workspace\shelvesets mappings for projects that no longer exist and delete them.
Please backup the collection database before you execute the script.
This script require TFS 2012 update 2 or newer
To delete orphan workspaces.sql (2.93 kb)
To delete orphan shelvesets.sql (2.58 kb)