跟踪报告使用情况

发布于 2024-07-29 05:12:20 字数 149 浏览 5 评论 0原文

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

Is there an easy way to track who is running a given report in SSRS 2005, and at what time they are running that report? We have about 80 reports in our SSRS implementation, and are trying to see if there's any that we can safely put out to pasture. If we could easily see somehow which reports aren't being used, that would help us. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

烟织青萝梦 2024-08-05 05:12:20

在以下文章

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

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 服务器属性控制此行为,请参阅这篇技术网文章

There is some good advice and queries for generating reports on this in the following article.

For example, if you want to see the most used reports, you can do the following:

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;

One thing to note is that by default the execution log will only keep 2 months worth of data. You can control this behaviour with the ExecutionLogDaysKept server property, see this technet article.

以往的大感动 2024-08-05 05:12:20

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

I know this question is so old it has whiskers, but the code below will list each report once with the last time it was run. I highly recommend you create a new folder called "obsolete reports" and move old reports there rather than delete them. That will remove the clutter but still keep them available in case the Accounting Department comes after you for that report they obviously need to run once every 3.26 years.

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;
水中月 2024-08-05 05:12:20

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

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

i always found the report logs are a bit hard to use. Reporting services keeps a record of all its activity in a table in the reporting database called ExecutionLog

I have a couple of reports i use that query this table, so you can find out what reports are actually used, and who the heaviest users are

听不够的曲调 2024-08-05 05:12:20

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

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

干杯

You can monitor the report usage using execution logs. Please check this http://technet.microsoft.com/en-us/library/aa964131(SQL.90).aspx

You can also run a query to find report usage. Check Maz's reply in this link http://www.sqlservercentral.com/Forums/Topic433562-150-1.aspx

cheers

梦开始←不甜 2024-08-05 05:12:20

此 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

This SQL will also give you the data source, user and the request type:

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
川水往事 2024-08-05 05:12:20
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)

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

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)

--uncomment if searching for reports and folders only

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文