我可以将一个 .mdf 文件与多个 DBMS(SQL Server 2008 和 2012)一起使用吗? [英] Can I use one .mdf file with multiple DBMSes (SQL Server 2008 and 2012)?

查看:27
本文介绍了我可以将一个 .mdf 文件与多个 DBMS(SQL Server 2008 和 2012)一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在家里,我安装了 SQL Server 2008 R2 (Express),它附加到某个 .mdf 文件.我正在安装 SQL Server 2012(开发人员版).我可以将 2012 附加到同一个 .mdf 文件吗?从逻辑上讲,只要 SQL Server 的两个实例中只有一个正在运行,这似乎就可以工作.想法?

At home, I have SQL Server 2008 R2 (Express) installed which is attached to a certain .mdf file. I'm in the process of installing SQL Server 2012 (Developer Edition). Can I attach 2012 to the same .mdf file? Logically, it seems like this would work as long as only one of the two instances of SQL Server is running. Thoughts?

推荐答案

您可以向上 - 从旧版本到新版本,例如您可以在 2008 R2 中备份数据库并在 2012 实例中恢复该备份 - 但您不能从 SQL Server 的较新版本附加/分离或备份/恢复数据库一直到旧版本 - 内部文件结构差异太大,无法支持向后兼容性.

You can go upwards - from an older version to a newer one, e.g. you can backup your database in 2008 R2 and restore that backup in your 2012 instance - but you CANNOT attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility.

另外:由于 .mdf 的内部文件结构非常不同并且特定于每个 SQL Server 版本,您将不能能够使用相同的.mdf 来自两个不同的 SQL Server 版本.那肯定不行.

Also: since the internal file structures of the .mdf are very much different and specific to each version of SQL Server, you will NOT be able to use the same .mdf from two different SQL Server versions. That definitely won't work.

你可以通过

  • 在所有机器上使用相同版本的 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.

这篇关于我可以将一个 .mdf 文件与多个 DBMS(SQL Server 2008 和 2012)一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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