是否有一种简单的方法可以跟踪谁在SSRS 2005中运行给定的报告,以及他们在何时运行该报告?在我们的SSRS实施中,我们有大约80份报告,并且正在试图查看是否有任何我们可以放心地放弃牧场的报告。如果我们能够轻易地看到哪些报告没有被使用,那将有助于我们。有什么想法吗?
答案 0 :(得分:48)
在以下article中,有一些很好的建议和查询可以生成相关报告。
例如,如果要查看最常用的报告,可以执行以下操作:
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
服务器属性控制此行为,请参阅this technet article。
答案 1 :(得分:15)
我知道这个问题已经过时了,它有胡须,但下面的代码会将每个报告列在最后一次运行时。我强烈建议您创建一个名为“过时报告”的新文件夹,并在那里移动旧报告而不是删除它们。这将消除混乱,但仍然保持它们可用,以防会计部门跟踪你的报告,他们显然需要每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;
答案 2 :(得分:4)
我总是发现报告日志有点难以使用。报告服务在报告数据库的表中记录其所有活动,名为 ExecutionLog
我有几个报告我使用该表查询,因此您可以找出实际使用的报告,以及最重的用户是谁
答案 3 :(得分:2)
您可以使用执行日志监控报告使用情况。请查看此http://technet.microsoft.com/en-us/library/aa964131(SQL.90).aspx
您还可以运行查询以查找报告使用情况。通过此链接http://www.sqlservercentral.com/Forums/Topic433562-150-1.aspx
查看Maz的回复欢呼声
答案 4 :(得分:0)
此SQL还将为您提供数据源,用户和请求类型:
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
答案 5 :(得分:0)
USE ReportServer
SELECT c.Name AS ItemName
, CASE c.Type
WHEN 1 THEN 'Folder'
WHEN 2 THEN 'Report'
WHEN 3 THEN 'Resource'
WHEN 4 THEN 'Linked Report'
WHEN 5 THEN 'Data Source'
ELSE CAST(c.Type AS VARCHAR(100))
END AS ItemType
, c.Path AS ItemPath
, ( SELECT TOP 1 TimeStart FROM dbo.ExecutionLog t1 WHERE t1.ReportID = c.ItemID ORDER BY TimeStart DESC ) AS LastRunDate
, ( SELECT TOP 1 UserName FROM dbo.ExecutionLog t1 WHERE t1.ReportID = c.ItemID ORDER BY TimeStart DESC ) AS LastUser
FROM Catalog AS c WITH (NOLOCK)
WHERE 1=1
--AND c.Type IN (1,2)
-如果仅搜索报告和文件夹,则取消注释