简体   繁体   中英

SSRS How to get runtime log for subscription?

I need to get the runtime log for subscription.

I need to know in a period of time how many times the subscription was invoked and how long took to run, From Pending to Successful or Failed Status.

I have tried to get the information from msdb.dbo all jobs tables but the runtime there is something different.

Any help will be more than appreciated.

Here is a start.. it doesn't give you everything you want.. but certainly enough to get you started

SELECT
sj.[name] AS [Job Name],
rs.SubscriptionID,
c.[Name] AS [Report Name],
c.[Path],
su.Description,
su.EventType,
su.LastStatus,
su.LastRunTime


FROM msdb..sysjobs AS sj 

INNER JOIN ReportServer..ReportSchedule AS rs
ON sj.[name] = CAST(rs.ScheduleID AS NVARCHAR(128)) 

INNER JOIN ReportServer..Subscriptions AS su
ON rs.SubscriptionID = su.SubscriptionID

INNER JOIN ReportServer..[Catalog] c
ON su.Report_OID = c.ItemID

Thanks for your answer. I did check.

SELECT sj.name,
        sh.run_date,
        sh.step_name,
        sh.run_duration
FROM msdb.dbo.sysjobs sj
JOIN msdb.dbo.sysjobhistory sh
ON sj.job_id = sh.job_id WHERE name = 'examplejobName' 

`

This gives job runtime but is not the real-time between status Pending and Failing or Success.

I have checked the job for this specific subscription and all steps are completed but still, the subscription is Pending. This is basically what I need time since the subscription was invoked till Success(the email or file was copy) or Failed

I will appreciate any other advice.

Best Regards.

SSRS ReportServer help us to find details about the reports executions and other details. So we can use the following query to find out answers of the following;

-How many times the subscription was invoked?

-How long took to run?

SELECT TMP_TBL.*,sc.LastStatus,sc.LastRunTime FROM (
select  ROW_NUMBER() OVER(ORDER BY TimeEnd DESC) AS Rw_Nr,CASE(RequestType) 
        WHEN 0 THEN 'Interactive'
        WHEN 1 THEN 'Subscription'
        WHEN 2 THEN 'Refresh Cache'
        ELSE 'Unknown'
        END AS RequestType ,DATEDIFF(second,TimeStart,TimeEnd) AS Execution_Time ,Status ,UserName ,Format ,c.ItemID
FROM ExecutionLogStorage EL WITH(NOLOCK)
LEFT  JOIN Catalog C WITH(NOLOCK) ON (EL.ReportID = C.ItemID)
where RequestType=1
-- AND el.TimeEnd BETWEEN @BegTime AND @EndTime
) AS TMP_TBL LEFT JOIN Subscriptions sc ON sc.Report_OID = TMP_TBL.ItemID and TMP_TBL.Rw_Nr=1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM