需要帮助解决错误 [英] Need help in solving the error

查看:82
本文介绍了需要帮助解决错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



恢复数据库时我收到以下错误



 文件 '  C:\无法覆盖Program Files \ Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER \ MSSQL \DATA\project_blank_blank.mdf'。使用   数据库 '  project_blank_blank'
文件 ' project_blank_blank'无法恢复 ' C:\Program Files \\ \\ Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER \ MSSQL \DATA\project_blank_blank.mdf'使用 WITH MOVE 标识有效位置 file
文件 ' C:\Program无法覆盖Files \ Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER \ MSSQL \DATA\project_blank_blank_log.LDF'。使用 数据库 ' project_blank_blank'
文件 ' project_blank_blank_log'无法恢复 ' C:\Program Files \\ \\ Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER \ MSSQL \DATA\project_blank_blank_log.LDF'使用 WITH MOVE 标识有效位置 file
已确定问题规划 RESTORE 声明。以前的消息提供详情。
RESTORE DATABASE 终止异常。
已将数据库上下文更改为 ' master'





这是我的恢复查询



 Dim str  As 新的SqlCommand(  使用master; RESTORE DATABASE& txtCompanyCode。 Text &   FROM disk ='& dest&  ',con)





请帮帮我..

解决方案

在旧的连接挂起之前,你无法恢复数据库。

如果你是管理员,你可以通过Management Studio或代码关闭这些打开的连接。


除了解决方案1中提出的建议外,没有其他解决方案。



这是有意义的, SQL Server 如何执行在某些应用程序或服务中使用数据库时,还原操作



如果让我们假设如果它允许这样,那么很明显你的恢复数据库可能会被破坏或无法正常运行。

Hi all

While restoring the database i am getting the below error

The file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\project_blank_blank.mdf' cannot be overwritten.  It is being used by database 'project_blank_blank'.
File 'project_blank_blank' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\project_blank_blank.mdf'. Use WITH MOVE to identify a valid location for the file.
The file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\project_blank_blank_log.LDF' cannot be overwritten.  It is being used by database 'project_blank_blank'.
File 'project_blank_blank_log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\project_blank_blank_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.
Changed database context to 'master'.



this is my restore query

Dim str As New SqlCommand("use master; RESTORE DATABASE " & txtCompanyCode.Text & " FROM disk='" & dest & "'", con)



Please help me out..

解决方案

You cannot restore a database till there are connections pending with the old one.
If you are the administrator, you can close these open connections through Management Studio or through code.


There could be no other solution except as proposed in Solution 1.

And it make sense, how can the SQL Server perform a Restore operation while the database is being used in some application or service?

If let''s suppose that if it allows like this then obviously chances are there that your restored database might be get corrupted or will not function properly.


这篇关于需要帮助解决错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆