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.升级报表服务器数据库
https://docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2005/ms403392(v=sql.90)
2.rsinvalidreportserverdatabase
https://docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2005/bb326494(v=sql.90)?redirectedfrom=msdn
3.如何检测版本信息 (reporting services)—2008
https://docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2008/bb630446(v=sql.100)
4.如何检测版本信息 (reporting services) —2008r
https://docs.microsoft.com/zh-cn/previous-versions/sql/sql-server-2008-r2/bb630446(v=sql.105)