今天遇到了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服務崩潰了。如有不對,敬請指出。
參考資料:
http://support.microsoft.com/kb/2691331/en-us
http://blog.davyknuysen.be/2010/09/22/cannot-rename-a-report-in-sharepoint-integrated-mode/