Rename TFS Team Project Collection databases

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

image

  • Detach the matching SQL Server database from SQL Management Studio

SNAGHTMLd6bfa5a

  • 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.

image

  • 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_).

Done!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: