还原数据库时出现此错误 [英] Getting this error when restore the database

查看:173
本文介绍了还原数据库时出现此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还原无法处理数据库"bw",因为它正在使用中
通过本届会议.建议主数据库
在执行此操作时使用.
恢复数据库异常终止


注意:这里的"bw"是我的数据库名称.

restore cannot process database ''bw'' because it is in use
by this session. It is recommended that the master database
be used when performing this operation.
restore database is terminating abnormally


Note: Here ''bw'' is my DB name.,

推荐答案

尝试在master数据库中运行还原操作.看起来您在运行还原操作时已选择"BW"数据库.

下面的命令将选择主数据库,然后您可以执行restore数据库命令.
Try to run your restore operation in master database. It looks like you have selected the "BW" database while running the restore operation.

The below command will select the master database and then you can execute the restore database command.
USE Master


尝试为您的恢复添加前缀:
Try prefixing your restore with:
USE MASTER
GO
<your restore statements>

目前,我怀疑您正在要还原的数据库上打开一个新的查询窗口,该窗口将放置一个隐式

At present, I suspect that you are opening a new query window on the DB you want to restore which will put an implicit

USE BW
GO

.
如果正在使用该数据库,则无法将其还原到该数据库.

in front of the query.
If the DB is in use, it cannot be restored to.


请尝试使用SMO方法:
SQL Server 2008-使用SMO备份和还原数据库 [ ^ ]

更详细的示例:
http://www.mssqltips.com/sqlservertip /1849/backup-and-restore-sql-server-databases-programmatically-with-smo/ [
Try SMO way of doing this:
SQL Server 2008 - Backup and Restore Databases using SMO[^]

More detailed examples:
http://www.mssqltips.com/sqlservertip/1849/backup-and-restore-sql-server-databases-programmatically-with-smo/[^]

Note:*****Yes! you have dependancy on MS SQL Server(definitely) if you choose to do this way.


这篇关于还原数据库时出现此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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