对SharePoint 2007数据库中一些数据表的使用(二)
接着写1. 得到文档库的大小
dbo.Webs 记录了每个SPWeb对象的FullUrl和Guid.
dbo.Sites 记录了每个SPSite对象的GUID,可以与dbo.Webs、dbo.AllDocs对象联合起来使用。
select as , as ,dbo.Webs., (sum(Cast( as bigint)) / (1024)) as
from dbo.AllDocs, dbo.AllLists, dbo.Webs
where '' and > 0 and = and
in (101,109,111,113,114,115,116,119) and > 0 and dbo.AllDocs.=
(select dbo.Sites. from dbo.Sites, dbo.Webs
where dbo.Webs. = dbo.Sites.Id and dbo.Webs. = '')
and dbo.AllDocs. = dbo.Webs.
Group By , dbo.Webs., order by desc
注:dbo.Webs.列存储了每个SPWeb对象的url地址(例如:Teams/Test0223PM0400),当此SPWeb对象是根站点的web对象时,此处值为空字符串。
2. 得到在某段时间内更新的文档数
--declare variables
declare @start_time datetime, @end_time datetime
--set UTC DateTime
set @start_time = cast('2010-12-27 08:08:33' as datetime)
set @end_time = cast('2010-12-28 02:35:21' as datetime)
select count(*) from dbo.AllDocs
where '' and > 0 and in
(select from dbo.AllLists where = 101 and > 0)
and ( between @start_time and @end_time)
注:dbo.AllDocs表中的, , , , 以及列都使用UTC时间。
3. 得到最常使用的文档格式及数目
select , count(*) as 'AttachmentCount' from AllDocs
where DoclibRowId is null and = 0x and = 0
and = 1 and ListId in
(select tp_ID from dbo.AllLists where in (100,107,108,150,1100) and > 0)
group by order by desc
注: 指示该listitem是否已被删除,未删除则值应为0x。
指示此item是否含有文件流,1表示含有。
指示此文档的‘Document Store Type’, 0表示文件,1表示文件夹。
4. 从站点集的Url地址得到所在数据库的名字
此处需要用到SharePoint的配置数据库(默认名称为:SharePoint_Config )
select dbo.objects. from dbo.objects, dbo.sitemap
where dbo.objects. = dbo.sitemap. and dbo.sitemap. = '/AK/StrategicIndustries'
注:dbo.objects. –> 数据库的名称存在于此列。
dbo.sitemap. –> 记录着站点集的路径。
附件:http://down.运维网.com/data/2357822
页:
[1]