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 0 – PERFORM A FULL BACKUP***
Step 1 – Detach TFS Project Collections in TFS Administration Console
- Detach all the project collections which are to be migrated to the new SQL environment:
Step 2 – Stop TFS services
- 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
- In SQL Server Management Studio locate the previously detached project collections as well as the TFS_Configuration database and detach them:
- Copy the detached databases over to the new environment and in SQL Server Management Studio re-attach them again
Step 4 – RemapDBs
- 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
- Still in the same elevated CMD prompt we execute the RegisterDB command:
Tfsconfig.exe registerDB /SQLInstance:dbtfstst.domain.local /DatabaseName:Tfs_Configuration