51

是否有一种简单的方法可以跟踪谁在 SSRS 2005 中运行给定报告,以及他们在什么时间运行该报告?在我们的 SSRS 实施中,我们有大约 80 份报告,并且正在尝试看看是否有任何我们可以安全地放牧的报告。如果我们能够以某种方式轻松查看哪些报告没有被使用,那将对我们有所帮助。有任何想法吗?

4

6 回答 6

50

在下面的文章中,有一些关于生成报告的很好的建议和查询。

例如,如果您想查看最常用的报告,您可以执行以下操作:

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您可以使用server 属性控制此行为,请参阅此 technet 文章

于 2012-09-26T12:20:44.340 回答
18

我知道这个问题太老了,它有胡须,但下面的代码将列出每个报告一次,以及它最后一次运行的时间。我强烈建议您创建一个名为“过时报告”的新文件夹并将旧报告移到那里而不是删除它们。这将消除混乱,但仍保持可用,以防会计部门追随您的报告,他们显然需要每 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;
于 2012-06-14T23:21:29.260 回答
4

我总是发现报告日志有点难用。报告服务将其所有活动记录在报告数据库中名为ExecutionLog的表中

我有几个报告用于查询此表,因此您可以找出实际使用的报告以及最重的用户是谁

于 2009-07-25T17:30:19.750 回答
2

您可以使用执行日志监控报告使用情况。请检查此http://technet.microsoft.com/en-us/library/aa964131(SQL.90).aspx

您还可以运行查询以查找报告使用情况。在此链接中查看 Maz 的回复http://www.sqlservercentral.com/Forums/Topic433562-150-1.aspx

干杯

于 2009-07-24T17:44:52.613 回答
1

此 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
于 2017-04-07T16:20:10.477 回答
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)

-- 如果仅搜索报告和文件夹,请取消注释

于 2019-07-23T13:43:14.947 回答