Backing Up and Restoring Team Foundation Server Data

Backing Up and Restoring Team Foundation Server Data

Rate This
  • Comments 18

Performing backups is an important component of managing your Team Foundation deployment. Implementing a well-planned backup and restore strategy protects your data against data loss due to damage caused by a variety of failures. Testing your strategy by restoring a set of backups and recovering your database prepares you to respond effectively to a disaster.

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.

Procedures

To backup and restore a Team Foundation Server deployment

  1. How to: Back Up the Reporting Services Encryption Key
  2. How to: Back Up a Team Foundation Server
  3. How to: Restore Team Foundation Server Data

How to: Back Up the Reporting Services Encryption Key

Introduction

You can use the Reporting Services Configuration tool or the RSKEYMGMT command-line tool provided by SQL Server 2005 to back up the encryption key.

Procedures

To back up the Report Server encryption key

  1. On the Team Foundation application-tier server, click Start, click All Programs, click Microsoft SQL Server, click Configuration Tools, and then click Reporting Services Configuration.
  2. Enter the data-tier computer name and database instance at the Reporting Server Installation Instance Selection dialog box.
  3. In the left navigation bar, click Encryption Keys, and then click Backup.
  4. In Encryption Key Information dialog box, type a password in the Password box for the file, and then click the Key File.
  5. In the Save As dialog box, enter the file name for storing the Report Server encryption key, click OK, and then click OK in the Encryption Key Information dialog box.

Using the RSKEYMGMT Tool

You might want to use a command-line tool instead of the Reporting Services Configuration tool.

Note   If your deployment is a dual or cluster deployment, the application tier does not support the Reporting Services Configuration tool, you must use the RSKEYMGMT tool.

To back up the Report Server encryption key using RSKEYMGMT

  1. Open the Command Prompt window and locate the RSKEYMGMT tool.
  2. By default, the tool is located in the installation directory as follows drive:\Program Files\Microsoft SQL Server\90\Tools\Binn folder.
  3. Use the -e, -f, and -p options of the RSKEYMGMT tool to create a backup file that is password protected for the encryption key.

For example, the following command line extracts the key, creates a file named MyRSKeyBackUP, and specifies a password to encrypt or decrypt the key.

RSKEYMGMT -e -f c:/mybackups/myRSkeybackup  -p StrongPassword

Note   For more information about the RSKEYMGMT tool, use the /? option. For example, you can run RSKEYMGMT /? in the Command Prompt window.

How to: Back Up a Team Foundation Server

Introduction

Use this procedure to back up Team Foundation Server data on the data tier. For the application tier back up, the Reporting Services Encryption keys on the application tier.

Caution   Although SQL Server Management Studio lets you back up individual databases at a time, restoring from such back ups can cause unexpected results because the databases are related and you risk restoring outdated versions.

Use the following table to identify Team Foundation Server databases in your organization's installation of SQL Server 2005.

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 when you run specific reports for Reporting Services.

STS_Config_TFS

The SharePoint configuration database contains a listing of all sites including content databases, site templates, custom Web parts, and other settings from SharePoint Central Administration.

STS_Content_TFS

The SharePoint content database contains the content for the team's SharePoint site.

TfsBuild

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

TfsIntegration

The registration database contains Projects, Areas, Iterations, and other registration data.

TfsVersionControl

The Team Foundation source control database.

TFSWarehouse

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

Note   The database can be backed up, however the warehouse is not backed up as the warehouse must be rebuilt from the restored TFSWarehouse database.

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.

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

This procedure explains how to create maintenance plans that perform either a full or an incremental backup. If you want to perform both types of back-ups, complete the steps two times; one time for the full backup, and one time for the incremental backup

Note   For maximum data protection, schedule the full backup differently from the incremental backups.

The following procedure assumes that you want to schedule backups by using a maintenance plan for all the Team Foundation Server databases.

Procedures

To create a maintenance plan

  1. On the data-tier server, click Start, click All Programs, click Microsoft SQL Server 2005, and then click SQL Server Management Studio.
  2. Connect to the server for the data tier by selecting Database Engine in the Server type box and then selecting the correct Server name and Authentication scheme for the server. If it is required by your SQL Server, provide a valid User name and Password, and then click Connect.
  3. In SQL Server Management Studio, expand the Management node, right-click Maintenance Plans, and then select Maintenance Plan Wizard.
  4. On the Maintenance Plan Wizard welcome page, click Next.
  5. In the Name box on the Select a Target Server page, type a name for the maintenance plan.
  • For example, you could name a full backup TfsFullDataBackup.
  • For example, you could name an incremental backup TfsIncrementalDataBackup.
  1. Select the correct Server name and Authentication scheme for your SQL Server. If it is required by your SQL Server, provide a User name and Password and then click Next.
  2. On the Select Maintenance Tasks page, select the maintenance task you want to run, and then click Next.
  • To complete a full backup, select Back Up Database (Full).
  • For an incremental backup, select Back Up Database (Transaction Log).
  1. On the Select Maintenance Task Order page, click Next.

For more information about the options on this dialog box, press F1 for help specific to the dialog box. Also, see the SQL Server 2005 Books Online and search for the Maintenance Plan Wizard.

Note   Store the backup files on another secure computer.

  1. On the Define Back Up Database Task page, click the down arrow, select All Databases, click OK, and then click Next.
  2. On the Select Plan Properties page, click Change.
  3. In the New Job Schedule dialog box, type a Name for the back up job.

For example, you could name a full backup ScheduledFullBackup as the name. Or, you could name an incremental backup ScheduledIncrementalBackup.

Note   Leave the Schedule type as Recurring and leave the Enabled check box selected.

  1. Set the desired Frequency and Daily Frequency options for your back up plan, but leave the Duration set to No end date. Click OK and then Next.

Note   Typically, the start times for full and incremental backups are staggered from each other.

  1. On the Select Report Options page, select the desired report distribution options, and then click Next.
  2. Click Finish to complete creating the maintenance plan.

SQL Server backs up the databases specified in the maintenance plan according to the frequency you specified.

How to: Restore Team Foundation Server Data

Introduction

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 Server3b92cabd-c728-47c5-b8ae-b38eb39625f8.

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.

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

  • Stop the services on the application tier.
  • Restore the Team Foundation databases.
  • Build the data warehouse.
  • Restart the servers.
  • Force clients to update their cache.

The Team Foundation Server data tier 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

The Windows SharePoint configuration database.

STS_Config_TFS

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

STS_SERVERNAME

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.

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.

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.

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 server where the data resides. All services related steps, such as starting and stopping IIS, must be performed on the application-tier server. The Reporting Services are included on the application tier. For single server deployments, both tiers are on one computer and you do not have to log on separately for each tier.

Procedures

To stop the services on the application tier

  1. On the application-tier server, open the Reporting Services Configuration tool, click Server status, and then click Stop.
  2. On the application-tier server, stop the following services by opening the Services manager, right-clicking the service name, and then clicking Stop.
  • SharePoint Timer
  • TFSServerScheduler

Note   The Services manager is available by clicking Start, clicking Administrative Tools, and then clicking Services.

  1. Stop the following application pools by opening the Internet Information Services (IIS) Manager, right-clicking the application pool, and then clicking Stop.
  • Reporting Services
  • Windows SharePoint Services
  • Team Foundation Server Services

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.

Caution   You must restore all databases to the same instant in time or the databases become corrupted.

To open the Restore Database dialog box

  1. On the data-tier server, open SQL Server Management Studio by clicking Start, clicking All Programs, clicking Microsoft SQL Server, and then clicking 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 Server data tier.

For the following databases, complete the next procedure:

  • ReportServer
  • ReportServerTempDB
  • STS_Config
  • STS_Config_TFS
  • STS_SERVERNAME
  • 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.

  1. In the Select the backup sets to restore area, select the backup sets to restore.
  2. From the left navigation pane, select Options, select the Overwrite the existing database box.
  3. 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.
  4. Select the appropriate state from the Recovery state area.
  5. If you are not applying additional transaction logs, select Leave the database ready to use.
  6. If you are applying additional transaction logs, select Leave the database non-operational.
  7. Click OK to dismiss the Restore Database dialog box and restore the database.
  8. 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.

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

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

  1. On the data tier, open SQL Server Management Studio by clicking Start, clicking All Programs, clicking Microsoft SQL Server, and then clicking SQL Server Management Studio.
  2. 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.
  3. Expand the Databases node to see the list of databases that make up the Team Foundation Server data tier.
  4. Right-click the TFSWarehouse, and then click Process.
  5. 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.

To restart the servers

  1. On the application-tier server, restart IIS by opening a Command Prompt window and running the following command.

iisreset /start

  1. On the application-tier server, restart the reporting services by opening the Reporting Services Configuration tool, click Server Status, and then click Start.
  2. On the application-tier server, start the following services by opening the Services manager, right-clicking the SQL Server Reporting Services service, and clicking Start.
  • TFSServerScheduler
  • SharePoint Timer

Note   The Services manager is available by clicking Start, clicking Administrative Tools, and then clicking Services.

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 application tier, 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.

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

  1. Select the StampWorkitemCache Web method and then click Invoke.
Leave a Comment
  • Please add 6 and 4 and type the answer here:
  • Post
  • How do these instructions relate to those posted at http://blogs.msdn.com/vstsue/articles/500334.aspx? Are the newer, and therefor should be used in place of the link listed previously. I noticed there were some steps in the article listed previously which are not in this one, which is why I was wondering.

    Also, when you are restoring to the same server, you have to do the restore of the analysis server database. Why do you not have to do that when you are restoring to a different server?
  • These articles were taken from the documentation that is released (or set to be released) so yes, it is more current.

    ...as for your secong question - we're looking into it right now.
    -Lisa
  • Mickey,
    You do need to restore the Analysis Server database on a different server. The use of "restore the Analysis Server database" is misleading. You need to restore all of the databases including tfsWarehouse and then rebuild the data warehouse (Analysis Server database) that supports the reporting features. The data warehouse (some times called the data cube) is built by using SQL Analysis Services to process the database tfsWarehouse.
    -Lisa (for Valerie)
  • These instructions deal with restoring the data-tier on the same or different data-tier server. We would very appreciate the instructions for restoring a backup of the complete single server configuration on the completely new server.
  • After restoring the user databases it is apparently important to remove the
    "%Program Files%\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\VersionControl\Data" folder otherwise it is possible to corrupt the repository

    See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=251122&SiteID=1
  • Instructions seem useful, but I also would like to have info on restoring a single server config.  Question:  can these instructions be used as a reference for renaming a single server configuration?

    Answer: Yes you can.  The references to “Team Foundation application-tier server” and “Team Foundation data-tier server” would be to the same physical computer in your case; you have both logical tiers on the same physical computer in a single-server deployment.

  • Why are you instructed not to restore X STS_Content_TFS?  Our integrity test was to delete a TFS project and then restore it, and we found it did not come back unless we restored this database as well.  All seemed to work ok, so what is the purpose of this special instruction?  
  • Gabrial adn dazim,
    Our updated docs reflect the valid concerns that two commented about. I have refreshed the content with the actual released topic information.

    Let me know if there's anything more you need.
    -Lisa
  • Is there any chance I could get hold of:

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

    This is referenced in the How to: Move your Team Foundation from One Hardware Configuration to Another. It is also reference in the document above.

    Thanks for your help.
  • Hi Graham,

    You can find that topic in the RTM documentation, online at MSDN.  Here's the specific link to that topic: http://msdn2.microsoft.com/en-us/library/ms252516(VS.80).aspx

    Hope this helps!

    -=Susan
  • How do i restore a specific team project related fromo the full backup?
  • is there a way by which i can restore only a specific team project related data or its associated files from a full backup?
  • Whilst reading about backup and restore (specifically moving ) for Team Foundation server I found this

  • Onepulse has a solution that provides the incremental backup and restore of TFS 2008 data (including SP1 support).

  • just ghost it (the machine on which TFS resides)

    & save ghost files on safe place (network drive or  spare hard disk) & when needed, restore ghost on desired machine, name it the same as original machine (ghost will do that for you :) ) & finished (quickiest solution)

    You'll have to check drivers, maybe, if new machine hardware is dramatically different from original machine hardware, but windows 2003 should do most of the job itself.

    try, test it, in our firm that's entire backup strategy (we are not perfect :) ), but it works

    100 %

Page 1 of 2 (18 items) 12