none
查看文档库中的文档数量 RRS feed

答案

  • Hi 世沉,

    你可以通过下面的SQL 脚本去获得文档库的大小和文件的个数。

    --"count" and "size" of all docs in your SP2010 contend DB
    --run script against your SharePoint 2010 wss_Content..... db
    SELECT 
    COUNT(*) AS 'Count',
    (SUM(CONVERT(bigint,Size))/1024) AS 'Size in kbyte',
    ((SUM(Size)/1024)/COUNT(*)) AS 'AVG Size per Doc. in kbyte'
    from dbo.AllDocs WITH(NOLOCK)
    WHERE ID IN 
    (
    SELECT tp_DocID FROM dbo.AllUserData WITH(NOLOCK)--comment this clause out if you also want include the SP systemfiles
    )
    AND Size is NOT NULL
    AND Extension != '000'
    --"count" and "size" of all docs in your SP2010 contend DB group by fileextension
    --run script against your SharePoint 2010 wss_Content..... db
    SELECT 
    COUNT(ID) AS 'Count',
    (SUM(CONVERT(bigint,Size))/1024) AS 'Size in kbyte', --covert because of an "int" overflowrisk in a lager db
    Extension AS 'Filetype',
    ((SUM(Size)/1024)/COUNT(*)) AS 'AVG Size per Doc. in kbyte'
    from dbo.AllDocs WITH(NOLOCK)
    WHERE ID IN 
    (
    SELECT tp_DocID FROM dbo.AllUserData WITH(NOLOCK) --comment this clause out if you also want include the SP systemfiles
    )
    AND Size is NOT NULL
    AND Extension != '000'
    GROUP BY 
    Extension 
    ORDER BY 'Size in kbyte' DESC
    --------------------------------------------------------------------------------

    Thanks,

    Jack


    Jack Gao
    TechNet Community Support

    2012年12月17日 6:15
    版主