How to: Restore Team Foundation Server Data

This topic describes how to restore the data part of a Team Foundation Server data-tier server. For example, you might want to restore a working data-tier server from a corrupted state back to the last known good state. This procedure assumes that the server itself is working correctly. If you must restore the data to another data-tier server, see How to: Restore Team Foundation Server Data to a Different Server.

Note

You might assume that you must restore both databases and the Web sites for the team project portal pages. However, Windows SharePoint Services dynamically generates the Web sites from the databases. So when you restore the databases, the parts of the team project that you see as Web sites are restored at the same time.

Note

This topic directs you to perform actions on the Team Foundation application-tier and data-tier servers. In dual-server deployments, these are different physical computers than the Team Foundation data-tier server. In single-server deployments, both the logical application-tier and the logical data-tier are located on the same physical computer.

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

  • Stop the services on the Team Foundation application-tier server.

  • Restore the Team Foundation databases.

  • Build the data warehouse.

  • Restart the servers.

  • Force clients to update their cache.

The Team Foundation data- tier server includes a set of SQL Server databases some of which serve the data-driven team project portal sites. The following table lists the Team Foundation Server databases:

Database Description

ReportServer

The Reporting Services database contains the reports and report settings for Reporting Services.

ReportServerTempDB

The Reporting Services temporary database is used for temporarily storing information that is used for running specific reports for Reporting Services.

STS_Config_TFS

The Windows SharePoint configuration database contains the Team Foundation Server setup and configuration information for the team project Windows SharePoint site.

Warning

Do not restore this database if the Team Foundation data-tier server is connecting to a different Team Foundation application-tier server than the application tier being used at the time of the back up. For example, if you are performing a restoration move to new hardware, the identifier for the Team Foundation application-tier server changes and no longer matches the identifier used in the backup. Therefore, the version of the database on the new installation of Windows SharePoint Services is the appropriate and current version required for successful connections between the restored Team Foundation application-tier server and the Team Foundation data-tier server.

STS_Content_TFS

The SharePoint content database contains the actual content in the team's SharePoint site.

TfsBuild

The build database contains build data (Team Foundation Build) and published test results.

TfsIntegration

The registration database contains information about Projects, Areas, Iterations, and other registration data. This registration database also contains permissions and group membership data.

TfsVersionControl

The Team Foundation source control database.

TFSWarehouse

The Analysis Services database that contains the data for building the warehouse used by the Reporting Services.

TfsWorkItemTracking

The Team Foundation work item tracking database.

TfsWorkItemTrackingAttachments

The Team Foundation work item tracking attachments database.

TfsActivityLogging

The history database contains a log of all Team Foundation Server Web service requests that occurred within the last seven (7) days.

Note

This database is not required for Team Foundation Server operation and back up is optional.

The following procedures assume that you have a working data-tier server and have a back up available. For more information, see How to: Back Up a Team Foundation Server.

Note

If the system is deployed on dual servers, make sure that you are logged on to the appropriate server for each step. All data related steps must be done on the Team Foundation data-tier server. All services related steps, such as starting and stopping IIS, must be performed on the Team Foundation application-tier server. The Reporting Services are included on the Team Foundation application-tier server. For single server deployments, both the Team Foundation application-tier server and the Team Foundation data-tier server are on the same server, so you do not have to log on separately for each tier.

Procedures

To stop the services on the Team Foundation application-tier server

  1. On the Team Foundation application-tier server, open the Reporting Services Configuration tool, click Server status, and then click Stop.

  2. On the Team Foundation application-tier server, click Start, click Programs, click Administrative Tools, and then click Services. In the Explorer pane, right-click the SQL Server Reporting Services service, and then click Stop for each of the following services:

    • SharePoint Timer

    • TFSServerScheduler

  3. On the Team Foundation application-tier server, click Start, click Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager. In the Explorer pane, expand Application Pools, right-click each of the following groups of application pools, and then click Stop:

    • ReportServer

    • StsAdminAppPool

    • TFS AppPool

    • TFSWSS

    • TFSWSSADMIN

      Note

      If you do not have other services that you want to continue to run, you can stop Internet Information Services (IIS) by opening a Command Prompt window and using the /stop command of the IISReset command-line tool. For example, use this command, iisreset /stop.

Restoring Data

After stopping the services, you can restore the Team Foundation Server data using the restore tools provided with SQL Server 2005.

Warning

You must restore all databases using a backup from the same point in time, or the databases will be corrupted.

To open the Restore Database dialog box

  1. On the Team Foundation data-tier server, click Start, click All Programs, click 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.

  2. Select Database Engine for the Server type. Select the appropriate Server name and Authentication scheme for the server. Provide a valid User name and Password if it is required by your SQL Server, and then click Connect.

  3. Expand the Databases node to show the list of databases that make up the Team Foundation data-tier server.

Complete the "To restore a database" procedure for each of the following databases:

  • ReportServer

  • ReportServerTempDB

  • STS_Config_TFS

  • STS_Content_TFS

  • TfsBuild

  • TfsIntegration

  • TfsVersionControl

  • TfsWarehouse

  • TfsWorkItemTracking

  • TfsWorkItemTrackingAttachments

  • TfsActivityLogging (optional)

To restore a database

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

  2. In the Restore Database dialog box, select From Device in the Source for restore area, and then click the ellipsis button ().

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

    The first backup you apply must be a full backup, followed by the transaction log backups, in the order they were created.

  4. In the Select the backup sets to restore area, select the backup sets to restore.

  5. From the left navigation pane, select Options, select the Overwrite the existing database box.

  6. Verify that the paths specified in the Restore the database files as area match your current database paths. This is important if you are restoring the database to a different drive.

  7. Select the appropriate state from the Recovery state area.

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

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

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

  10. If you are applying additional transaction logs, follow this procedure for each log backup, in the order they were created, starting from the one made after the full backup. For more information, see Applying Transaction Log Backups.

Build the Data Warehouse

After restoring the databases, you have to build the data warehouse. The data warehouse is a data cube populated by the Analysis Services from the underlying TfsWarehouse database. The data warehouse serves the Reporting Services.

To build the data warehouse

  1. On the Team Foundation application-tier server, open the Command Prompt window and locate the Team Foundation Tools directory.

    For example, you can use the following command to locate the default directory for the tools.

    cd Microsoft Visual Studio 2005 Team Foundation Server\Tools

  2. From the Command Prompt window, build the data warehouse by typing the following commands.

    setupwarehouse -o -s DataTierServerName -d TfsWarehouse -c warehouseschema.xml -ra TFSReportAccount -a TFSServiceAccount

  3. On the Team Foundation data-tier server, click Start, click All Programs, click Microsoft SQL Server, and then click SQL Server Management Studio.

  4. Select Analysis Server for the Server type. Select the appropriate Server name and Authentication scheme for the server. Provide a valid User name and Password if it is required by your SQL Server, and then click Connect.

  5. Expand the Databases node to see the list of databases that make up the Team Foundation data-tier server.

  6. Right-click the TFSWarehouse, and then click Process.

  7. In the Process Database dialog box, click OK to process the warehouse.

    Note

    If you have additional data backed up that must be restored, follow the steps appropriate for restoring that data. For example, you may have other SQL databases or Windows SharePoint sites to restore.

Restarting the Servers

After the data is restored, you can restart the services unless you are restoring to a different server than the original.

Warning

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

To restart the servers

  1. On the Team Foundation application-tier server, click Start, click Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager. In the Explorer pane, expand Application Pools, right-click each of the following groups of application pools, and then click Start:

    • ReportServer

    • StsAdminAppPool

    • TFS AppPool

    • TFSWSS

    • TFSWSSADMIN

      Note

      If you stopped Internet Information Services (IIS) by opening a Command Prompt window and using the /stop command of the IISReset command-line tool, you should restart IIS by using the /start command of the IISReset command-line tool. For example, use this command, iisreset /start.

  2. On the Team Foundation application-tier server, restart the reporting services. Click Start, click Programs, click Microsoft SQL Server 2005, click Configuration Tools, and then click Reporting Services Configuration. The Reporting Services Configuration tool opens. In the configuration tool, click Server Status, and then click Start.

  3. On the Team Foundation application-tier server, click Start, click Programs, click Administrative Tools, and then click Services. In the Explorer pane, right-click the SQL Server Reporting Services service, and then click Start for each of the following services:

    • TFSServerScheduler

    • SharePoint Timer

Update the System ID (SID) for the Team Foundation Server Service Account

If you are restoring data to a Team Foundation Server after the computer has been reformatted and Team Foundation Server has been reinstalled, the SID for the service account must be updated using the TFSAdminUtil command-line utility. When you reformat the computer and reinstall Team Foundation Server, the SID for the service account changes but the change cannot be propagated to the restored Team Foundation Server data. To update the data with the new SID for the service account, you must delete the SQL Server login object for that account and then use the TFSAdminUtil command-line utility.

Note

If you did not reformat the computer and reinstall Team Foundation Server, you do not need to perform the procedure.

To update the SID for the Team Foundation Server service account

  1. Click Start, click All Programs, click Microsoft SQL Server, and then click SQL Server Management Studio.

  2. In the Object Explorer, click Security, and then click Logins.

  3. On the Summary page, right-click the login for the service account, and then click Delete.

  4. In the Delete Object dialog box, click OK.

  5. At the prompt, Deleting server logins does not delete the database users associated with the logins. To complete the process, delete the users in each database. It may be necessary to first transfer the ownership of schemas to new users, click OK.

  6. From the Start menu, open the Command Prompt window and change directories to the Team Foundation Tools directory. For example:

    cd drive :\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Tools

  7. In the Command Prompt window, type the following command, where OldTFSSVC is the name of the Team Foundation Server service account before you reformatted the computer, NewTFSSVC is the name of the Team Foundation Server service account you want to use, and TFSPassword is the password for the service account:

    TFSAdminUtil ChangeAccount OldTFSSVC NewTFSSVC TFSPassword

    Tip

    To avoid possible permission issues, use the same service account for the restored deployment as the one used on the previous deployment. If you want to use a different account from the previous deployment, complete this step using the old account and then complete the steps in How to: Assign a New Account to a Team Foundation Server Service.

Update the SIDs for Windows SharePoint Services

If you are restoring data to a Team Foundation Server after the computer has been reformatted and Team Foundation Server has been reinstalled, the SIDs for users that created projects change, but the changes cannot be propagated to the restored Team Foundation Server data. To update the data with the new SIDs for the user accounts, you must remove and re-add the user accounts to Windows SharePoint Services.

Note

If you did not reformat the computer and reinstall Team Foundation Server, you do not need to perform the procedure.

To update the SIDs for user accounts in Windows SharePoint Services

  1. Log on to the Team Foundation application-tier with a computer account that is a member of the Local Administrators group.

  2. On the Team Foundation application-tier, click Start, point to Administrative Tools, and then click SharePoint Central Administration.

  3. In Central Administration, click Set SharePoint Administration Group.

  4. In Set SharePoint Administration Group, type a group account name and the domain (if appropriate) of a different group than the previous SharePoint Administration Group. Click OK.

  5. In Central Administration, click Set SharePoint Administration Group.

  6. In Set SharePoint Administration Group, type a group account name and the domain (if appropriate) of the group you want for the SharePoint Administration Group. Click OK.

    Note

    You can only add one domain group or user to the SharePoint Administration group. You cannot add a local group. However, members of the Local Administrators group on the server can also perform administration tasks for Windows SharePoint Services products and technologies.

  7. In Central Administration, click Manage Web Site Users.

  8. In Manage Web Site Users, in Site URL, type the URL of one of the team project portals.

  9. In Manage Web Site Users, in Add User, add a new user account as an administrator. Be sure to include the e-mail address of this new user account.

  10. Repeat steps 8 and 9 for each team project portal.

  11. In the Explorer pane, click Windows SharePoint Services.

  12. In Central Administration, click Manage site collection owners.

  13. In Manage Site Collection Owners, in Site URL, type the URL of one of the team project portals, and then click View. The name of the site collection owner will appear in the User name field in Site Collection Owner.

  14. In Site Collection Owner, type the domain and account name of the user you added as an administrator to the team project portal, and then click OK.

  15. Repeat steps 13 and 14 for each team project portal.

  16. When you have completed updating information for the team project portals, close the browser window.

Refreshing the Data Cache on Client Computers

After restoring the data, the cache must be refreshed to use the restored data. By using the Web services on the Team Foundation application-tier server, you can force clients to re-initialize the work item tracking cache the next time that the clients connect.

To make clients update the cached data for work items

  1. On the Team Foundation application-tier server, open Internet Explorer.

  2. In the address bar, type the following address to connect to the ClientService Web service.

    https:// applicationTierServerName :8080/WorkItemTracking/v1.0/ClientService.asmx

  3. Select the StampWorkitemCache Web method and then click Invoke.

Security

To perform these procedures, you must be a member of the Administrators security group on the Team Foundation data-tier server and the Team Foundation application-tier server, a member of the Windows SharePoint Services Site Administrator security group, and a member of the SQL Server Administrator security group on the Team Foundation data-tier server.

To perform the procedures to restore the data and services, you must be a member of the Local Administrators group. Permissions to restore databases and stop and start IIS are required to perform the tasks described in this topic. To clear the client cache, you must be a member of the Team Foundation Administrators group. For more information, see Team Foundation Server Permissions.

See Also

Tasks

How to: Back Up a Team Foundation Server

Reference

SetupWarehouse

Concepts

Managing SQL Server Services

Other Resources

Managing Team Foundation Server Services and Service Accounts
Choosing the Recovery Model for a Database
Managing Data
Managing Team Foundation Server Data-Tier Servers
Managing Team Foundation Server