无法打开数据库“xxx",因为它是版本 904 [英] The database 'xxx' cannot be opened because it is version 904

查看:152
本文介绍了无法打开数据库“xxx",因为它是版本 904的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法附加我的数据库.当我尝试在 SQL Server Management Studio 中附加数据库时,出现此错误:

I can't attach my database. When I try to attach a database in SQL Server Management Studio, I get this error:

无法打开数据库C:\FILES\ACCOUNTING.MDF",因为它的版本是 904.此服务器支持版本 852 及更早版本.不支持降级路径.无法打开新数据库C:\FILES\ACCOUNTING.MDF".CREATE DATABASE 已中止.(.Net SqlClient 数据提供程序)

The database 'C:\FILES\ACCOUNTING.MDF' cannot be opened because it is version 904. This server supports version 852 and earlier. A downgrade path is not supported. Could not open new database 'C:\FILES\ACCOUNTING.MDF'. CREATE DATABASE is aborted. (.Net SqlClient Data Provider)

我已经尝试过这些命令:

and I have tried these commands:

cd "C:\Program Files\Microsoft SQL Server\130\LocalDB\Binn"

SqlLocalDB.exe delete "MSSQLLocalDB"

SqlLocalDB.exe create "MSSQLLocalDB"

但还是有错误

推荐答案

不能这样做 - 您不能从较新版本附加/分离或备份/恢复数据库> SQL Server (v904 = SQL Server 2019) 到旧版本(v852,即 SQL Server 2016) - 内部文件结构太不同了,无法支持向后兼容性.

You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server (v904 = SQL Server 2019) down to an older version (v852 which is SQL Server 2016) - the internal file structures are just too different to support backwards compatibility.

你可以通过

  • 在所有机器上使用相同版本的 SQL Server - 然后您可以轻松地在实例之间备份/恢复数据库

  • using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances

否则,您可以在 SQL Server Management Studio (Tasks >) 中为结构(表、视图、存储过程等)和内容(表中包含的实际数据)创建数据库脚本; 生成脚本) 或使用第三方工具

otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool

或者您可以使用第三方工具,例如 Red-Gate 的 SQL 比较SQL 数据比较 在源和目标之间进行差异化",根据这些差异生成更新脚本,然后在目标平台上执行这些脚本;这适用于不同的 SQL Server 版本.

or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.

这篇关于无法打开数据库“xxx",因为它是版本 904的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆