跟踪报告使用情况
是否有一种简单的方法可以跟踪谁在运行SSRS 2005中的给定报告,以及他们在什么时候运行该报告? 我们在SSRS实施方面有大约80份报告,正试图查看是否有什么我们可以放心的放牧。 如果我们可以很容易地看到哪些报告没有被使用,这将有助于我们。 有任何想法吗?
下面的文章中提供了一些关于生成报告的很好的build议和疑问。
例如,如果您想查看最常用的报告,则可以执行以下操作:
SELECT COUNT(Name) AS ExecutionCount, Name, SUM(TimeDataRetrieval) AS TimeDataRetrievalSum, SUM(TimeProcessing) AS TimeProcessingSum, SUM(TimeRendering) AS TimeRenderingSum, SUM(ByteCount) AS ByteCountSum, SUM([RowCount]) AS RowCountSum FROM (SELECT TimeStart, Catalog.Type, Catalog.Name, TimeDataRetrieval, TimeProcessing, TimeRendering, ByteCount, [RowCount] FROM Catalog INNER JOIN ExecutionLog ON Catalog.ItemID = ExecutionLog.ReportID WHERE Type = 2 ) AS RE GROUP BY Name ORDER BY COUNT(Name) DESC, Name;
有一点需要注意的是,默认情况下,执行日志只会保存2个月的数据。 您可以使用ExecutionLogDaysKept
服务器属性来控制此行为,请参阅此TechNet文章 。
我知道这个问题很老,它有胡须,但是下面的代码会在上次运行时列出每个报告一次。 我强烈build议您创build一个名为“废弃报告”的新文件夹,并将旧报告移到那里,而不是删除它们。 这将消除混乱,但仍然保持可用的情况下,会计部来了你的报告,他们显然需要每3.26年运行一次。
WITH RankedReports AS (SELECT ReportID, TimeStart, UserName, RANK() OVER (PARTITION BY ReportID ORDER BY TimeStart DESC) AS iRank FROM dbo.ExecutionLog t1 JOIN dbo.Catalog t2 ON t1.ReportID = t2.ItemID ) SELECT t2.Name AS ReportName, t1.TimeStart, t1.UserName, t2.Path, t1.ReportID FROM RankedReports t1 JOIN dbo.Catalog t2 ON t1.ReportID = t2.ItemID WHERE t1.iRank = 1 ORDER BY t1.TimeStart;
我总是发现报告日志有点难以使用。 报告服务会在报告数据库的一个表中logging其所有活动,称为ExecutionLog
我有几个报告,我用这个查询这张表,所以你可以找出什么报告实际使用,谁是最重的用户
您可以使用执行日志来监视报告使用情况。 请检查此http://technet.microsoft.com/en-us/library/aa964131(SQL.90).aspx
您也可以运行查询来查找报告使用情况。 检查Maz的回复在这个链接http://www.sqlservercentral.com/Forums/Topic433562-150-1.aspx
干杯
这个SQL也会给你数据源,用户和请求types:
select row_number() over (order by LogEntryId) as Id, LogEntryId, r.Name AS Report_Name, r.Path AS Report_Path, c2.Name AS Data_Source, replace(c2.ConnectString,';Unicode=True','') as ConnectString, SUBSTRING(r.Path, 2, LEN(r.Path) - LEN(r.Name) - 2) AS Folder_Path, ex.UserName, ex.Format, ex.TimeProcessing, ex.TimeRendering, ex.[RowCount], CAST (ex.TimeStart as date) AS TimeStart, DATEPART (hour, ex.TimeStart) AS StartHour, DATEPART (minute, ex.TimeStart) AS StartMinute, case when ex.RequestType = 0 then 'Interactive' when ex.RequestType = 1 then 'Subscription' when ex.RequestType = 2 then 'Refresh Cache' else 'Unknown' end RequestType, u.UserName as CreatedBy, ex.Status from ExecutionLogStorage ex (nolock) --exec log join Catalog (nolock) r on ex.ReportID = r.ItemID and r.Type = 2 --report join DataSource ds with (nolock) ON ds.ItemID = r.ItemID --report to connection link join (select ItemID, Name, SUBSTRING(Content, CHARINDEX('<ConnectString>',Content) + 15, CHARINDEX('</ConnectString>',Content) - CHARINDEX('<ConnectString>',Content) - 15) AS ConnectString from ( select ItemID, Name, CONVERT(NVARCHAR(MAX),CONVERT(XML,CONVERT(VARBINARY(MAX),Content))) As Content from Catalog with (nolock) where Type = 5) x ) c2 ON ds.Link = c2.ItemID -- connection left join Users u on u.UserID = r.CreatedByID