Microsoft SQL Server 2005 还原错误 .mdf 文件

发布于 2024-10-07 00:43:54 字数 729 浏览 0 评论 0原文

我尝试执行以下查询:

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

结果是这样的:

文件 'c:\Program Files\Microsoft SQL

服务器\MSSQL.1\MSSQL\DATA\BCS.mdf' 不能被覆盖。它正在 由数据库“@databaseName”使用。 文件“BCS”无法恢复 'c:\Program Files\Microsoft SQL 服务器\MSSQL.1\MSSQL\DATA\BCS.mdf'。 使用WITH MOVE来识别有效的 文件的位置。该文件 'c:\Program Files\Microsoft SQL 服务器\MSSQL.1\MSSQL\DATA\BCS_log.LDF' 不能被覆盖。它正在 由数据库“@databaseName”使用。 文件“BCS_log”无法恢复 'c:\Program Files\Microsoft SQL 服务器\MSSQL.1\MSSQL\DATA\BCS_log.LDF'。 使用WITH MOVE来识别有效的 文件的位置。问题是 在规划时确定 恢复语句。以前的消息 提供详细信息。恢复数据库是 异常终止。

问题:目录中不存在BCS.mdf和BCS_log.LDF。

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.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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太阳公公是暖光 2024-10-14 00:43:54

该目录是否存在 - c:\program files\microsoft sql server\mssql.1\ data ?

这是通过备份方法将数据库从一台服务器移动到另一台服务器时的常见问题......要么创建具有适当权限的所需目录,要么按照提示使用WITH MOVE选项。

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.

半窗疏影 2024-10-14 00:43:54

如果备份文件来自不同的计算机,则可能会获取最后一台计算机的路径。您必须根据本地路径设置路径。或者您可以使用 sql server 2005 中的备份和恢复数据库向导。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文