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.
To use the Recover command, you must be a member of the Team Foundation Administrators group on the application-tier server for Team Foundation and a member of the sysadmin group in SQL Server on the data-tier server for Team Foundation. For more information, see Team Foundation Server Permissions.
Even if you are logged on with administrative credentials, you must open an elevated Command Prompt to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt, click Start, right-click Command Prompt, and then click Run as Administrator. For more information, see the Microsoft Web site.
TFSConfig Recover [/SQLInstances:ServerName1[,ServerName2,…]] [/ConfigurationDB:ServerName;DatabaseName /CollectionDB:ServerName;CollectionDatabaseName]
Specifies the name of the server that hosts the databases for Visual Studio Team Foundation Server. If you are using an instance other than the default instance, you specify it by using the following format:
Specifies the name of the configuration database for Team Foundation Server. By default, the name of this database is TFS_Configuration, but this database name might have been customized.
Specifies the name of the collection database that you want to recover or reattach. If this database is hosted on a separate server or instance of SQL Server, you must specify both the server name and the instance name. If the name of the collection contains spaces, you must enclose the name in quotation marks (for example, "My Collection").
You cannot use this option with any other options. Specifies the name of the server that is running SQL Server. If you are using an instance other than the default instance, you specify it by using the following format:
If your deployment is using more than one server that is running SQL Server, you must specify all servers and instances, separated by commas, as in the following format:
You must use this option with /CollectionDB. You cannot use this option with with /SQLInstances. Specifies the name of the server that hosts the configuration database for Team Foundation Server and the name of the configuration database for Team Foundation Server. If you are hosting the configuration database on an instance of SQL Server that is not the default instance, you specify the name and instance by using the following format:
You must use this option with /ConfigurationDB. You cannot use this option with /SQLInstances. Specifies the name of the server that is running SQL Server and the name of the collection database that is hosted on that server. If you are hosting the collection database on an instance of SQL Server that is not the default instance, you specify the name and instance in the following format:
The Recover command is not reversible and should not be used except after the standard attempts to restore the databases for a deployment have failed. The Recover command will scan all of the SQL Server instances that you specify in the options for a configuration database. All collection databases that the command finds during the scan will be attached to the configuration database that the command finds in the scan. The Recover command returns an error if it finds multiple configuration databases during the scan or if the command finds more than one collection database with the same name. You must have only one configuration database in a deployment of Team Foundation Server, and all collections must have unique names within that deployment.
The Recover command will bind any collection database that it finds to the configuration database that it finds, regardless of whether that collection database is already in use by another configuration database. This action can cause a collection that is functioning in another deployment of Team Foundation Server to stop functioning.
The following example shows how to recover the collection database "Experimental Projects" in the Contoso1 deployment of Team Foundation Server. In this example, the configuration database is hosted on a separate instance of SQL Server (ContosoSQLServer1\Team2) from the collection database (ContosoSQLServer2\Projects).
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, places, or events is intended or should be inferred.
TFSConfig Recover /ConfigurationDB:ContosoSQLServer1\Team2;TFS_ConfigurationDB /CollectionDB:ContosoSQLServer2\Projects;"Experimental Projects"
The following example shows how to repair a deployment of Team Foundation Server that uses the following instances of SQL Server across two servers: the instance "Team2" on ContosoSQLServer1 and the default instance on the server ContosoSQLServer2.
TFSConfig Recover /SQLInstances:ContosoSQLServer1\Team2,ContosoSQLServer2