将SQL 2008 DB备份还原到SQL 2005 DB,反之亦然 [英] restore a SQL 2008 DB backup to SQL 2005 DB and Vice versa

查看:88
本文介绍了将SQL 2008 DB备份还原到SQL 2005 DB,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过Microsoft.SqlServer.Management.Smo以这种方式从2台带有sql2005的计算机恢复了我的数据库:



i restored my databeses from 2 computers with sql2005 by Microsoft.SqlServer.Management.Smo in this way :

Server srv = new Server();
srv.ConnectionContext.ConnectionString = myConnectionString;
Restore rs = new Restore();
rs.NoRecovery = false;
rs.Action = RestoreActionType.Database;
rs.ReplaceDatabase = true;
BackupDeviceItem bdi = new BackupDeviceItem(strBackupFile + ".bak", DeviceType.File);
rs.Devices.Add(bdi);
rs.Database = DataBaseName;
rs.SqlRestore(srv);





但现在我在我的一台电脑上安装了sql2008,现在我可以''恢复

我的备份。



你有什么解决方案可以将SQL 2008数据库备份恢复到SQL 2005 DB吗?



but now i Instal sql2008 on one of my computers and now i can''t restore
my backup.

do you have any solution for restore a SQL 2008 DB backup to SQL 2005 DB?

推荐答案

您还可以将2005数据库附加到2008服务器。您从2008年到2005年的选择非常有限。我想到了脚本,链接服务器和SSIS。 Backup.restore不是其中之一
You can also attach the 2005 database to the 2008 server. Your choices for moving from 2008 to 2005 are very limited. Scripting, linked server and SSIS come to mind. Backup.restore is not one of them


主模式'是不同的。您无法将备份还原到早期版本。您唯一的选择是从较新版本导出所有内容并将其导入旧版本。 (假设您没有使用任何依赖于较新版本的东西)
Master schema''s are different. You cannot restore a backup to an earlier version. Your only option is to export everything from the newer version and import it in the older version. (Assuming you haven''t used anything which is dependent on the newer version)


无法在SQL Server 2005上恢复SQL Server 2008备份。它只是不起作用。



替代方法是从SQL Server 2008编写脚本数据库对象和数据库数据,然后在2005版本上执行这些脚本。请注意,您必须查看脚本并手动删除2005版本中不存在的所有对象类型,例如Geometry。



您可以做的另一件事是在2005版本上创建一个空数据库并使用 SQL Diff [ ^ ]和 SQL Data Diff [ ^ ]来自ApexSQL的工具(也可以使用其他工具)例如红门 [ ^ ])比较和同步SQL 2008备份和新创建的2005数据库。工具将自动处理上述所有问题。
It is not possible to restore SQL Server 2008 backup on SQL Server 2005. It just doesn’t work.

Alternative is to script database objects and database data from SQL Server 2008 and then execute those scripts on 2005 version. Note that you will have to review the scripts and manually remove all object types that don’t exist in 2005 version such as Geometry for example.

Another thing you can do is to create an empty database on 2005 version and use SQL Diff[^] and SQL Data Diff[^] tools from ApexSQL (also possible using other tools such as Red Gate[^] ) to compare and synchronize SQL 2008 backup and newly created 2005 database. Tools will take care of all issues mentioned above automatically.


这篇关于将SQL 2008 DB备份还原到SQL 2005 DB,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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