In some disaster recovery scenarios, you have to restore the data onto brand new hardware. However, sometimes you don't have a disaster situation where you need to use a new server. It could just be that the data has become corrupt in the database, and you want to roll back to an archived copy. In this section, you learn the steps required to restore a Team Foundation Server backup onto the original server. In a later section, you learn how to restore onto a new server.
To follow these instructions, you must have the data-tier Team Foundation Server from which the backups were taken in good working order.
There are five steps involved in restoring a Team Foundation Server from its backup. These steps should be performed in the following order:
Stop Application Tier Services:
On the application tier, open the Reporting Services Configuration Tool, as described previously, click the Server Status link; then click the Stop button. This will stop the report server.
Next, open the Services window by clicking Start⇨Control Panel⇨Administrative Tools⇨Services.
Right-click the following services and click Stop:
Finally, you need to stop Internet Information Server. To shutdown IIS, simply open a command prompt and type iisreset /stop.
Restore Team Foundation Server databases.
Recreate the Data Warehouse.
Start Application Tier Services:
To restart IIS, simply open a command prompt and type iisreset /start.
Open the Services window, right-click the following services, and click Start:
Open the Reporting Services Configuration Tool, click the Server Status Link, and click the Start button.
Flush the Client Work Item cache.
To restore the Team Foundation Server databases, you once again make use of SQL Server Management Studio. Open SQL Server Management Studio as described previously. In the Object Explorer on the left side of the screen, select the plus sign beside the Databases folder to expand it. This folder lists all the databases installed on this SQL server. You have to restore each database individually. The following is a list of the databases you need to restore:
The TfsActivityLogging database is not restored, as it is not critical to the operation of Team Foundation Server; it can be restored if desired.
To start the restore process on a database, right-click the database in SQL Server Management Studio. Select Tasks, then Restore, and then Database. This opens the Restore Database window, as shown in Figure 5-10.
In the Source to Restore section, click the From device radio button to select it. Click the ellipse button to open the Specify Backup window. Figure 5-11 shows the Specify Backup window.
Click the Add button, and select the appropriate backup file. Click OK to close this window and return to the Restore Database window. In the left pane of this window, select Options to view the different restore options. Check Overwrite the existing database. Make sure the paths in the Restore the database files section, for each file, are valid paths.
If everything looks good to you, click OK to close this window and restore the database. Remember, you have to perform this procedure on each individual database in Team Foundation Server.
Next, you recreate the data warehouse for Team Foundation Server. You do this from the application-tier machine using the setupwarehouse command-line tool. This command uses the TfsWarehouse database to recreate the Analysis Services data cube. On the application-tier machine, open a command prompt, and switch to the c:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\ Tools directory. The format for running this command is:
Setupwarehouse-o-s <DataTierServer> -d TfsWarehouse-c warehouseschema.xml-ra <ReportAccount> -a <ServiceAccount>
Where <DataTierServer> is the name of the data-tier server, <ReportAccount> is the report account you created when you installed Team Foundation Server, such as TFSREPORTS, and <ServiceAccount> is the account that runs the Team Foundation Services, such as TFSSERVICE. Figure 5-12 shows an example of running this command:
For more details on the setupwarehouse tool, type the following at a command prompt:
Finally, you need to force the client machines to refresh their work item cache.
To do this, open Internet Explorer on the application-tier server, and navigate to :8080/WorkItemTracking/v1.0/ClientService.asmx">http://<appservername>:8080/WorkItemTracking/v1.0/ClientService.asmx. This opens the Client Service Web Service page, shown in Figure 5-13.
The ClientService Web Service contains many different Web methods used by Team Foundation Server.
Click the StampWorkItemCache link to view the Web method. On the StampWorkItemCache Web method page, click the Invoke button to execute the method. A second blank Internet Explorer window may open while the method is running. Once the method is finished, close both Internet Explorer windows.
To refresh the work item cache, you must be a member of the Team Foundation Server Administrators group.
At this point, your Team Foundation Server has been restored. You should test to make sure you can connect to the application tier and the data tier from your client, and that all the data has been restored properly.