Saturday, May 8, 2010

Unable to attach a Project Collection in TFS 2010

After creating a backup from an existing instance of TFS 2010 and restoring it in SQL Server using a different name, I started the Team Foundation Server Administration Tool. But the project collection attachment wizard did not recognize any available Team Project Collection DB. So what did I do wrong?

It’s important to understand that you can not attach a collection database that has not been previously detached. This is mainly due to identity and configuration data that exists globably which need to be moved down to the collection. Without this data the collection would not know who are the users that checked in code and other scenarios.

So the correct steps to attach an existing project collection are:

Detach the project collection you want to move on the source TFS server

Create a backup of the TFS_[CollectionName] database on the source database server.

Restore the database on the target database server. (Note: Make sure that the database has a different name than any existing collection databases)