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

You can restore data for Team Foundation from one data-tier server to another but keep the same application-tier server. For example, you might want to move the data tier when you upgrade its server hardware. Moreover, you might need to create a data-tier server if the original server fails unexpectedly. This process differs from moving your whole deployment of Visual Studio Team System Team Foundation Server (application tier and data tier) from one set of hardware to another. For more information, see Team Foundation Server Move Types.

Required Permissions

To perform these procedures, you must be a member of the following groups:

  • Administrators group on the data-tier and application-tier servers

  • Team Foundation Administrators group

  • Windows SharePoint ServicesSiteAdministrator group

  • SQL ServerAdministrator group on the data-tier server

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 follow 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 SQL Server 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 to a different data-tier server, you must complete the procedures in the following sections in the sequence listed:

  1. Back Up Data

  2. Install and Configure SQL Server on the New Hardware

  3. Restore the Databases

  4. Redirect Web Sites for Team Projects

  5. Reconnect the Administration and Configuration Databases

  6. Redirect and Test SQL Server Reporting Services and Default Reports

  7. Redirect the Application-Tier Server to the New Data-Tier Server

  8. Rebuild the Team System Cube

  9. Delete the Version Control Cache

  10. Update Service Accounts

  11. Restart Services

  12. Refresh the Data Cache on Client Computers

Back Up Data

To restore data from the original deployment of Team Foundation Server, you must have a complete set of data backups for the SQL Server databases. If the data was encrypted, you also need the encryption key and its password.

To back up data for Team Foundation

  • For more information, see How to: Back Up Team Foundation Server and How to: Back Up the Reporting Services Encryption Key.

    Note

    If SharePoint Products and Technologies is installed on the application tier and you want to move the databases for SharePoint Products and Technologies to the data tier where you are restoring the Team Foundation databases, make sure that you back up the administrative database for SharePoint Products and Technologies (SharePoint_AdminContent_ID) along with the content and configuration databases.  

Install and Configure SQL Server on the New Hardware

To restore data for Team Foundation, you must install SQL Server on the computer to which you want to move the data for Team Foundation Server. The version of SQL Server that you install must exactly match the version on the original data-tier server, including service pack level, collation settings, and language edition. If the match is not exact, you might not be able to restore the data.

To install and prepare SQL Server for the restoration of data for Team Foundation

  1. Install SQL Server in the new environment, and make sure that it is operational.

    For more information, you can download the most recent version of the installation guide for Team Foundation from the Microsoft Web site. In that guide, you can find the topics about how to install SQL Server in a dual-server deployment. You must install the same version that you used in the original installation of Team Foundation Server.

  2. On the application-tier server, open a Command Prompt window, and change directories to %ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Tools.

    Note

    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 click Run as Administrator. For more information, see the Microsoft Web site.

  3. At the command prompt, type the following command:

    TfsDB.exe install /server:"NewSQLServerName" /property:"TFS_SERVICE_ACCOUNT=TFSServiceAccount;TFS_REPORTING_ACCOUNT=TFSReportingServiceAccount;LCID=LCIDNumber;VSTF_AS_INSTANCE=AnalysisServicesServerName;VSTF_AS_DATABASE=TeamFoundationDataWarehouseName;VSTF_AS_ACCOUNT="

    • NewSQLServerName is the name of the server where you just installed SQL Server and where you intend to restore the data. If you used a named instance, you must include not only the server name but also the instance name.

    • TFSServiceAccount is the service account for Team Foundation Server in Domain\Account or Computer\Account format. If you are using a system account, you must specify that account using the System\Account format. For example, if you want to use Network Service, you would specify it as NT Authority\Network Service.

    • TFSReportingServiceAccount is the data sources account for Reporting Services in Domain\Account or Computer\Account format.

    • LCIDNumber is the language collation ID number for your language edition of SQL Server. For example, the LCID for English is 1033.

    • AnalysisServicesServerName is the name of the server on which SQL Server Analysis Services is installed. By default, Analysis Services is installed on the same server that you specify for NewSQLServerName.

    • TeamFoundationDataWarehouseName is the name of the original data warehouse for Team Foundation. By default, this value is TfsWarehouse.

  4. Log on to the appropriate server, open Computer Manager, and stop the components in the following table 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

    Application tier

    • Visual Studio Team Foundation Server Task Scheduler Service

    • Microsoft Team Foundation Server Application Pool

    Reporting Services

    • SQL Server Reporting Services (TFSINSTANCE) (service)

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

    Important noteImportant Note:

    To move user accounts and service accounts in a restoration-based move, the new deployment must be in a stopped state. If you restart Team Foundation Server after you restore data but before you move user accounts and service accounts, you could cause users who are targeted for migration to be marked as deleted in the TFSIntegration database. This problem occurs when the group security service cannot find the users' SIDs during synchronization with Active Directory. 

Restore the Databases

After you stop the services, you can restore the data for Team Foundation by using the restore tools that are provided with SQL Server. For more information, see "Implementing Restore Scenarios for SQL Server Databases" for either SQL Server 2005 or SQL Server 2008 on the Microsoft Web site.

Warning

You must restore all the databases to the same point in time. Otherwise, the databases might become corrupted.

To open the Restore Database dialog box

  1. On the data-tier server, click Start, point to All Programs, point to Microsoft SQL Server, and then click SQL Server Management Studio.

  2. In the Server type list, click Database Engine.

  3. In the Server name list, click or type the appropriate server.

  4. In the Authentication list, click the appropriate scheme.

  5. In User name, type the user name of a valid account.

  6. In Password, type the password of the account if SQL Server requires it, and then click Connect.

  7. Expand the Databases node to show the list of databases that the data tier for Team Foundation comprises.

Complete the next procedure "To restore each database" for each database in the following list:

  • ReportServer

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

  • ReportServerTempDB

    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)

    Important noteImportant Note:

    You should restore this database only if SharePoint Products and Technologies was installed on the application-tier server and you are not changing its location. You should not restore this database to the new data tier if you are using a new installation of SharePoint Products and Technologies on a different computer or if SharePoint Products and Technologies was installed on a separate server from the application tier. 

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

    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, if SharePoint Products and Technologies is installed on a separate server from Team Foundation Server, these databases might not reside on the data-tier server. If they 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.

  • The administration database for SharePoint Products and Technologies (SharePoint_AdminContent_ID)

    Important noteImportant Note:

    You should restore this database only if SharePoint Products and Technologies was installed on the application-tier server and you are not changing its location. You should not restore this database to the new data tier if you are using a new installation of SharePoint Products and Technologies on a different computer or if SharePoint Products and Technologies was installed on a separate server from the application tier. 

  • TfsBuild

  • TfsIntegration

  • TfsVersionControl

  • TfsWarehouse

  • TfsWorkItemTracking

  • TfsWorkItemTrackingAttachments

  • TfsActivityLogging (optional)

Note

As part of the restore process, you must upload any new custom site templates or Web parts created for custom process templates to databases for SharePoint Products and Technologies.

To restore each database

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

    Important noteImportant Note:

    In most deployments, neither the SQL Server databases nor the SharePoint Products and Technologies databases will appear in the list of databases under the Databases node. To restore any databases that do not already appear, you right-click the Databases node, click Restore Databases, and specify any databases that do not appear.

  2. The Restore Database dialog box opens.

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

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

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

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

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

    This step is important if you are restoring the database to a different drive.

  8. Under Recovery state, click the appropriate state.

  9. Perform one of the following steps:

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

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

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

Redirect Web Sites for Team Projects

You must redirect any Web sites for team projects to the content database on the new data-tier server for Team Foundation. If you are moving all SharePoint Products and Technologies databases, you can skip this procedure and proceed to the "Reconnect the Administration and Configuration Databases" procedure later in this topic.

To redirect project sites to use the content database on the new data-tier server

Reconnect the Administration and Configuration Databases

You must perform the following procedure if your original data-tier server also hosted the databases for SharePoint Products and Technologies in your deployment of Team Foundation Server and you want to restore those databases to the new server. However, you should not perform this procedure if SharePoint Products and Technologies was installed on a separate server or if you want the original data tier to continue to act as the data tier for SharePoint Products and Technologies.

To reconnect administration and configuration databases for SharePoint Products and Technologies

  1. Log on to the server that hosts SharePoint Products and Technologies, open a Command Prompt window, and change directories to %PROGRAMFILES%\common files\microsoft shared\web server extensions\12\bin

  2. Type the following command:

    stsadm –o renameserver –oldservername OriginalDataTierServerName -newservername NewDataTierServerName

    For more information about how to restore SharePoint Products and Technologies in general and Microsoft Office SharePoint Server 2007 specifically, see the following page on the Microsoft Web site: White paper: Backing up, restoring, high availability, and disaster recovery for Office SharePoint Server farms.

Redirect and Test SQL Server Reporting Services and Default Reports

After you redirect SharePoint Products and Technologies to the new content databases, you must redirect Reporting Services to use the new databases. Unless you perform this procedure, no default and custom reports will be available for any team project.

To redirect Reporting Services to connect to the new data-tier server

Redirect the Application-Tier Server to the New Data-Tier Server

After you redirect Reporting Services, you must use the TfsAdminUtil command to redirect the application-tier server to the new data-tier server.

To redirect the application-tier server to the new server resources

  1. Log on to the appropriate server, open Computer Manager, and start the application pools and programs in the following table:

    Log on to the server that hosts this program

    Start this component

    Application tier

    • Microsoft Team Foundation Server Application Pool

    • Default Web Site or Team Web site

    Reporting Services

    • ReportServer or ReportServer$InstanceName (application pool)

      NoteNote:
      You manage ReportServer as an application pool in IIS for SQL Server 2005 but not for SQL Server 2008.
    • SQL Server Reporting Services (TFSINSTANCE)

    • Default Web Site or Report Manager Web site

  2. Open the Command Prompt window, change directories to %ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Tools, and type the following command:

    TfsAdminUtil RenameDT newTeamFoundationDataTierServerName

    Important noteImportant Note:

    For the RenameDT command to succeed, the application pools and programs in the previous step must be running. This requirement is new in Visual Studio Team System 2008 Team Foundation Server. Also, the connection string in the services Web.config file must refer to the name of the old data tier server. If the string refers to the new server, the command will fail. You must restore the name of the original server for the command to run correctly.

Rebuild the Team System Cube

After you redirect the application-tier server to use the new data-tier server, you must rebuild the Team System cube. The Team System cube supports SQL Server Reporting Services and contains data from the relational database of the data warehouse for Team System. For more information, see Understanding the Data Warehouse Architecture.

To rebuild the Team System cube

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. On the application-tier server, open the following directory:

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

  2. Delete the contents of the Data directory but not the directory 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 Service Accounts

You must update any system accounts such as Network Service that you are using for the service accounts in your deployment. You can use the same system accounts, but you must update the information so that the correct SID is associated on the new data-tier server.

Note

The account names that you create for the new deployment must match the names of the accounts from the original deployment.

To update service accounts

  1. On the server that is running Reporting Services, open Computer Manager, 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 new application-tier server, open a Command Prompt window, and change directories to %ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Tools.

  3. At the command prompt, type the following command:

    TfsAdminUtil ChangeAccount OldDomainOrOldComputerName\OldTFSServiceAccount NewDomainOrNewComputerName\NewTFSServiceAccount NewPassword

    Note

    Ignore any warning that says that the service account does not exist or that asserts that the account is not a member of the data warehouse role.

  4. At the command prompt, type the following command:

    TfsAdminUtil ChangeAccount/ra OldDomainOrOldComputerName\OldTFSReportingServiceAccount NewDomainOrNewComputerName\NewTFSReportingServiceAccount NewPassword

    Note

    Ignore any warning that says that the service account is not a member of the data warehouse role or that prompts you to add the account to the service accounts group.

Restart Services

To restart services

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

    Log on to the server that hosts this program

    Start this component

    SharePoint Products and Technologies

    • SharePoint Timer Service or Windows SharePoint Services Timer

    Application tier

    • Visual Studio Team Foundation Server Task Scheduler Service

    • Microsoft Team Foundation Server Application Pool

Refresh the Data Cache on Client Computers

To refresh the data cache on client computers

See Also

Tasks

How to: Back Up Team Foundation Server

How to: Move Your Deployment of Team Foundation Server from One Hardware Configuration to Another

Other Resources

Managing Data

Managing Data-Tier Servers for Team Foundation Server

Managing Team Foundation Server

Change History

Date

History

Reason

June 2010

Corrected syntax for stsadm command and added link to more information about how to restoreMicrosoft Office SharePoint Server 2007.

Customer feedback.