简体   繁体   English

在SQL Server 2008 R2中使用.bak文件还原新数据库困难

[英]Difficulty restoring new database with .bak file in SQL Server 2008 R2

I have make a backup file from a database in SQL Server 2012. But I can't restore it in a new database in SQL Server 2008r2 with the .bak file. 我已经从SQL Server 2012中的数据库制作了一个备份文件。但是,我无法使用.bak文件将其还原到SQL Server 2008r2中的新数据库中。

It always returns a warning that cast is not valid(sqlmanager.ui). 它总是返回一个警告,提示强制类型转换无效(sqlmanager.ui)。

Is there any way to restore it? 有什么办法可以还原它?

You CANNOT do this - 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. 不能做到这一点-你不能安装/拆卸或备份/从SQL Server 新版本的下跌将数据库恢复到旧版本 -内部文件的结构实在是太不同的支持向后兼容性。

You can either get around this problem by 您可以通过以下方法解决此问题

  • using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances 在所有计算机上使用相同版本的SQL Server-然后您可以轻松地在实例之间备份/还原数据库

  • 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 否则,您可以在SQL Server Management Studio(“ Tasks > Generate Scripts )中或使用第三方为结构(表,视图,存储过程等)和内容(表中包含的实际数据)创建数据库脚本。工具

  • 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; 或者,您可以使用Red-Gate的SQL比较SQL数据比较之类的第三方工具在源和目标之间进行“区分”,根据这些差异生成更新脚本,然后在目标平台上执行这些脚本; this works across different SQL Server versions. 这适用于不同的SQL Server版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM