SSRS Report Server - Email on failure? - sql-server

My company uses SSRS to deliver reports to users, either by email subscriptions or by the user opening the Report Server page in their browser and clicking on the report they want, which then runs it against the db. I call this "Interactive mode".
My users are supposed to tell me when a report fails, so I can go fix it, but most of the time they don't.
So I need to go looking for failed reports. I can already see which email subscription reports have failed using the subscriptions report in SSRS, but I need a way to either generate an email or log a row to a table whenever one of the interactive mode reports fails.
I can't see anything obvious in Visual Studio that would allow me to do this, has anyone come up with a solution for this before?

By default SSRS maintains the subscriptions and errors info within Report server database.
Subscriptions is catalog info table of all subscriptions in Report Server
SubscriptionHistory maintains the extended details of the error.
Using following script, you can monitor the last status of all subscriptions at one place, rather than going through SSRS web interface. also, you could develop your own script based on this:
select c.ItemID as ReportItemID,
c.Name as ReportName,
c.Path as ReportLocation,
s.Description as SubscriptionTitle,
EventType,
LastRunTime,
LastStatus,
CreationDate
from Subscriptions as s
join Catalog as c on s.Report_OID = c.ItemID
Where LastStatus like '%failed%'
or LastStatus like '%Error%'
and (NOT LastStatus like '%0 Errors.')
GO

It turns out there's a very helpful table in the ReportServer database named "ExecutionLog" which has exactly these details.

Related

SSRS 2017 subscriptions stopped working after installing KB4583457

2 weeks ago we installed KB4583457 on SQL Server 2017 Standard (14.0.3294.2). For some reason, it broke something in the system databases of SQL Server and the server became unavailable. We had to uninstall this update to resolve the issue. It helped and everything, except SSRS subscriptions, started working fine again. But SSRS subscriptions behave weird since then. No email has been sent and if we try to trigger any subscription manually (using [Run Now] button), it doesn't work, or to be more precise - it gets stuck in 'Running' state.
I realize something's probably wrong with our instance of SQL Server/SSRS. But I'd really appreciate if someone can suggest an idea or advise what else we can check. Here's what we've checked so far:
Logs of SSRS in Program files - nothing there.
Windows events logs - nothing relevant there.
SQL Configuration Manager - all services (except SQL Server Browser) are up & running.
Reporting Services Configuration Manager - nothing has changed and everything looks OK.
SSRS Web Portal - the reports work as expected, including the export to various formats.
SSRS API - no issues.
The history of SQL Agent jobs created by SSRS subscriptions - all jobs continue to run by schedule. So the history of SQL agent jobs is not consistent with what is displayed on SSRS portal in the 'Last run' column of any subscription.
The owner of all SQL agent jobs linked to SSRS subscriptions is 'NT SERVICE\SQLServerReportingServices', which has db_owner permissions to ReportServer and ResportServerTemp databases.
ReportServer database - we used the script bellow to find any clue that might point us in the right direction. But it doesn't show any useful error messages.
select
c.Name as Report,
s.LastRunTime,
s.SubscriptionID,
s.*
from [ReportServer].[dbo].[Subscriptions] as S
inner join [ReportServer].[dbo].[Catalog] as c
on c.ItemID = s.Report_OID
order by s.LastRunTime desc
If someone has any other ideas, please feel free to share.
Thanks, it turned out the issue was related to the permissions of NT Service\SQLServerReportingServices user. The screenshot below shows what had to be updated - Execute permission on dbo.sp_verify_job_identifiers stored procedure. Hopefully it will save someone hours or even days.
It's important to note we would be able to identify the root problem earlier if we had looked through the Logs of SSRS in Program files folder not only for the current day but also the old ones.
C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\LogFiles

Snowflake SSRS ODBC error : No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command

I'm using SSRS (SQL Server reporting services) to display reports, my datasource is Snowflake
I have installed the ODBC snowflake driver and configured it properly
Click here to view the ODBC configuration
I have created a shared datasource on the SSRS server (via Report manager) and put in my own credentials and the connection works fine
Click here to view the connection on the SSRS Server
I'm able to build the SSRS report without any issues, when I run the report, everything works fine, I can publish the report on the server and the report renders perfectly fine on the browser
The issue is when i go back to the report the next day, i'm presented with an error:
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset
'insert_name_of_my_dataset_here'. (rsErrorExecutingCommand)
ERROR [57P03] No active warehouse selected in the current session.
Select an active warehouse with the 'use warehouse' command.
So, this also means that the following doesn't work neither:
Subscriptions
Cache refresh
Snapshots
The only thing that works is if I open my report in SSRS Report builder, I right-click EACH of my datasets ("each" is very important, it doesn't work if i don't do all of them), I run the queries manually for each of them, and then the "connection" or "session" is "re-activated" and the report runs fine, both locally AND on the server...note i do not have to re-publish the report on the server for it to run
Click here to view screenshots of my process
Steps I have taken to addresss the issue (that didn't yield any resolution):
I have tried putting the "use warehouse WAREHOUSE_NAME;" command before each dataset's SQL script, but Snowflake's API doesn't allow multiple SQL commands to be sent, so I already saw that this functionality was in the development pipeline for Snowflake and found this link: https://github.com/snowflakedb/snowflake-connector-net/issues/33 - this work was started in 2018 and the last update dates from Apr 2019 that says they are starting to address the JDBC driver...no mention for the ODBC driver yet
I have set the snowflake parameter client-session-keep-alive to true (https://docs.snowflake.com/en/sql-reference/parameters.html#client-session-keep-alive), but according to the community portal: A similar "keep alive" parameter is not currently available for the ODBC driver. Instead, you could issue a dummy query every few hours to keep the connection alive. (https://community.snowflake.com/s/article/faq-how-long-can-my-jdbcodbc-connection-remain-idle)
List item
I have tried to create a cache refresh plan or a snapshot schedule that creates a snapshot or caches the report every 3 hours, and it works for the first schedule, but fails with the error for the other ones
The only thing I didn't try is to have snowflake never close the connection and keep the warehouse in the "started" state indefinitely...but this would increase my cost, and i'm pretty sure it won't work since the session would end anyways after 4 hours...
Any assistance is welcome!
Thanks
Specs:
SSRS 2014
Snowflake X-small
ODBC-64 bit driver, installed from the
snowflake driver repository (tested with 32-bit also, but 64-bit is
the one that is visible to SSRS)
I faced the same kind of issue and fixed adding the corresponding role with the data warehouse.
In the data warehouse add role with USAGE.
Could it be related with the data warehouse name (in the ODBC settings)? Is there a typo? COSNUMER_WH or CONSUMER_WH?
I strongly recommend setting default "context" configurations for situations like this, setting default role, warehouse, database, and schema with commands such as this:
ALTER USER xyz SET DEFAULT_WAREHOUSE = 'WH_NAME_HERE' ;
https://docs.snowflake.com/en/sql-reference/sql/alter-user.html

SSRS Subscription failure rsProcessingAborted

I have subscriptions that are failing to run giving the error:
Failure sending mail: An error has occurred during report processing.Mail will not be resent.
The report runs fine when requested manually through the server so I know the datasource and connection work.
Inside the SSRS database the only information I can get is from the ExecutionLogStorage saying:
rsProcessingAborted
The ExecutionLogStorage table also shows the TimeStart and TimeEnd being 1 second apart, on a report that takes 2+ minutes to run manually. The report has not failed a single time when running manually, only fails through the subscription.
The windows event viewer does contain some errors about a TERADATA extension but they do not coincide with the subscription failures.
The logs located in \Program Files\Microsoft SQL Server\MSRS10_50.Reporting\Reporting Services\LogFiles do not even contain an entry for that subscription during failure at all.
I'm not sure where to go for more information, I need to know why this subscription is failing, we have the workaround of manually running the report and manually emailing it out after converted to excel but that's not a viable solution going forward.
Some other places you could check are:
SSRS Log:
c$\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\LogFiles
You could try enabling verbose logging (level 4) here
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin\ReportingServicesService.exe.config
Look for this tag:
<switches>
<add name="DefaultTraceSwitch" value="4" />
</switches>
I'm fighting very similar issue but to make it a bit complex, my subscription fails only every other time or so and runs fine sometimes. So far I ruled out:
No. of parallel SSRS sessions
Memory pressure on DB server & Report
Server Kicking off the subscription directly vs remotely(running
the agent job)
Sorry, I do not have a good answer for you but this issue seems to bother more than few people.
Update:
I found out that the Subscription was a created by a windows user who is no longer valid (ID expired). Updating the Subscription owner fixed it.
-- List SSRS users (check to make sure the new Owner exists in this list)
SELECT *
FROM Users
WHERE UserName IN ('DomainName\_SSRSServiceAccount')
-- DFGRYH-DFGRYH--DFGRYH-DFGRYH
-- Identify the subscription whose ownership you would like to edit
SELECT *
FROM Subscriptions
WHERE OwnerID = 'DFGRYH-DFGRYH--DFGRYH-DFGRYH'
AND Description = 'Send e-mail to RichG#DomainName.com'
ORDER BY LastRunTime
,LastStatus
-- Update the Subscription with new Owner, the change should reflect on the SSRS reports
UPDATE Subscriptions
SET OwnerID = 'DFGRYH-DFGRYH--DFGRYH-DFGRYH'
WHERE SubscriptionID = 'B33A78FC-933D-47DB-AB50-43D36B24C0B8'

Sql Reporting Services Subscription Error

The Current Action cannot be completed because the user data source credentials that are required to execute this report are not stored in the report server database
Take a look at your datasources for your reports. There are two settings.
User can supply them.
Or they can be stored in DB.
They need to be stored in DB for subscriptions (at least that's how the error reads). See if you can modify your datsources.
please ignore if you had already solved it.
This issue may also happen if default user credentials (like windows userID) do not have enough permissions to run a piece of SQL script or a SP. We can go to SQL server report configuration and select an option to ask for credentials every time you run a report.
You can provide the correct user id paswd when prompted?
Praveen

SSRS report subscription ended with an error

I hate to cross post, but I wasn't getting any progress with this on serverfault and there appears to be a lot more activity with regard to reporting services here.
I've created a simple report in SSRS, and then tried my hand out with a data driven subscription.
I can verify that the subscription runs on the 'My Subscriptions' page. Under Status it says Done: 1 processed of 1 total; 1 errors.
How do I find out what this error is?
I've looked in the Windows Event Logs and haven't found anything. I also checked the SQL Server Logs and nothing is there either.
You need to look in the "Report Server Execution Log" which is a particular SQL Reporting Services log file.
See Reporting Services Log Files for details.
A bit late to the party, however:
Here is where I find my logs when DD subscription fails:
C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\LogFiles
look for filename: ReportServerService*.log with relevant Date Modified
You also can check the Report History, to get this option, put the mouse on top of your report and select manage option from drop-down list of your report, look for the "Report History" on the left options, create a "New Snapshot"
It will show you, the last error know:
Parameter validation failed. It is not possible to provide valid values for all parameters (rsParameterError)
for this case you need to check the definition of the report, I had an issue with the drop-down list I used to send parameters to the report.
The path under which you can find Report Server Service logs could be different, such as:
C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\LogFiles
In this logs you can find errors that happened after generating the report itself. For instance, if the Reporting Services user needs to write the report as a CSV file after a subscription and it lacks the necessary authorization, the only place where you can find the description of the error is in these logs, while the history of the Job connected with the subscription and the Execution Log will tell you that the Report was correctly generated (nothing about saving the report).

Resources