How to recover a collection database when it is not listed in the TFS admin console!!!

Author: Vimal Thiagaraj

Technical Review: Lakhminder

We don't recommend running of the recover command as it can cause unforseen issues during future upgrades and working of the collection.
The command has been discontinued from TFS 2012. Running of this command may get your collection to an un-supported state.
Don't run it unless its absolutely needed.

 

This is a scenario that we do not want to encounter, but if you happen to face it, here is are the steps to recover.

Use the command line:

TFS 2010 comes with cool command line utilities as well, though it has a versatile graphical user interface

The following command will help you attach the collection database in to TFS (please note that the database must be already restored/attached and healthy in SQL server)

TFSConfig Recover /ConfigurationDB:SQLServer\InstanceName;TFS_ConfigurationDBName /CollectionDB:SQLServer\instanceName;"Collection Name"

(tfsconfig.exe is located in the following folder)

\Program Files\Microsoft Team Foundation Server 2010\Tools

This will run sequence of steps and at the end you will either see the collection database online or off-line in TFS Administration console

In the event if it is Off-line:

When you try to start the collection, you may see the following error message:

---------------------------

Error

---------------------------

The host 'Collection Name’ cannot be started. The servicing needs to be scheduled and completed before the host can be started.

---------------------------

OK

---------------------------

You may also see the following in the Warning message:

This collection has SQL Enterprise features enabled. If you are moving the collection across SQL Server Editions please read the documentation (https://go.microsoft.com/fwlink/?LinkId=166007) to see how this impacts you.

How to bring the offline collection database to online now?

1. Highlight and select the Collection database that is Offline

2. Detach the collection

3. Now attach it again using the Admin Console / collections / Attach

4. It should get attached now

If it goes off-line or not getting attached now, there must be serious issue, and you might want to go for the last known good backup or contact Product support.

Recover command:

You can use the Recover command to attempt to repair and reattach team project collections and team projects that might have been damaged or orphaned. For example, you might use this command if backups are not synchronized properly and one or more collections cannot be reattached or if a collection was not detached correctly. This command should be used only when a server failure or database synchronization failure resulted in a state where a collection or project could not be completely restored and reattached from backups.

https://msdn.microsoft.com/en-us/library/ff407077.aspx