您的位置:首页 > 数据库

不同SQL Server版本间的数据库恢复问题

2010-08-17 09:24 447 查看
在这里,我所指的版本是指的2000,2005,2008这样的版本区别,而不是企业版,开发版这样的版本区别.从官方的说法来看,SQL Server是允许数据库从低版本向高版本恢复,但不支持高版本向低版本的恢复,如果我们用高版本的数据库在低版本的数据库引擎下恢复,会出现什么错误描述呢?

数据库恢复一般是指两个层面的意思:一种方法是利用备份文件进行还原;一种方法是利用数据文件进行附加还原.

我们先来看备份还原的方式:

如果是用2005的数据库在2000下还原,会出现错误:

Msg 3205, Level 16, State 2, Line 1
Too many backup devices specified for backup or restore; only 64 are allowed.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

如果是用2008的数据库在2005下还原,会出现错误:

Msg 3241, Level 16, State 7, Line 1
The media family on device 'c:/xxx.bak' is incorrectly formed.
SQL Server cannot process this media family.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

接着我们来看附加还原的方式:

如果是用2005的数据库在2000下附加还原,会出现错误:

Msg 1813, Level 16, State 2, Line 1
Could not open new database 'xxx'. CREATE DATABASE is aborted.
Msg 602, Level 21, State 50, Line 1
Could not find row in sysindexes for database ID 7, object ID 1, index ID 1.
Run DBCC CHECKTABLE on sysindexes.

如果是用2008的数据库在2005下附加还原,会出现错误:

Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Test'. CREATE DATABASE is aborted.
Msg 948, Level 20, State 1, Line 1
The database 'Test' cannot be opened because it is version 655.
This server supports version 612 and earlier. A downgrade path is not supported.

实践也证明了官方的说法,其实一般很少有高版本的数据库导入到低版本的情况,如果确实需要这样做,建议采取以下步骤:

1:通过管理器的脚本生成向导,把数据库,表,存储过程等对象的脚本生成,然后在低版本的SQL Server下执行建立这些对象.

2:通过DTS/SSIS,将表中的数据导过去.

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/CN_SQL/archive/2008/10/16/3084864.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: