SQL, Team Foundation Server, Windows

Migrate Team Foundation Server 2013 SQL Server to Another SQL Server

We recently had to migrate the Team Foundation Server 2013 data tier from a physical standalone Windows 2008 R2 server running SQL Server 2014 to a new virtualised clustered environment.

The DBA and I chose to use the detach, copy, attach and re-point (remap) approach due to its simplicity.

The only difference in this procedure was that we applied friendly DNS records for the data tier and warehouse environment as per – http://www.edsquared.com/2011/01/03/Using+Friendly+DNS+Names+In+Your+TFS+Environment.aspx – I don’t know how I didn’t think of that years ago!


Step 1 – Detach TFS Project Collections in TFS Administration Console

  1. Detach all the project collections which are to be migrated to the new SQL environment:

    Upon successful completion you will see something like this:

Step 2 – Stop TFS services

  1. In an elevated CMD prompt, CD to “C:\Program Files\Microsoft Team Foundation Server 12.0\Tools” and execute TfsServiceControl.exe quiesce

Step 3 – Detach Project Collections, Configuration & Datawarehouse Databases in SQL

  1. In SQL Server Management Studio locate the previously detached project collections as well as the TFS_Configuration database and detach them:

  2. Copy the detached databases over to the new environment and in  SQL Server Management Studio re-attach them again

Step 4 – RemapDBs

  1. Still in the same elevated CMD prompt from earlier we execute the RemapDBs command:
    TfsConfig.exe remapdbs /DatabaseName:dbtfstst.domain.local;Tfs_Configuration /SQLInstances:dbtfstst.domain.local

Step 4.- RegisterDB

  1. Still in the same elevated CMD prompt we execute the RegisterDB command:
    Tfsconfig.exe registerDB /SQLInstance:dbtfstst.domain.local /DatabaseName:Tfs_Configuration

Step 5 – Start TFS Services

  1. Still in the same elevated CMD prompt execute TfsServiceControl.exe unquiesce:

Leave a Comment

Your email address will not be published. Required fields are marked *