Forum Discussion
Power BI Report Server unable to Refresh Reports
To "see" the underlying error messages for the failures you can use something like the query below (this should be run against the ReportServer DB of your PBI SSRS Server)
SELECT
sj.name AS SQLAgentJobName
,c.name AS ReportName
,c.[path] AS ReportPath
,s.[Description] as SubscriptionName
, rs.SubscriptionID
, s.laststatus
, s.eventtype
, s.LastRunTime
, sj.date_created
, sj.date_modified
,err.[Message] AS StatusMessage
,err.SessionID
,err.Errs
,ErrData.ErrCode AS ErrorCode
,ErrData.ErrMsg AS ErrorMessage
FROM ReportServer.dbo.ReportSchedule rs
INNER JOIN msdb.dbo.sysjobs sj
ON rs.ScheduleID = CAST(sj.name AS uniqueidentifier)
and 101 = sj.category_id
INNER JOIN ReportServer.dbo.Subscriptions s
ON rs.SubscriptionID = s.SubscriptionID
INNER JOIN ReportServer.dbo.[Catalog] c
ON s.report_oid = c.itemid
LEFT OUTER JOIN (SELECT MAX(SubscriptionHistoryID) AS SubscriptionHistoryID, SubscriptionID FROM dbo.SubscriptionHistory GROUP BY SubscriptionID) sh
ON rs.SubscriptionID = sh.SubscriptionID
LEFT OUTER JOIN (SELECT SubscriptionHistoryID,
[Message],
JSON_VALUE(Details, '$.SessionID') AS SessionID,
JSON_QUERY(Details, '$.Errors') AS Errs
FROM dbo.SubscriptionHistory ) err
ON sh.SubscriptionHistoryID = err.SubscriptionHistoryID
CROSS APPLY OPENJSON(err.Errs) WITH( ErrCode INT '$.ErrorCode', ErrMsg NVARCHAR(4000) '$.Message') AS ErrData
-- to find specific report last status
-- WHERE e.name = 'Usage Stats'
-- to find failed status
WHERE
LastStatus <> 'Completed Data Refresh'You can obviously filter this for specific reports and or date ranges as required.
This should at least point you in the right direction
Note that there is a "magic number" in that SQL that makes it work.
INNER JOIN msdb.dbo.sysjobs sj ON rs.ScheduleID = CAST(sj.name AS UNIQUEIDENTIFIER) AND 101 = sj.category_id
the 101 is the category_id of the Job Category called "Report Server"
you can find the correct value for this using the following.
USE msdb GO SELECT * FROM dbo.syscategories
I think 101 is safe on most systems but it may well be different on your installation
Thanks for the suggestion. Sorry I have been away and no one has checked. I will try it today.
Why does it have to be so complicated. MS surely needs to implement a simpler way of looking at the log issues.