How to: Restore Data for Team Foundation

This topic describes how to restore data from a backup to the same data-tier server for Team Foundation from which the backup originated. For example, you might want to restore a corrupted data-tier server to its last known good state. To follow the procedures in this topic, your server hardware must function correctly. If you must restore the data to another server, see How to: Restore Data for Team Foundation Server to a Different Server

The procedures in this topic refer to the data-tier and application-tier servers as in a dual-server deployment of Visual Studio Team System Team Foundation Server. If you have a single-server deployment, you perform all procedures on the server that is running Team Foundation Server. If components are deployed on more than two servers, you must perform the steps for each component on the appropriate server. For example, SQL Server Reporting Services might be deployed on a third server. For more information about which components might be deployed on each server, see Team Foundation Server Security Architecture.

Note

When you restore data, you do not need to restore the Web sites that are automatically generated based on the data for each team project.

Required Permissions

To perform this procedure, you must be a member of the Administrators security group on the data-tier server. You must also be a member of the SQL Server System Administrator security group on the data-tier server, or the SQL Server Perform Back Up and Create Maintenance Plan permission must be set to Allow. For more information, see Team Foundation Server Permissions.

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

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

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

  • To edit web.config files, you might need to start the text editor as an administrator by clicking Start, clicking All Programs, right-clicking the editor, and then clicking Run as administrator.

  • To access Report Manager, reports, or Web sites for Reporting Services, you might need 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 Microsoft Web site.

To restore data for Team Foundation, you must perform the following procedures:

  1. Stop Services that Team Foundation Server Uses

  2. Restore Team Foundation Databases

  3. Rebuild the Team System Cube

  4. Delete the Version Control Cache

  5. Restart Services that Team Foundation Server Uses

  6. (Optional) Update the security identifier (SID) of the Service Account for Team Foundation Server

  7. (Optional) Update the security identifiers (SIDs) for Accounts Used to Create Projects

  8. Refresh the Data Cache on Client Computers

The data tier for Team Foundation includes a set of SQL Server databases, some of which serve the Web sites for team projects. The following table lists the databases for Team Foundation:

Database

Description

ReportServer

Contains the reports and report settings for Reporting Services.

ReportServerTempDB

Temporarily stores information that is used when you run specific reports for Reporting Services.

STS_Config_TFS or WSS_Config

Contains a list of all sites, content databases, site templates, custom Web parts, and other settings that SharePoint Products and Technologies uses. This database is the configuration database for SharePoint Products and Technologies.

STS_Content_TFS or WSS_Content

Contains the content for the team's SharePoint site. This database is the content database for SharePoint Products and Technologies.

NoteNote:
The name of the database that contains data for SharePoint Products and Technologies will vary depending on the version of SharePoint Products and Technologies 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 and Technologies 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.

TfsBuild

Contains data about Team Foundation Build and published test results.

TfsIntegration

Contains information about projects, areas, iterations, permissions, group membership, and other registration data.

TfsVersionControl

Contains data about version control and is the Team Foundation version control database.

TFSWarehouse

Contains operational store data that is used to build the online analytical processing (OLAP) cube for Team System.

NoteNote:
You do not need to back up and restore the analysis services database and the Team System cube separately. Both of these objects are rebuilt from the restored TFSWarehouse database.

For more information, see Understanding the Data Warehouse Architecture.

TfsWorkItemTracking

Contains data about tracking work items and is the Team Foundation work item tracking database.

TfsWorkItemTrackingAttachments

Contains data about tracking attachments in work items and is the Team Foundation work item tracking attachments database.

TfsActivityLogging

Contains a log of all Web service requests for Team Foundation Server.

NoteNote:
Team Foundation Server does not require this database to function, so you do not need to back it up.

Stop Services that Team Foundation Server Uses

To stop services that Team Foundation Server uses

  • Log on to the appropriate server, open Computer Manager, and stop the following components in the order specified:

    Log on to the server that hosts this program

    Stop this component

    SharePoint Products and Technologies

    • SharePoint Timer Service or Windows SharePoint Services Timer

    • The relevant applications pools for SharePoint Products and Technologies. Depending on the version and edition of SharePoint Products and Technologies that you installed and how you configured it, you might need to stop one or more of the following pools:

      • DefaultAppPool

      • SharePoint Central Administration v3

      • SharePoint - 80

      • TFSWSS

      • TFSWSSADMIN

    Application tier

    • Visual Studio Team Foundation Server Task Scheduler Service

    • Microsoft Team Foundation Server Application Pool

    Reporting Services

    • SQL Server Reporting Services (TFSINSTANCE)

    • ReportServer or ReportServer$InstanceName (application pool)

      NoteNote:
      You manage ReportServer in Internet Information Services (IIS) for SQL Server 2005 but not for SQL Server 2008.

    For more information, see How to: Stop and Start Services, Application Pools, and Web Sites.

    If you do not have other services that you must run, you can stop IIS. To stop IIS, open a Command Prompt window, and use the IISReset command with the /stop parameter. For example, type iisreset /stop.

Restore Team Foundation Databases

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

Warning

You must restore all databases to the same point in time, or the databases will be corrupted.

To open the Restore Database dialog box

  1. Log on to the data-tier server.

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

    Note

    For more information about how to restore databases, see "Implementing Restore Scenarios for SQL Server Databases" on the Microsoft Web site.

    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:

  • 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.

  • The configuration database for SharePoint Products and Technologies (STS_Config_TFS or WSS_Config)

  • The content database for SharePoint Products and Technologies (STS_Content_TFS or WSS_Content)

    Note

    The names of the databases that contain data for SharePoint Products and Technologies will vary depending on the version of SharePoint Products and Technologies 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 and Technologies 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.

  • TfsBuild

  • TfsIntegration

  • TfsVersionControl

  • TfsWarehouse

  • TfsWorkItemTracking

  • TfsWorkItemTrackingAttachments

  • TfsActivityLogging (optional)

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.

    The first backup that you restore must be a full backup, followed by 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.

  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, click the appropriate state.

  8. If you are not applying additional transaction logs, click Leave the database ready to use.

    If you are applying additional transaction logs, click Leave the database non-operational.

  9. Click OK to close the Restore Database dialog box and restore the database.

  10. If you are applying additional transaction logs, follow this procedure for each set of log backups, in the order in which they were created. Start with the first one made after the full backup.

    For more information, see "Applying Transaction Log Backups" for either SQL Server 2005 or SQL Server 2008 on the Microsoft Web site.

Rebuild the Team System Cube

To rebuild the Team System Cube

  • Log on to the application-tier server, and rebuild the Team System cube.

    For more information, see How to: Rebuild the Team System Cube.

    Note

    The SetupWarehouse command-line tool, which you use to rebuild the cube, will return an error because you stopped the application pool for Team Foundation Server in a procedure earlier in this topic. This behavior is expected.

Delete the Version Control Cache

After you rebuild the Team System cube, you must delete the version control cache on the application-tier server (and any proxy servers) to force synchronization with the new data-tier server.

To delete the version control cache

  1. Log on to the application-tier server, and open the following directory:

    Drive:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\VersionControl

  2. Delete the contents of the Data subdirectory, but do not delete the Data subdirectory itself.

    For more information, see How to: Delete the Version Control Cache on the Application-tier Server.

  3. Repeat this procedure on any server in your deployment that is running Team Foundation Server Proxy.

Update the Security Identifier (SID) of the Service Account for Team Foundation Server

You must update the security identifier (SID) for the service account for Team Foundation Server whenever you restore data to a computer on which Team Foundation Server was reinstalled.

To update the SID of the service account for Team Foundation Server

  1. Log on to the data-tier, and delete the SQL Server login object for the service account for Team Foundation Server.

  2. Log on to the application-tier server, and update the service account.

For more information, see How to: Update the Security Identifier (SID) of the Service Account for Team Foundation Server.

Update the Security Identifiers (SIDs) for Accounts Used to Create Projects

Whenever you reinstall Team Foundation Server, you must update the SIDs for user accounts that were used to create projects. In these instances, the SIDs for users who created projects change, but the changes cannot be propagated to the restored data.

To update the SIDs for accounts that were used to create projects

  1. Log on to the server that hosts SharePoint Products and Technologies.

  2. Remove and then re-add the accounts that were used to create team projects.

    For more information, see How to: Update the Security Identifiers (SIDs) for Accounts That Were Used to Create Projects.

Refresh the Data Cache on Client Computers

To refresh the data cache on client computers

Restart Services that Team Foundation Server Uses

After you restore the data, you can restart the services unless you are restoring to a different server from the original data-tier server.

Important noteImportant Note:

Do not restart the services now if you are restoring data to a different server. You must perform additional steps before you restart the data-tier server. For more information about these steps, see How to: Restore Data for Team Foundation Server to a Different Server.

To restart services that Team Foundation Server uses

  • Log on to the appropriate server, open Computer Manager, and start the following components in the order specified:

    Log on to the server that hosts this program

    Start this component

    Reporting Services

    • SQL Server Reporting Services (TFSINSTANCE)

    • ReportServer or ReportServer$InstanceName (application pool)

    Application-tier server

    • Visual Studio Team Foundation Server Task Scheduler Service

    • Microsoft Team Foundation Server Application Pool

    SharePoint Products and Technologies

    • SharePoint Timer Service or Windows SharePoint Services Timer

    • The relevant applications pools for SharePoint Products and Technologies. Depending on the version and edition of SharePoint Products and Technologies that you installed and how you configured it, you might need to start the following pools:

      • DefaultAppPool

      • SharePoint Central Administration v3

      • SharePoint - 80

      • TFSWSS

      • TFSWSSADMIN

    Note

    If you stopped IIS by using the IISReset command with its /stop parameter, you should restart it by using the IISReset command with its /start parameter. For example, type iisreset /start.

See Also

Tasks

How to: Back Up Team Foundation Server

How to: Restore Data for Team Foundation Server to a Different Server

How to: Rebuild the Team System Cube

How to: Delete the Version Control Cache on the Application-tier Server

How to: Update the Security Identifier (SID) of the Service Account for Team Foundation Server

How to: Update the Security Identifiers (SIDs) for Accounts That Were Used to Create Projects

How to: Refresh the Data Caches on Client Computers

Concepts

Team Foundation Server Permissions

Team Foundation Server Security Architecture

Other Resources

Managing Team Foundation Server Services and Service Accounts

Managing Data

Managing SQL Server Services

Managing Data-Tier Servers for Team Foundation Server

Managing Team Foundation Server

Change History

Date

History

Reason

June 2010

Added note about expected behavior when using the SetupWarehouse command-line tool.

Customer feedback.