Good,
yesterday I commented as restoring a BackUp from Team Foundation Server 2010. However in step 5, we should delete all of the databases related to Team Foundation, including Sharepoint and Reporting Services. This which can be made from SQL Server Management Studio with a few clicks, can also be done with the following script:
1: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'ReportServer'
2: GO
3: USE [master]
4: GO
5: ALTER DATABASE [ReportServer] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
6: GO
7: USE [master]
8: GO
9: /****** Object: Database [ReportServer] Script Date: 06/12/2011 12:56:39 ******/
10: DROP DATABASE [ReportServer]
11: GO
12: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'ReportServerTempDB'
13: GO
14: USE [master]
15: GO
16: /****** Object: Database [ReportServerTempDB] Script Date: 06/12/2011 12:56:39 ******/
17: DROP DATABASE [ReportServerTempDB]
18: GO
19: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'TailspinToys'
20: GO
21: USE [master]
22: GO
23: /****** Object: Database [TailspinToys] Script Date: 06/12/2011 12:56:39 ******/
24: DROP DATABASE [TailspinToys]
25: GO
26: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'Tfs_ALMBook'
27: GO
28: USE [master]
29: GO
30: ALTER DATABASE [Tfs_ALMBook] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
31: GO
32: USE [master]
33: GO
34: /****** Object: Database [Tfs_ALMBook] Script Date: 06/12/2011 12:56:39 ******/
35: DROP DATABASE [Tfs_ALMBook]
36: GO
37: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'Tfs_Configuration'
38: GO
39: USE [master]
40: GO
41: ALTER DATABASE [Tfs_Configuration] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
42: GO
43: USE [master]
44: GO
45: /****** Object: Database [Tfs_Configuration] Script Date: 06/12/2011 12:56:39 ******/
46: DROP DATABASE [Tfs_Configuration]
47: GO
48: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'Tfs_DefaultCollection'
49: GO
50: USE [master]
51: GO
52: /****** Object: Database [Tfs_DefaultCollection] Script Date: 06/12/2011 12:56:39 ******/
53: DROP DATABASE [Tfs_DefaultCollection]
54: GO
55: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'Tfs_Warehouse'
56: GO
57: USE [master]
58: GO
59: /****** Object: Database [Tfs_Warehouse] Script Date: 06/12/2011 12:56:39 ******/
60: DROP DATABASE [Tfs_Warehouse]
61: GO
62: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'WSS_AdminContent'
63: GO
64: USE [master]
65: GO
66: /****** Object: Database [WSS_AdminContent] Script Date: 06/12/2011 12:56:39 ******/
67: DROP DATABASE [WSS_AdminContent]
68: GO
69: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'WSS_Config'
70: GO
71: USE [master]
72: GO
73: /****** Object: Database [WSS_Config] Script Date: 06/12/2011 12:56:39 ******/
74: DROP DATABASE [WSS_Config]
75: GO
76: EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'WSS_Content'
77: GO
78: USE [master]
79: GO
80: /****** Object: Database [WSS_Content] Script Date: 06/12/2011 12:56:39 ******/
81: DROP DATABASE [WSS_Content]
82: GO
Obviously no need nor that please note that you we have used this script with caution. It can be downloaded from
Greetings @ Here
The Bruno


Leave a comment