日期:2014-05-16 浏览次数:20663 次
???? sqlserver版本:2008? 某个数据库,在sqlserver 2008 r2?下创建 尝试将备份还原的别的机子上,均报如下错误:
?
?
执行 Transact-SQL 语句或批处理时发生了异常。 (Microsoft.SqlServer.ConnectionInfo)
------------------------------
其他信息:
在 "E:\XXXX.bak" 上读取失败: 38(已到文件结尾。) (Microsoft SQL Server,错误: 3203)
??? 搜了一下,在一篇博客上找到原因,大概是由于路径问题导致的.原文如下:
The Cause of the Problem is that the Drive in which your Source Data base files are located is not present in your server where you want to restore the database.
Please use the SQLCMD Promt and use the Manula RESTORE command with REPLACE and MOVE option .But before using the Restore command get the logical file name of your source database
syntax :
RESTORE DATABASE [TestServer28Sep2010] FROM DISK = 'C:\BackUp\TestServer28Sep2010.bak' WITH REPLACE , MOVE 'SourceLogicalFileName_Data' TO 'D:\JapanTestServerDB\TestServer28Sep2010.mdf', MOVE SourceLogicalFileName_log' TO 'D:\JapanTestServerDB\Server28Sep2010.ldf'
?
因此,请使用如下方法还原:
?????? 1. 从 cmd 进入 sqlcmd .
?????? 2. 输入 以下语句,再输入 go 即可执行:
?? RESTORE DATABASE 还原后的数据库名 FROM DISK = 'D:\yjdb\pms_yj_20110722.bak(备份文件)' WITH REPLACE , MOVE 'pms_yujia(曾经的mdf逻辑名)' TO 'D:\yjdb\pms_yujia.mdf(mdf还原后的路径)', MOVE 'pms_yujia_log(曾经的ldf逻辑名)' TO 'D:\yjdb\pms_yujia_log.ldf(ldf还原后的路径)'