How to: Fail Over to a Mirrored Data-Tier Server

If you have configured SQL Server mirroring for the Team Foundation databases, you can manually swap the roles of the principal and mirrored data-tier servers before you take the principal server offline. This strategy can help minimize disruption in your deployment of Team Foundation Server. For more information, see Mirroring the Team Foundation Data-Tier Server.

Note

You should follow the procedures in this topic only if the principal server is available. If the principal server is unavailable, you should follow the procedures in How to: Fail Over to a Mirrored Data-Tier Server if the Principal Server is Unavailable.

The procedures in this topic refer to the data-tier and application-tier servers as in a dual-server deployment of Team Foundation Server. If you have a single-server deployment, you perform all procedures on the server that is running Team Foundation Server. For more information about single-server and dual-server deployments, see Team Foundation Server Security Architecture.

To fail over to a mirrored data-tier server, you must perform the following procedures:

  1. Stop Services that Team Foundation Server Uses

  2. Manually Swap the Roles of the Principal and Mirroring Databases

  3. Redirect Reporting Services to Connect to the Mirrored Data-tier Server

  4. Map the Application-Tier Server to the New Principal Data-Tier Server

  5. Rebuild the Team System Cube

  6. Delete the Version Control Cache

  7. Redirect Web Sites for Team Projects

  8. Restart Services

Required Permissions

To perform these procedures, you must be a member of the Administrators group and a member of the SQL Server Administrator group on the principal and mirroring data-tier servers. 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.

Stop Services that Team Foundation Server Uses

Before you fail over the data-tier server, you must stop the services from using the principal server, and you must prepare the application-tier server to use the mirroring server.

Note

In a single-server deployment, you log on to the server that is running Team Foundation Server to stop and start all services, application pools, and Web sites. In a dual-server deployment, you must log on to the appropriate server that hosts the specific service, application pool, or Web site for Team Foundation Server. For more information about starting and stopping these components, see How to: Stop and Start Services, Application Pools, and Web Sites.

To stop services that Team Foundation Server uses

  • Log on to the appropriate server, open Computer Manager, and stop the services and application pools in the following table:

    Log on to the server that hosts this program

    Stop this component

    SharePoint Products and Technologies

    • Default Web Site or Team Web site

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

    • ReportServer or ReportServer$InstanceName (application pool)

      NoteNote:
      You stop ReportServer in Internet Information Services (IIS) for SQL Server 2005 but not for SQL Server 2008.
    • Default Web Site or Report Manager Web site

Manually Swap the Roles of the Principal and Mirroring Databases

When you fail over the databases, the principal server becomes the mirroring server, and the mirroring server becomes the principal server. For more information, see "How to: Manually Fail Over a Database Mirroring Session (SQL Server Management Studio)" for SQL Server 2005 or SQL Server 2008 on the Microsoft Web site.

To open SQL Server Management Studio on the principal data-tier server

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

    The Connect to Server dialog box appears.

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

  3. In Server name, click or type the name and instance of the server to which you want to connect.

  4. In the Authentication list, click the scheme that is appropriate for your server.

  5. In User name and Password, type the name of a valid account and the password for the account, if SQL Server requires it, and then click Connect.

    SQL Server Management Studio opens.

  6. Expand the Databases node to show the list of databases that make up the data tier.

Fail over each database in the following list:

  • 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 following databases for SharePoint Products and Technologies databases, if the deployment uses the same data-tier server for SharePoint Products and Technologies as for Team Foundation Server:

    • The administration content database for SharePoint Products and Technologies (WSS_AdminContent)

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

  • TfsActivityLogging

  • TfsBuild

  • TfsIntegration

  • TfsVersionControl

  • TfsWarehouse

  • TfsWorkItemTracking

  • TfsWorkItemTrackingAttachments

To fail over each database

  1. In SQL Server Management Studio, right-click the database that you want to fail over, and then click Properties.

    The Database Properties page opens.

  2. In the Select a page pane, click Mirroring, and then click Failover.

    Note

    If the Failover button is unavailable, the database is not configured for mirroring. For more information, see How to: Configure SQL Server Mirroring for the Team Foundation Data-Tier Server.

Redirect Reporting Services to Connect to the New Principal Data-tier Server

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

Map the Application-Tier Server to the New Principal Data-Tier Server

After you fail over all the databases, the mirroring data-tier server becomes the principal data-tier server for the deployment. To complete the failover, you must redirect the application-tier server to the principal server.

To redirect the application-tier server to the new principal data-tier server

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

    Application-tier server

    • Microsoft Team Foundation Server Application Pool

    Reporting Services

    • ReportServer or ReportServer$InstanceName (application pool)

      NoteNote:
      You start the Report Server application pool in IIS if you are running SQL Server 2005 but not if you are running SQL Server 2008.
    • SQL Server Reporting Services (TFSINSTANCE)

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

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

  4. Type iisreset to restart IIS, and press ENTER.

Rebuild the Team System Cube

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

Redirect Web Sites for Team Projects

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

Restart Services

To restart services that Team Foundation Server uses

  1. Log on to the appropriate server, open Computer Manager, and start the services 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

    • Default Web Site or Team Web site

    Application-tier server

    • 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 start the Report Server application pool in Internet Information Services (IIS) if you are running SQL Server 2005 but not if you are running SQL Server 2008.
    • Default Web Site or Report Manager Web site

  2. Open Internet Explorer, type the following string in the Address bar, and verify that the team project portal is available:

    http://SharePointServicesServerName/default.aspx

See Also

Tasks

How to: Stop and Start Services, Application Pools, and Web Sites

How to: Configure SQL Server Mirroring for the Team Foundation Data-Tier Server

Concepts

Team Foundation Server Permissions

Other Resources

Mirroring the Team Foundation Data-Tier Server