遷移Report Server DataBase時遇到的坑
- 2021 年 6 月 25 日
- 筆記
- SQL Server 管理
1.項目背景
由於歷史原因,公司部分系統的Report是基於SQL Server Report Service搭建的,且Reporting Services 和Report Server DataBase是部署在不同的DB上的。因報表數據庫所在機器過保,需要將Report Server數據庫和ReportServerTempDB數據庫遷移至新的Server上。但因項目老舊,研發和運維人員更迭,相關文檔不完善,所以,這次遷移過程中,我們還是遇到了一個不小的坑。
遷移要求,如下圖所示:
但是很不幸,遷移後,report service 報錯。
2.報錯信息
service 錯誤信息如下:
報表服務器數據庫的版本格式無效,或無法讀取。已找到的版本為「147」,而所需的版本為「C.0.8.54」。若要繼續操作,請更新報表服務器數據庫的版本並驗證其訪問權限。 (rsInvalidReportServerDatabase) (rsRPCError) 獲取聯機幫助
查看report 服務的log,文件 ReportServerService__12_04_2018_18_56_15.log.txt,
完整的信息如下
<Header> <Product>Microsoft SQL Server Reporting Services 版本 9.00.5000.00</Product> <Locale>zh-CN</Locale> <TimeZone>中國標準時間</TimeZone> <Path>Z:\Program Files\Microsoft SQL Server\MSSQL.1\Reporting Services\LogFiles\ReportServerService__12_4_2021_18_56_15.log</Path> <SystemName>weixinqqyijiaqin113</SystemName> <OSName>Microsoft Windows NT 6.1.7601 Service Pack 1</OSName> <OSVersion>6.1.7601.65536</OSVersion> </Header> ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing ConnectionType to '0' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing IsSchedulingService to 'True' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing IsNotificationService to 'True' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing IsEventService to 'True' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing PollingInterval to '10' second(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing WindowsServiceUseFileShareStorage to 'False' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing MemoryLimit to '60' percent as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing RecycleTime to '720' minute(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing MaximumMemoryLimit to '80' percent as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing MaxAppDomainUnloadTime to '30' minute(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing MaxQueueThreads to '0' thread(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing IsWebServiceEnabled to 'True' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing MaxActiveReqForOneUser to '300' requests(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing MaxScheduleWait to '5' second(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing DatabaseQueryTimeout to '120' second(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing ProcessRecycleOptions to '0' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing RunningRequestsScavengerCycle to '60' second(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing RunningRequestsDbCycle to '60' second(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing RunningRequestsAge to '30' second(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing CleanupCycleMinutes to '10' minute(s) as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing DailyCleanupMinuteOfDay to default value of '120' minutes since midnight because it was not specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing WatsonFlags to '1064' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing WatsonDumpOnExceptions to 'Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException,Microsoft.ReportingServices.Modeling.InternalModelingException' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing WatsonDumpExcludeIfContainsExceptions to 'System.Data.SqlClient.SqlException,System.Threading.ThreadAbortException' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing SecureConnectionLevel to '0' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing DisplayErrorLink to 'True' as specified in Configuration file. ReportingServicesService!library!4!2018/12/4-18:56:15:: i INFO: Initializing WebServiceUseFileShareStorage to 'False' as specified in Configuration file. ReportingServicesService!resourceutilities!4!2018/12/4-18:56:16:: i INFO: Reporting Services starting SKU: Enterprise ReportingServicesService!resourceutilities!4!2018/12/4-18:56:16:: i INFO: Evaluation copy: 0 days left ReportingServicesService!library!9!2018/12/4-18:56:16:: i INFO: Catalog SQL Server Edition = Enterprise ReportingServicesService!library!9!2018/12/4-18:56:16:: i INFO: Current DB Version 147, Instance Version C.0.8.54. ReportingServicesService!library!9!2018/12/4-18:56:16:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportServerDatabaseException: 報表服務器數據庫的版本格式無效,或無法讀取。已找到的版本為「147」,而所需的版本為「C.0.8.54」。若要繼續操作,請更新報表服務器數據庫的版本並驗證其訪問權限。, ; Info: Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportServerDatabaseException: 報表服務器數據庫的版本格式無效,或無法讀取。已找到的版本為「147」,而所需的版本為「C.0.8.54」。若要繼續操作,請更新報表服務器數據庫的版本並驗證其訪問權限。 ReportingServicesService!library!9!2018/12/4-18:56:16:: e ERROR: Exception caught while starting service. Error: Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportServerDatabaseException: 報表服務器數據庫的版本格式無效,或無法讀取。已找到的版本為「147」,而所需的版本為「C.0.8.54」。若要繼續操作,請更新報表服務器數據庫的版本並驗證其訪問權限。 在 Microsoft.ReportingServices.Library.ConnectionManager.EnsureCorrectDBVersion() 在 Microsoft.ReportingServices.Library.ConnectionManager.ConnectStorage() 在 Microsoft.ReportingServices.Library.ServiceController.ServiceStartThread() ReportingServicesService!library!9!2018/12/4-18:56:16:: e ERROR: Attempting to start service again...
3.錯誤分析
3.1 簡單分析嘗試
查看遷移前後兩台機器的SQL實例,其版本一致,確實一致,如下:
Microsoft SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64)
按照提示及大眾意見,點擊升級數據庫也不行
提示數據庫的版本驗證不通過。
3.2 從版本入手,重點分析版本
錯誤提示版本不對,那我們找下Report server 和 Report server database的版本信息。下表列出了截至目前(2015/04/29)發佈的報表服務器和報表服務器數據庫的版本號:
Release |
Report server |
Report server database |
---|---|---|
SQL Server 2008 R2 |
10.50.nnnn.nn |
n/a |
SQL Server 2008 Service Pack 1 (SP1) |
10.0.2531.00 |
C.0.9.45 |
SQL Server 2008 |
10.0.1600.00 |
C.0.9.45 |
SQL Server 2005 Reporting Services Service Pack 3 (SP3) |
9.0.4035.00 |
C.0.8.54 |
SQL Server 2005 Reporting Services Service Pack 2 (SP2) |
9.0.3042.00 |
C.0.8.54 |
SQL Server 2005 Express with Advanced Services |
9.0.3042.00 |
C.0.8.45 |
SQL Server 2005 Reporting Services Service Pack 1 (SP1) |
9.0.2049.00 |
C.0.8.43 |
SQL Server 2005 Reporting Services |
9.0.1399.01 |
C.0.8.40 |
SQL Server 2000 Reporting Services Service Pack 2 (SP2) |
8.00.1038 |
C.0.6.54 |
SQL Server 2000 Reporting Services Service Pack 1 (SP1) |
8.00.0878 |
C.0.6.51 |
SQL Server 2000 Reporting Services |
8.00.0743 |
C.0.6.43 |
現在來看,Reporting Services Service 應該安裝的是2005 SP2 (或者 SP3),但是 Report server database 安裝的是2008 R2 SP3。
到此,也應該知道為什麼升級版本不對了,當Reporting Services Service 版本 高於 Report server database 版本(的要求)時,可以考慮通過升級解決保存版本不適配問題。我們現在遇到的情況正好相反,Report server database 版本高於Reporting Services Service 版本(的要求)了。
4 方案探究
4.1 問題解決
其實問題清晰了,就是Report server 和 Report server database的版本不適配導致的。
再回到遷移項目本身來看,遷移前後,SQL Server 實例的版本一致(Microsoft SQL Server 2008 R2 (SP3)),遷移前運行OK,遷移後就完犢子了,這說明Report server database的版本還受制於其它因素。
是什麼限制的呢?眾里尋他千百度,一次又一次,嘗試N中方法….
忽然發現,原Report server database所在的Server 沒有安裝 Reporting Services,而新的Report server database所在的Server 在安裝 SQL Server實例時,選擇功能時,選擇的時是【Select All】,即 新的Server 有安裝Reporting Services。這一發現 是通過C:\Program Files\Microsoft SQL Server 路徑下的安裝文件發現的。
補充一點,新 Server的SQL Server實例安裝後,本身有Report Server數據庫和ReportServerTempDB數據庫,為了遷移,我們是先將DB drop 掉,然後再附加(attach)原DB Server的DB文件。
4.2 方案驗證
新安裝一個SQL Server實例,但是不安裝Reporting Services,即到功能選擇時,按照圖中標識的選擇。
安裝後,附加(attach)原DB Server的DB文件(Report Serve和ReportServerTempDB的DB文件),然後配置Reporting Services (主要是配置報表服務器數據庫連接),這時OK了,服務正常了。
OK!
OK!
OK!
這也說明,思考的方向是正確的。
4.3 結論或推斷
(1)Report server database的版本 與 所在SQL Server 實例的版本不同;
(2)安裝SQL Server 實例時,如未安裝Reporting Services,則 Report server database(Report Server和ReportServerTempDB)附加到不同版本SQL Server 實例上時,Report server database的版本 不變;
(3)安裝SQL Server 實例時,如有安裝Reporting Services,則 遠程電腦上的Reporting Services 連接 本機的Report server database時,獲取的Report server database的版本版本是安裝時的版本。雖可 刪除、再附加 不同 版本的Report server database,但獲取的版本仍是安裝時的版本。即,此時符合 (2)的推論 不同。
(4)造成(3)的原因,推測為: 安裝SQL Server 實例時安裝Reporting Services,有將安裝時的Report server database的版本保存到註冊表或系統表,遠程電腦上的Reporting Services 連接 本機的Report server database時,優先從註冊表或系統表 獲取信息(,不再讀取附加的Report server database的版本)。
5.參考文檔
1.升級報表服務器數據庫
//docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2005/ms403392(v=sql.90)
2.rsInvalidReportServerDatabase
//docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2005/bb326494(v=sql.90)?redirectedfrom=MSDN
3.如何檢測版本信息 (Reporting Services)—2008
//docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2008/bb630446(v=sql.100)
4.如何檢測版本信息 (Reporting Services) —2008R
//docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2008-r2/bb630446(v=sql.105)