Moving your TFS databases onto a new server, and possibly upgrading the TFS version while doing so

Posted: (EET/GMT+2)

 

Are you in the process of upgrading your TFS (Team Foundation Server) version control, and want to move your projects/project collections to a new TFS server? If yes, you need to use a process called "project collection move", which is well documented on TFS documentation.

If you move databases to a new TFS version along the way, they are also migrated automatically to the new version.

Basically, the move process goes like this:

  1. Detach a team project collection from the old/original server. This removes the database from TFS’s list of active collections, but leaves the database in SQL Server intact.
  2. Take a backup of the detached database, for example using SQL Server Management Studio.
  3. Restore the database backup onto the new SQL Server.
  4. On the new TFS server’s Admin Console, attach the database to the new server.

While you attach a database again to TFS, it will be automatically migrated to the version matching the destination TFS version. That is, if you had detached, say, a TFS 2012 project collection and would attach it to TFS 2017, then the database will be automatically migrated.

Since there is no way to undo a migration, be sure to keep backups available. However, note that since the database is still available on the original SQL Server, you could re-attach the same database again to the old TFS server. However, this could cause some data loss, if you have already had users work with the newer TFS.