Why Does TFS Allow Orphaned Content and How Do I Get Rid of It?

Posted by Chad on Stack Overflow See other posts from Stack Overflow or by Chad
Published on 2010-03-22T16:47:18Z Indexed on 2010/03/23 17:33 UTC
Read the original article Hit count: 180

Filed under:

My TfsVersionControl database has grown to 40+ GB in size. We recently did a TFS Destroy on a folder tree that should have cleared up at least 10 GB but instead it seemed to have no effect.

When I look at the tables in TfsVersionControl, I am first shocked to see that there are no foreign keys at all in the database. Running a few queries, I see that there is some orphaning going on:

  • tbl_Content has 13.9 GB of records that don't have a related tbl_File record
  • tbl_File and tbl_Content have 2.4 GB that don't have a related tbl_Namespace record

The cleanup job seems to be running nightly (prc_DeleteUnusedContent) and running it against the database manually doesn't remove any orphans. I see in the log for the cleanup job that it failed on 3/16, which is the morning after I destroyed the large amount of data. The error was due to a full transaction log.

Could that error be the reason I'm left with all this orphaned data that can't be deleted? How can I permanently destroy this unneeded content?

© Stack Overflow or respective owner

Related posts about tfs