3 minute read

Error

TF246017: Team Foundation Server could not connect to the database.
Verify that the server that is hosting the database is operational, and that network problems are not blocking communication with the server.

Root Cause

This error can occur due to following reasons

  • Incorrect SQL Installation order especially if you are using Express edition
  • Database In Recovery
  • Database Out-of-Sync – during migration to newer version of TFS
  • Permission of Service Account is not right
  • SQL Database not running or not reachable
  • TFS Proxy not reachable

Solution

If your database server has restarted and you are trying during that time, you may face this issue. You may want to take a cup of coffee and retry after sometime.  If the error still persists, you can try debugging the below.

Check if you are able to connect to SQL database by yourself.  If you are not aware of the database connection, it is advisable to reach out to your support team in your organization to check the connectivity. 

If this issue arises only when you are checking in or doing an undo pending changes, chances are that SQL Server has logical consistency I/O error.  You can try repairing the database (or request your DBAs to do it for you) by running following command against all TFS databases

DBCC CHECKDB

If there are database errors, your DBA should be able to resolve it. 
If there no database errors, then you need to check if the service account through which the TFS services are running (on TFS server) has same credentials and if the permissions granted are correct.  You may want to sync-up the services

If you have migrated TFS / database, you may want to check if backup of all databases is restored.  Partial restoration of backups also can cause this issue.  You can refer to the MSDN link of list of TFS databases.  This list may differ based on version of TFS.