跟踪报告使用情况

问题描述 投票:50回答:5

是否有一种简单的方法可以跟踪谁在SSRS 2005中运行给定的报告,以及他们在何时运行该报告?在我们的SSRS实施中,我们有大约80份报告,并且正在试图查看是否有任何我们可以放心地放弃牧场的报告。如果我们能够轻易地看到哪些报告没有被使用,那将有助于我们。有任何想法吗?

reporting-services reportingservices-2005
5个回答
49
投票

在以下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


16
投票

我知道这个问题太旧了,它有胡须,但下面的代码会在最后一次运行时列出每个报告一次。我强烈建议您创建一个名为“过时报告”的新文件夹,并在那里移动旧报告而不是删除它们。这将消除混乱,但仍然保留它们,以防会计部门跟踪你的报告,他们显然需要每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;

4
投票

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

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


2
投票

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

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

干杯


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

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)

- 仅在搜索报告和文件夹时取消注释

© www.soinside.com 2019 - 2024. All rights reserved.