查找 TFS 中占用空间的项目 [英] Find what project in TFS that is taking up space

查看:33
本文介绍了查找 TFS 中占用空间的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要弄清楚是什么项目让我们的 TFS 数据库失控,我们找到此脚本,但它不适用于最新版本的 TFS.

We need to figure out what project is making our TFS database to grow out of hand and we found this script but it does not work with the latest version of TFS.

有没有人有任何更新的脚本?

Does anyone have any updated script for this?

推荐答案

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

First you could run a SQL script to show an increase of the tbl_Content over the last several months:

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中数据的所有者"的分布,例如VersionControl,Work Item,Test...哪个区域的百分比最大.

This will reflect if your collection database have a abnormal increase. Then you could look at look at the distribution of "owners" for the data in tbl_Content such as VersionControl, Work Item, Test... Which area has the biggest percentage.

详细 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 在评论中提供.)

(For more information, please refer the link @jessehouwing provided in the comment.)

要减小tbl_Content表的大小,可以参考这个博客:TFS tbl_Content 表和数据库增长失控

To reduce the size of the tbl_Content table, you could refer to this blog: TFS tbl_Content Table and Database growth out of control

  1. 清理一些您不再需要的旧工作区.
  2. 运行 tf destory 命令 永久删除那些不必要的源文件.
  3. 使用 TFS 强力工具清理测试附件和测试结果.
  1. Clean some old workspaces that you doesn't need any more.
  2. Run the tf destory command to delete those unnecessary source files permanently.
  3. Using TFS power tool to clean Test attachments and test results.

这篇关于查找 TFS 中占用空间的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆