发现被占用空间什么项目TFS(Find what project in TFS that is ta

2019-09-28 13:51发布

我们需要弄清楚什么项目正在让我们的数据库TFS增长失控,我们发现这个剧本 ,但它不与TFS的最新版本。

有没有人有这方面的任何更新脚本?

Answer 1:

首先,你可以运行一个SQL脚本来显示的增加tbl_Content在过去的几个月:

SELECT DATEPART(yyyy, CreationDate) AS [year]
    ,DATEPART(mm, CreationDate) AS [month]
    ,COUNT(*) AS [count]
    ,SUM(DATALENGTH(Content)) / 1048576.0 AS [Size in Mb]
    ,(SUM(DATALENGTH(Content)) / 1048576.0) / count(*) AS [Average Size]
FROM tbl_Content
GROUP BY DATEPART(yyyy, CreationDate)
    ,DATEPART(mm, CreationDate)
ORDER BY DATEPART(yyyy, CreationDate)
    ,DATEPART(mm, CreationDate)

这将体现,如果你的收集数据库有一个异常增大。 然后,你可以看一下“业主”的分布数据tbl_Content如版本控制,工作项,测试......哪方面具有最大的百分比。

详细SQL脚本:

SELECT Owner = CASE
    WHEN OwnerId = 0 THEN 'Generic'
    WHEN OwnerId = 1 THEN 'VersionControl'
    WHEN OwnerId = 2 THEN 'WorkItemTracking'
    WHEN OwnerId = 3 THEN 'TeamBuild'
    WHEN OwnerId = 4 THEN 'TeamTest'
    WHEN OwnerId = 5 THEN 'Servicing'
    WHEN OwnerId = 6 THEN 'UnitTest'
    WHEN OwnerId = 7 THEN 'WebAccess'
    WHEN OwnerId = 8 THEN 'ProcessTemplate'
    WHEN OwnerId = 9 THEN 'StrongBox'
    WHEN OwnerId = 10 THEN 'FileContainer'
    WHEN OwnerId = 11 THEN 'CodeSense'
    WHEN OwnerId = 12 THEN 'Profile'
    WHEN OwnerId = 13 THEN 'Aad'
    WHEN OwnerId = 14 THEN 'Gallery'
    WHEN OwnerId = 15 THEN 'BlobStore'
    WHEN OwnerId = 255 THEN 'PendingDeletion'
    END,
    SUM(CompressedLength) / 1024.0 / 1024.0 AS BlobSizeInMB
FROM tbl_FileReference AS r
JOIN tbl_FileMetadata AS m ON r.ResourceId = m.ResourceId
    AND r.PartitionId = m.PartitionId
WHERE r.PartitionId = 1
GROUP BY OwnerId
ORDER BY 2 DESC

(欲了解更多信息,请参阅该链接在评论规定@jessehouwing。)

为了减少tbl_Content表的大小,你可以参阅本博客: TFS tbl_Content表和数据库的增长失控

  1. 清,你不需要任何更多的一些老工作空间。
  2. 运行TF destory命令要永久删除这些不必要的源文件。
  3. 使用TFS动力工具清理测试附件和测试结果。


文章来源: Find what project in TFS that is taking up space
标签: tfs tfs2017