今天遇到了Reporting Services(SQL SERVER 2008 R2)的报表执行异常情况,报表加载数据很长时间都没有响应,最后报“An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.;”。 检查C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles下日志,发现ReportServerService__12_24_2014_10_29_02.log中有大量如 下错误:
library!WindowsService_4!1308!12/24/2014-01:27:53:: ;i INFO: Call to CleanBatch()
library!WindowsService_4!1308!12/24/2014-01:32:53:: ;e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: , An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.;
dbcleanup!WindowsService_4!1308!12/24/2014-01:32:53:: ;e ERROR: Sql Error in CleanOrphanedSnapshots: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
library!WindowsService_4!1308!12/24/2014-01:32:53:: ;i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams, 0 segments, 0 segment mappings, 0 edit sessions.
library!WindowsService_4!1308!12/24/2014-01:32:53:: ;i INFO: Call to CleanBatch() ends
library!WindowsService_4!13ec!12/24/2014-01:37:53:: ;i INFO: Call to CleanBatch()
library!WindowsService_4!13ec!12/24/2014-01:42:53:: ;e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: , An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.;
dbcleanup!WindowsService_4!13ec!12/24/2014-01:42:53:: ;e ERROR: Sql Error in CleanOrphanedSnapshots: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
library!WindowsService_4!13ec!12/24/2014-01:42:53:: ;i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams, 0 segments, 0 segment mappings, 0 edit sessions.
library!WindowsService_4!13ec!12/24/2014-01:42:53:: ;i INFO: Call to CleanBatch() ends
library!WindowsService_4!1308!12/24/2014-01:47:53:: ;i INFO: Call to CleanBatch()
library!WindowsService_4!1308!12/24/2014-01:52:53:: ;e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: , An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.;
dbcleanup!WindowsService_4!1308!12/24/2014-01:52:53:: ;e ERROR: Sql Error in CleanOrphanedSnapshots: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
library!WindowsService_4!1308!12/24/2014-01:52:53:: ;i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams, 0 segments, 0 segment mappings, 0 edit sessions.
library!WindowsService_4!1308!12/24/2014-01:52:53:: ;i INFO: Call to CleanBatch() ends
检查了服务器的存储情况后,可以排除low disk问题,只能是connection failure, timeout的问题,于是我查看1点多的执行记录,发现取数据时间都是几百秒,如下截图所示
我检查C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer下的rsreportserver.config,发现DatabaseQueryTimeout为120秒
但是这些报表的SQL语句我在SSMS里面执行过,也只有1~2秒,根本不会超时的情况。当时我立马重启了SSRS服务后,问题解决。那么问题究竟出自哪里呢?搜索了网上很多资料,大致有下面一些原因:
原因1:SSRS服务崩溃了,不能响应用户请求。
These threads could help: SSRS 2008 crashing when running a report with huge amount of data long running report can not be rendered in Report Manager .....
- SSRS 2008 crashing when running a report with huge amount of data
- long running report can not be rendered in Report Manager or through Subscription
具体可以参见“参考资料”选URL中的讨论。
原 因2:Database deadlocks occur when you try to view an SSRS report in the SharePoint integrated mode after you update a data source
具体可以参考官方文档http://support.microsoft.com/kb/2691331/en-us ,不过由于我们服务器并没有应用SharePoint integrated mode,所以应该可以排除。
原因3:Cannot rename a report in SharePoint integrated mode.这个核查过后,也可以排除。
至此,由于第一次遇到这个错误,搜索了大量资料也没有看到一个很明确的答案,加之SSRS确实也是问题多多。所以我觉得应该是SSRS服务崩溃了。如有不对,敬请指出。