开发者

Microsoft SQL Server 2005 Restore error .mdf-file

I tried to execute the following query:

RESTORE DATABASE TESTDB FROM DISK = <path of file> WITH REPLACE

The result was this execption:

The file 'c:\Program Files\Microsoft SQL

Server\MSSQL.1\MSSQL\DATA\BCS.mdf' cannot be overwritten. It is being used by database ' @databaseName '. File 'BCS' cannot be restored to 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\BCS.mdf'. Use WITH MOVE to identify a valid location for the file. The file 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\BCS_log.LDF' cannot be overwritten. It is being used by database ' @databaseName '. File 'BCS_log' cannot be restored to 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\BCS_log开发者_C百科.LDF'. Use WITH MOVE to identify a valid location for the file. Problems were identified while planning for the RESTORE statement. Previous messages provide details. RESTORE DATABASE is terminating abnormally.

The problem: BCS.mdf and BCS_log.LDF doesen't exist in the directory.


Does that directory exist - c:\program files\microsoft sql server\mssql.1\ data ?

This is a common problem when moving databases from one server to another via the backup method.... either create the directories required with the appropriate permissions, or use the WITH MOVE option as hinted.


if the backup file from difference computer, it may be get path for the last computer. you must set the path base on path on your local. or you can use back up and restore database wizard in sql server 2005.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜