Restore Data to the Same Location

You can restore data from a backup to the same server and instance of SQL Server for Team Foundation from which that data was backed up. For example, you might want to restore a corrupted set of databases to the last known good state. To help ensure successful recovery of data, you should configure marked transactions as part of your backup strategy. For more information, see Back Up Team Foundation Server.

Note

You can automate some procedures in this topic by using wizards in the September 2010 release of power tools for Team Foundation Server. These wizards help simplify the process for backing up and restoring your deployment. However, they do not help back up or restore Visual Studio Lab Management, and you should use them to back up or restore the databases for SharePoint Products or Microsoft Project Server. For more information, see the following page on the Microsoft website: Team Foundation Server Power Tools September 2010.

To follow the procedures in this topic, your server hardware must function correctly. If your deployment uses SharePoint Products or Microsoft Project Server, you must perform additional steps to back up and restore its databases, as detailed in the procedures in this topic. If you want to restore data to another server or another instance of SQL Server, see Restore Data to a Different Server or Instance

Note

If you use SharePoint Products in your deployment, when you restore data, you do not have to restore the websites that are automatically generated based on the data for each team project. The data for the team project portals is contained in the databases that you restore.

The steps to restore data to the same server or servers vary based on how Team Foundation Server is installed and configured. For simplicity, the procedures in this topic are structured for a moderately complex deployment of Team Foundation Server, as the following illustration shows:

Example moderate topology with databases

If your topology does not exactly match this example, you might have to adjust the steps in this procedure to follow it successfully. For example, if you have a deployment where all components are installed on a single physical server, you would perform all procedures on that server. If databases for team project collections are deployed on more than one server, you must perform the steps to restore each collection database on the appropriate server. For more information about which components might be deployed on each server, see the following topics:

In this topic

  1. Required Permissions

  2. Stop Services that Team Foundation Server Uses

  3. Restore Team Foundation Databases

  4. Update All Service Accounts

  5. Restore the Warehouse

  6. Clear the Data Cache On Servers

  7. Restart Services that Team Foundation Server Uses

  8. Refresh the Data Cache on Client Computers

Required Permissions

To perform this procedure, you must be a member of the following groups or have the following permissions:

  • A member of the Administrators security group on the server or servers that are running the administration console for Team Foundation.

  • Either a member of the SQL Server System Administrator security group or your SQL Server Perform Back Up and Create Maintenance Plan permission must be set to Allow on the instance of SQL Server that hosts the databases.

  • A member of the sysadmin security group for the database instance for Team Foundation and for the Analysis Services instance of the warehouse database.

  • An authorized user of the TFS_Warehouse database.

  • A member of the TFSEXECROLE database role.

  • If the deployment uses SharePoint Products, a member of the Farm Administrators group for the farm to which the SharePoint Products databases are being restored.

In addition to these permissions, you might have to address the following requirements on a computer that is running Windows Server 2008:

  • To follow a command-line procedure, you might have to open an elevated Command Prompt by clicking Start, right-clicking Command Prompt, and then clicking Run as Administrator.

  • To follow a procedure that requires Internet Explorer, you might have to start it as an administrator by clicking Start, clicking All Programs, right-clicking Internet Explorer, and then clicking Run as administrator.

  • To access Report Manager, reports, or websites for SQL Server Reporting Services, you might have to add these sites to the list of trusted sites in Internet Explorer or start Internet Explorer as an administrator.

For more information, see the following page on the Microsoft website: User Account Control.

Stop Services that Team Foundation Server Uses

To stop services that Team Foundation Server uses

  1. On the server that is running the application-tier services for Team Foundation, open a Command Prompt window, and change directories to Drive:\%programfiles%\Microsoft Team Foundation Server 2010\Tools.

  2. Type the following command:

    TFSServiceControl quiesce

    For more information, see TFSServiceControl Command.

Restore Team Foundation Databases

After you stop the services, you can restore data for Team Foundation by using the restoration tools that are provided with SQL Server.

Warning

You must restore all databases to the same point in time, or the databases will be out of synchronization. The following procedures assume that you are using marked transactions to help ensure synchronization of the databases that Team Foundation Server uses. For more information, see Back Up Team Foundation Server. If your deployment uses SharePoint Products, you should follow the guidance for the version of that product in your deployment. For more information, see Backup and Recovery (SharePoint Server 2010), Protecting and restoring a farm (Office SharePoint Server 2007), or Protecting and restoring a farm (Windows SharePoint Services 3.0). If your deployment is integrated with Microsoft Project Server, you should follow the guidance for the version of that product in your deployment. For more information, see Restore databases (Project Server 2007) and Restore databases (Project Server 2010).

To open the Restore Database dialog box

  1. Log on to the server on which you want to restore databases.

  2. Click Start, point to All Programs, point to Microsoft SQL Server 2008, and then click SQL Server Management Studio.

    Note

    For more information about how to restore databases, see the following page on the Microsoft website: Implementing Restore Scenarios for SQL Server Databases.

    The Connect to Server dialog box opens.

  3. In Server type, click Database Engine.

  4. In Server name, click or type the name of the data-tier server and database instance, and then click Connect.

    Note

    If SQL Server is installed on a cluster, the server name is the name of the cluster and not the computer name.

    SQL Server Management Studio opens.

  5. Expand the Databases node to show the list of databases that make up the data tier for Team Foundation.

Complete the next procedure, "To restore a database," for each of the following databases on each server from which it originated:

On the server or servers that host the databases for Team Foundation Server:

  • TFS_Configuration

    Note

    This database name might include additional characters between TFS_ and Configuration.

  • TFS_CollectionName

    Note

    Each team project collection has its own database. For example, if you have five team project collections, you will have five databases, each distinguished by the name of the team project collection. These databases might be on the same instance of SQL Server, on separate instances, or on separate physical servers. You must back up each database and then restore each database to the server and instance from which it originated.

  • VirtualManagerDB

    The administration database for System Center Virtual Machine Manager (SCVMM) contains the information that you view in the SCVMM Administrator Console, such as virtual machines, virtual machine hosts, virtual machine library servers, and their properties.

    Note

    If SCVMM is installed on a separate server from Team Foundation Server, this database might not be present on the data-tier server for Team Foundation. In that case, you must back up and restore it separately from Team Foundation Server. However, you should use marked transactions and synchronize the maintenance of the databases to avoid synchronization errors.

On the server that is running SQL Server Reporting Services, if you have one configured for your deployment:

  • ReportServer

    Note

    If you used a named instance, this database will be named ReportServer$InstanceName.

  • ReportServerTempDB

    Note

    If you used a named instance, this database will be named ReportServerTempDB$InstanceName.

On the server or servers that are running SharePoint Products, if you have configured your deployment with one or more SharePoint web applications:

  • The administration database for SharePoint Products (WSS_AdminContent), if you are restoring the entire deployment of SharePoint Products.

  • The configuration database for SharePoint Products (WSS_Config).

  • The content database for SharePoint Products (WSS_Content).

    Note

    The names of the databases that contain data for SharePoint Products will vary depending on the version of SharePoint Products that is installed and whether the person who installed it customized the name. Additionally, these databases might not reside on the data-tier server if SharePoint Products is installed on a separate server from Team Foundation Server. If the databases reside on a different server, you must manage their backup, restoration, and configuration separately from Team Foundation Server. However, you should synchronize the maintenance of the databases to avoid synchronization errors.

    To restore the databases that SharePoint Products uses, you should follow the guidance for the version of that product in your deployment. For more information, see Backup and Recovery (SharePoint Server 2010), Protecting and restoring a farm (Office SharePoint Server 2007), or Protecting and restoring a farm (Windows SharePoint Services 3.0).

On the server or servers that are running Microsoft Project Server, if you have integrated your deployment with Project Server and must restore the databases to a different server:

If you do not intend to rebuild the warehouse:

  • TFS_Warehouse

    Note

    This database name might include additional characters between TFS_ and Warehouse.

  • TFS_Analysis

For more information about these databases, see Understanding Backing Up Team Foundation Server.

To restore a database

  1. Right-click the database that you want to restore, point to Tasks, point to Restore, and then click Database.

    The Restore Database dialog box opens.

  2. Under Source for restore, click From Device, and then click the ellipsis button ().

  3. In the Specify Backup dialog box, specify the location of the backup file, and then click OK.

    You must restore the full backup first, followed by the differential backup, and then the transaction log backups, in the order in which they were created.

  4. Under Select the backup sets to restore, specify the backup sets to restore.

    If you created marked transaction backup sets, make sure that you restore the full, differential, and transaction log databases. For examples of marked transaction backup sets, see Back Up Team Foundation Server.

  5. In the Select a page pane, click Options, and then select the Overwrite the existing database check box.

  6. In the Restore the database files as list, verify that the paths match your current database paths.

  7. Under Recovery state, perform one of the following tasks:

    • If you are using marked transactions, click Leave the database non-operational, and do not roll back uncommitted transactions. Additional transaction logs can be restored. (RESTORE WITH RECOVERY).

    • If you are not using marked transactions and you are not applying additional transaction logs, click Leave the database ready to use.

    • If you are not using marked transactions but you are applying additional transaction logs, click Leave the database non-operational.

  8. Click OK.

    A progress icon appears.

  9. When the SQL Server Management Studio dialog box appears and confirms successful restoration, click OK to return to Object Explorer.

  10. If you are using marked transactions, right-click the database that you just restored, point to Tasks, point to Restore, and then click Transaction Log.

    The Restore Transaction Log window opens.

  11. On the General page, make sure that the appropriate database is highlighted in the Database list.

  12. Under Select the transaction log to restore, select the check box next to the log that you want to restore.

  13. Under Restore to, click Marked transaction.

    The Select Marked Transaction window opens.

  14. In the Select the marked transaction to stop the restore at list, select the check box next to the transaction mark that you want to use for the restoration, and then click OK.

    Important

    You must use the same transaction mark that has the same date and time for all databases to successfully restore the data.

  15. In the Restore Transaction Log window, click OK.

    A progress icon appears.

  16. When the SQL Server Management Studio dialog box appears and confirms successful restoration, click OK.

    For more information, see the following page on the Microsoft website: Applying Transaction Log Backups.

Note

If you restored the databases for Reporting Services, you must also restore the encryption key for those databases. For more information, see the following topic on the Microsoft website: Restoring the Encryption Key (Reporting Services Configuration).

Update All Service Accounts

You must update the service account for Team Foundation Server (TFSService) and the data sources account (TFSReports). Even if these accounts have not changed, you must update the information to ensure that the identity and the format of the accounts are appropriate.

To update service accounts

  1. On the server that is running SQL Server Reporting Services, open Computer Management, and start the following components if they are not already started:

    • ReportServer or ReportServer$InstanceName (application pool)

    • SQL Server Reporting Services (TFSINSTANCE)

  2. On the application-tier server, open a Command Prompt window, and change directories to Drive:\%programfiles%\ Microsoft Team Foundation Server 2010\Tools.

  3. At the command prompt, type the following command to add the service account for Team Foundation, where DatabaseName is the name of the configuration database (by default, TFS_Configuration):

    **TfsConfig Accounts /add /AccountType:ApplicationTier /account:**AccountName

    For more information about how to use this command, see Accounts Command.

  4. Use the Accounts command to add the data sources account for the report server and the proxy account for Team Foundation Server Proxy, if your deployment uses these resources.

Rebuild the Warehouse

You can rebuild the data warehouse instead of restoring the TFS_Warehouse and TFS_Analysis databases. You will require a significant amount of time to rebuild the warehouse if your deployment contains a lot of data. However, that strategy helps ensure that all data is properly synchronized. When you rebuild the warehouse, Team Foundation Server creates an instance of it, which you must then process to populate it by using data from the operational stores.

Note

If you restored the TFS_Warehouse and TFS_Analysis databases in the previous section, you do not have to perform the following procedure.

To rebuild the warehouse

  1. On the server that is running the application-tier services for Team Foundation, open a Command Prompt window, and change directories to Drive:\%programfiles%\Microsoft Team Foundation Server 2010\Tools.

  2. Type the following command:

    TFSConfig rebuildwarehouse /all /ReportingDataSourcePassword:Password

    where Password is the password for the data sources account for Reporting Services (TFSReports).

  3. Wait until the command is successfully completed.

    Note

    If the command is not completed successfully, you should verify that you have all required permissions. For more information, see Troubleshooting the Data Warehouse.

  4. On the report server, open Internet Explorer, type the following string in the Address bar, and then press ENTER:

    https://localhost:8080/VirtualDirectory/TeamFoundation/Administration/v3.0/WarehouseControlService.asmx

    For VirtualDirectory, type the virtual directory for Internet Information Services (IIS) that was specified when Team Foundation Server was installed. By default, this directory is named tfs.

    The WarehouseControlWebService page opens.

    Note

    The Microsoft Team Foundation Server Application Pool must be running for the Warehouse Control Web service to be available.

  5. Click GetProcessingStatus, and then click Invoke.

    Important

    The service should return a value of Idle for all jobs, which indicates that the cube is not being processed. If a different value is returned, repeat this step until Idle is returned for all jobs.

  6. On the WarehouseControlWebService page, click ProcessAnalysisDatabase, and then click Invoke.

    A browser window opens. The service returns True when it successfully starts to process the cube and False if it is not successful or if the cube is currently being processed.

  7. To determine when the cube has been processed, return to the WarehouseControlWebService page, click GetProcessingStatus, and then click Invoke.

    Processing has completed when the GetProcessingStatus service returns a value of Idle for all jobs.

    For more information, see Manually Process the Data Warehouse and Analysis Services Cube for Team Foundation Server.

  8. On the application-tier server for Team Foundation, open Computer Management, and start the Visual Studio Team Foundation Background Job Service.

Clear the Data Cache on Servers

Each application-tier server in your deployment of Team Foundation utilizes a file cache so that users can more quickly download files from the data-tier server. When you restore a deployment, you should clear this cache on each application-tier server. Otherwise, mismatched file IDs might cause problems when users download files from version control. If your deployment uses Team Foundation Server Proxy, you must also clear the data cache on each server that is configured as a proxy.

Note

By performing this step, you can help prevent the download of incorrect versions of files in version control. You should perform this step unless you are replacing all hardware in your deployment as part of your restoration. If you are replacing all hardware, you can skip this procedure.

To clear the data cache

  1. On a server that is running the application-tier services for Team Foundation or that is configured with Team Foundation Server Proxy, open a Command Prompt window, and then change directories to Drive:\%programfiles%\Microsoft Team Foundation Server 2010\Application Tier\Web Services\_tfs_data.

  2. Delete everything in the _tfs_data directory.

  3. Repeat these steps for each application-tier server and each server that is running Team Foundation Server Proxy in your deployment.

Restart Services that Team Foundation Server Uses

After you restore the data, you must restart the services to return the server to an operational state.

To restart services that Team Foundation Server uses

  1. On the server that is running the application-tier services for Team Foundation, open a Command Prompt window, and change directories to Drive:\%programfiles%\Microsoft Team Foundation Server 2010\Tools.

  2. Type the following command:

    TFSServiceControl unquiesce

    For more information, see TFSServiceControl Command.

Refresh the Data Cache on Client Computers

To refresh the data cache on client computers

See Also

Tasks

Restore Data to a Different Server or Instance

Concepts

Team Foundation Server Permissions

Team Foundation Server Architecture

Back Up Team Foundation Server

Restore Lab Management Components

Other Resources

Team Foundation Server Services and Service Accounts

Managing Data

Managing Team Foundation Server