Team Foundation Server 2005 & Windows Sharepoint Service 3.0: How to failover to a Mirrored Data-Tier Server

NOTE- PLEASE GO THROUGH THE COMPLETE ARTICLE FIRST before you start working on it

This post discusses the steps required to be performed when you failover to a mirrored data-tier server.

This post is specific to TFS 2005 that has been configured to work with Windows Sharepoint Services 3.0

Please use the following instructions to configure TFS 2005 with WSS 3.0:

https://msdn.microsoft.com/en-us/vsts2008/bb676233.aspx

 

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

Stop the Report Server

- To stop the Report Server, click Server Status, and then click Stop.

To stop and configure the Web Sites

1. On the Team Foundation application-tier server, click Start, click Administrative Tools, and then click Internet Information Services (IIS) Manager.

2. Expand the computer node, expand the Web Sites node, select the Default Web Site, and then click Stop.

3. On the Team Foundation application-tier server, click Start, click Administrative Tools, and then click Windows SharePoint Central Administration.

4. Click Application Management, click Content databases, click the name of the content database, select Remove content database, and then click OK.

To stop the remaining services used by Team Foundation Server

1. On the Team Foundation application-tier server, click Start, click Administrative Tools, and then click Services.

2. In Services Manager, locate the following services, right-click the service, and then click Stop:

  • SharePoint Timer Service
  • TfsServerScheduler Service

Note

To open Services Manager, click Start, click Administrative Tools, and then click Services.

3. On the Team Foundation application-tier server, click Start, click Administrative Tools, and then click Internet Information Services (IIS) Manager.

4. Expand the Application Pools node, locate and right-click the application pools, and then click Stop for the following application pools:

  • ReportServer
  • TFS AppPool

Add Service Accounts to the Mirroring Team Foundation Data-Tier Server

After stopping the services, you must add the Team Foundation service account and the SQL Server Reporting Services service account to the mirroring Team Foundation data-tier server.

To add the service accounts to the mirroring Team Foundation data-tier server

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

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. In SQL Server Management Studio, click File, click New, and then click Query with Current Connection.

A new query window opens.

4. In the new query, type the following, where domain is the name of the domain to which your service accounts belong, TFSService is the name of the Team Foundation service account, and TFSReports is the name of the SQL Server Reporting Services service account:

CREATE LOGIN [ domain / TFSService ] FROM WINDOWS;

CREATE LOGIN [ domain / TFSReports ] FROM WINDOWS;

GO

5. On the SQL Server Management Studio toolbar, click Execute. Verify that the command executed correctly, and then close SQL Server Management Studio.

Note

If either the TFSService service account, the TFSReports service account, or both service accounts already exist on the mirroring Team Foundation data-tier server, you will see an error that indicates that these accounts already exist. You can safely ignore this error message and continue with the next procedure.

Manually Swap the Roles of the Principal and Mirroring Databases

After you have added the TFSService and TFSReports service accounts to the mirroring Team Foundation data-tier server, you can manually fail over the Team Foundation databases so that the principal Team Foundation data-tier server becomes the mirroring server, and the mirroring Team Foundation data-tier server becomes the principal Team Foundation data-tier server. For more information about manually failing over databases in SQL Server Management Studio, see the Microsoft Web site (https://go.microsoft.com/fwlink/?LinkId=76086).

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

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

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.

Complete the "To fail over each database" procedure for the following databases:

  • ReportServer
  • ReportServerTempDB
  • WSS_Config
  • WSS_Content
  • WSS_AdminContent
  • TfsBuild
  • TfsIntegration
  • TfsVersionControl
  • TfsWarehouse
  • TfsWorkItemTracking
  • TfsWorkItemTrackingAttachments
  • TfsActivityLogging

To fail over each database

1. Right-click the database that you want to fail over, and then click Properties.

2. On the Database Properties page, in Select a page, click Mirroring.

3. Click Failover.

Note

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

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

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

Build the Data Warehouse

After swapping the databases and mapping app tier to new principal data tier, you must build the data warehouse.

To build the data warehouse

1. Start TFS Application Pool if stopped.

2. On the Team Foundation application-tier server, click Start, click All Programs, click Accessories, and then click Command Prompt - The Command Prompt window opens.

3. Open the Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Tools folder using the command line. For example:

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

4. Open a Command Prompt window and build the data warehouse by typing the following command, where newDataTierServerName is the name of the mirrored Team Foundation data-tier server that you have failed over to, TFSReportServiceAccount is the name of the reporting services service account, and TFSServiceAccount is the name of the Team Foundation Server service account:

setupwarehouse -o -s newDataTierServerName -d TfsWarehouse -c warehouseschema.xml -ra TFSReportAccount -a TFSServiceAccount –v –mturl https://tfsappserver:8080

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

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

7. Expand the Databases node to see the list of databases that make up the Team Foundation Server data tier.

8. Right-click the TFSWarehouse and then click Process.

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

10. Configure Reporting Service Configuration

a. Click Connect

b. Go to Database Setup, give the new Server name (the mirrored server) & click Connect & OK. You will see one error/warning at the last in the result list

c. Restore the Encryption Key from backup

d. Go to Database Setup, give the new Server name (the mirrored server) & click Connect & OK to make sure every result is green.

e. Check Event Viewer ->Application Logs to verify that RS initialized without errors.

11. On the Team Foundation application-tier server, open Internet Explorer and in the address bar, type https:// applicationTierServerName /reports.

12. On the SQL Server Reporting Services home page, click TfsOlapReportDS.

a. Verify that the correct connection information appears in Connection String.

The string should include the name of the mirrored Team Foundation data-tier server that you have failed over to, and the initial catalog should be TfsWarehouse.

Data source= newDataTierServerName ;initial catalog=TfsWarehouse

b. Select Credential stored securely in the report server.

c. Enter the domain, account name, and password for the Reporting Services service account specified for Reporting Services.

d. Select Use as windows credentials when connecting to the data source.

13. On the SQL Server Reporting Services home page, click TfsReportDS.

a. Make sure Connection String contains the mirrored Team Foundation data-tier server that you have failed over to.

Data source= newDataTierServerName ;initial catalog=TfsWarehouse

b. Select Credential stored securely in the report server.

c. Enter domain, account name, and password for the TFSREPORTS service.

d. Select Use as windows credentials when connecting to the data source.

To redirect the Team Foundation application-tier server and restart services

1. On the Team Foundation application-tier server, click Start, click All Programs, click Accessories, and then click Command Prompt.

The Command Prompt window opens.

2. Open the Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Tools folder using the command line. For example:

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

3. Run the TFSAdminUtil tool with the RenameDT option to connect to the Team Foundation data-tier server that is now acting as the principal server (the server that was the mirroring server). For example:

TFSAdminUtil RenameDT MirrorDataTierServer

In this example, MirrorDataTierServer represkents the name of the Team Foundation data-tier server to which you want to connect.

If failed, then manually replace MirrorDataTierserver with OldDataTierServer in “C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\web.config” file.

Also, manually change the value to new principal DB name in database table in TfsIntegration DB

4. Click Start, click Administrative Tools, and then click Internet Information Services (IIS) Manager.

5. In the Explorer pane, right-click the name of the application-tier server, click All Tasks, and then click Restart IIS.

6. In Stop/Start/Reset, verify that you are restarting services on the correct server, and then click OK. Wait for the services to stop and restart, and then close IIS Manager.

SharePoint Configuration

1. On the Team Foundation application-tier server, click Start, click Programs, click Administrative Tools, and then click SharePoint Central Administration.

2. Select Set configuration database server, type the name of the mirrored Team Foundation data-tier server that you have failed over toin the Database server field, select the Connect to existing configuration database, and then click OK.

3. Select Set default content database server, type the name of the mirrored Team Foundation data-tier server that you have failed over to, and then click OK.

4. On the Team Foundation application-tier server, click Start, click Administrative Tools, click Services, select SharePoint Timer Service, and then click Start.

5. Open the command line interface and run following command.

· C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm.exe -o renameserver -oldservername XXXX -newservername XXXX

6. Restart IIS by running “iisreset” at the command line interface

7. You would have to add the WSS_Content DB as the content database of the defualt web site.

a. Click Start, click Administrative Tools, and then click SharePoint Central Administration.

b. On the Central Administration page, click Application Management.

c. On the Application Management tab, click Content databases.

d. On the Manage Content Databases page, click Add a content database.

e. On the Add Content Database page, in Database Information, click Specify database server settings and in Database name, type WSS_Content.

f. In Database Capacity Settings, in Number of sites before a warning event is generated, type 9000, and in Maximum number of sites that can be created in this database, type 15000, then click OK.

8. Open Internet Explorer and type the server name as the address to verify that the SharePoint portal site appears. Ex) https://tfsappserver/sites/ProjectName

9. Start TFS Application Pool in IIS

10. Go to ClientService Web service as follows.

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

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

12. Clear TF Client Cache before open TF Client

Delete all directories in “C:\Documents and Settings\tcs_tfssetup\Local Settings\Application Data\Microsoft\Team Foundation\2.0”