When doing TFS migrations I’m often faced with mismatches between the name of the Team Project Collection and the underlying database file name. Instead of keeping track of which TPC is linked with a specific database file name, I recommend to keep the names aligned to avoid confusion.
How to do this?
First, make sure you have a valid backup of the complete TFS environment. The easiest way is to enable a built-in TFS backup plan.
- Detach the Team Project Collection via the TFS Administration Console
- Detach the matching SQL Server database from SQL Management Studio
- Rename the underlying database (.mdf) file to match the desired name for the Team Project Collection (prefix with Tfs_).
- Attach the SQL database via the renamed .mdf file. A new log file database (.ldf) will automatically be created. You can remove the old .ldf file.
- Attach the renamed database as a Team Project Collection via the TFS Administration Console and apply the desired Team Project Collection name (without prefix Tfs_).