通过asp.net代码恢复sql数据库的备份 [英] restore backup of sql database through asp.net code

查看:171
本文介绍了通过asp.net代码恢复sql数据库的备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我必须还原我的sql数据库的bachup.
为此,我正在使用存储过程

hello all

i have to restore the bachup of my sql database.
for this i am using a store procedure

alter database dbTraDesk set offline with rollback immediate
RESTORE DATABASE [dbTraDesk] FROM  DISK = N'D:\dbTraDesk.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
alter database dbTraDesk set online with rollback immediate



但是当执行查询时,它给出了异常



but when query is executed it is giving exception as

Could not find database ID 7, name 'dbTraDesk'. The database may be offline. Wait a few minutes and try again.
Nonqualified transactions are being rolled back. Estimated rollback completion: 100%.
Failed to restart the current database. The current database is switched to master.


并且现有数据库脱机.

谁能为我提供解决方案.

谢谢.


and existing database goes offline.

can anyone Please provide me solution for this.

Thanks.

推荐答案

希望 ^ ]文章可能会对您有所帮助.
Hope this[^] article might help you.


这篇关于通过asp.net代码恢复sql数据库的备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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