You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何配置报表服务器数据库?创建时遇Error 5118报错求助

解决报表服务器数据库创建时的文件压缩错误

问题描述

配置报表服务器数据库过程中,创建新数据库触发SQL异常,错误信息如下:

System.Data.SqlClient.SqlException (0x80131904): The file "C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\ReportServer3.mdf" is compressed but does not reside in a read-only database or filegroup. The file must be decompressed.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(SqlConnection conn, String script, ICommandWrapperFactory commandWrapper)
   at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(String connectionString, String script)
   at ReportServicesConfigUI.SqlClientTools.SqlTools.ApplyScript(String connectionString, String script)
ClientConnectionId:66ed706c-8c3e-4f92-878e-c5a6ce4f68bc
Error Number:5118,State:1,Class:16

错误原因

SQL Server禁止将系统压缩的文件用于非只读数据库或文件组,本次错误是因为目标数据文件ReportServer3.mdf(或其所在目录)被Windows系统启用了压缩功能。

解决步骤

  • 处理已存在的压缩文件:
    1. 打开文件资源管理器,导航到路径C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\
    2. 找到ReportServer3.mdf文件,右键选择属性
    3. 切换到常规选项卡,点击高级按钮,取消勾选压缩内容以便节省磁盘空间,依次点击确定保存设置
  • 检查并解除目录压缩:
    如果数据库文件尚未创建,需检查DATA目录是否被压缩:
    1. 右键DATA文件夹,选择属性
    2. 点击高级按钮,取消勾选压缩内容以便节省磁盘空间,根据需求选择将更改应用到「仅文件夹」或「文件夹和子文件夹及文件」,确认后完成设置
  • 重新创建数据库:完成上述操作后,回到报表服务配置管理器,重新执行报表服务器数据库的创建流程

补充说明

如果通过自定义SQL脚本创建数据库,需确保脚本指定的文件路径对应的目录未启用系统压缩;系统级压缩优先级高于脚本设置,优先处理系统压缩配置更稳妥。

内容的提问来源于stack exchange,提问作者Olaleye Cosby Olorunsomo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 22:22:44