平时最常用的SQL Server数据库迁移的方法是backup&restore,步骤如下:
1. 用backup命令物理备份源数据库
2. 把备份文件传输到目标主机上
3. 用restore命令还原成目标数据库
但是今天在做一个SQL Server 数据库迁移时,当进行到第3步时出现以下错误:
Msg 3169, Level 16, State 1, Line 1
The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.4000. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
这个错误是因为源数据库的版本(10.50.1600)高于目标数据库版本(10.00.4000),所以不能用backup&restore的方法,为了避开数据库版本的问题,我使用以下方法:
1. 在源数据库中生成创建object的脚本,然后在目标数据库中应用这个脚本。
在源数据库端:右击源数据库=》Tasks=》Generate Script=》根据向导生产相应脚本,该脚本包含创建database,table,view,sp等的SQL语句;
注意:生产的SQL语句版本不得高于目标数据库的版本(SQL语句版本在"Set Scripting Options"页面“Advanced"里设置)。
接着在目标数据库端执行生产的SQL语句。
2. 用import/export把源数据库中的数据导入到目标数据库。
1. 用backup命令物理备份源数据库
2. 把备份文件传输到目标主机上
3. 用restore命令还原成目标数据库
但是今天在做一个SQL Server 数据库迁移时,当进行到第3步时出现以下错误:
Msg 3169, Level 16, State 1, Line 1
The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.4000. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
这个错误是因为源数据库的版本(10.50.1600)高于目标数据库版本(10.00.4000),所以不能用backup&restore的方法,为了避开数据库版本的问题,我使用以下方法:
1. 在源数据库中生成创建object的脚本,然后在目标数据库中应用这个脚本。
在源数据库端:右击源数据库=》Tasks=》Generate Script=》根据向导生产相应脚本,该脚本包含创建database,table,view,sp等的SQL语句;
注意:生产的SQL语句版本不得高于目标数据库的版本(SQL语句版本在"Set Scripting Options"页面“Advanced"里设置)。
接着在目标数据库端执行生产的SQL语句。
2. 用import/export把源数据库中的数据导入到目标数据库。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26277071/viewspace-708283/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26277071/viewspace-708283/