[TFS2010] Script para eliminar las bases de datos de Team Foundation (con cuidado che!)

image47dd1de4

Buenas,

ayer comenté como restaurar un BackUp de Team Foundation Server 2010. Sin embargo en el paso 5, debíamos eliminar todas las bases de datos relacionadas con Team Foundation, incluyendo Reporting Services y Sharepoint. Esto que puede hacerse desde SQL Server Management Studio con un par de clicks, también puede hacerse con el siguiente 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

 

Obviamente no hace ni falta que advierta que hay que utilizar este script con precaución. El mismo se puede descargar desde

http://cid-bef06dffdb192125.office.live.com/embedicon.aspx/Code%20Samples/2011%2006%2013%20DELETE%20TFS%20DBs.zip

Saludos @ Here

El Bruno

   

One thought on “[TFS2010] Script para eliminar las bases de datos de Team Foundation (con cuidado che!)

  1. Pingback: [Spanish] Visual Studio 2010 ALM y Team Foundation Server 2010, 2008 y 2005 | El Bruno

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s