简体   繁体   English

'执行超时已过期。 在操作完成之前超时时间已过或服务器没有响应。

[英]'Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.'

I want to restore database from selected drive but each time it throws the following exception我想从选定的驱动器恢复数据库,但每次它抛出以下异常

Execution Timeout Expired.执行超时已过期。 The timeout period elapsed prior to completion of the operation or the server is not responding.在操作完成之前超时时间已过或服务器没有响应。

But this is only for a specific database when I tried to restore another one then its worked perfectly.但这仅适用于特定数据库,当我尝试恢复另一个数据库时,它工作得很好。
Can anyone help me out please.谁能帮帮我。
Following code I have used以下代码我使用过

openFileDialog1.ShowDialog();
query("IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = '" + cmbDatabaseName.Text + "') DROP DATABASE " + cmbDatabaseName.Text + " RESTORE DATABASE " + cmbDatabaseName.Text + " FROM DISK = '" + openFileDialog1.FileName + "'");
lbmsg.Visible = true;
lbmsg.Text = "Database Backup file has been restore successfully";

You problem is DROP DATABASE because there must be some connections to it.你的问题是 DROP DATABASE 因为它必须有一些连接。 Put this command into your code: ALTER DATABASE将此命令放入您的代码中: ALTER DATABASE

query("    
            IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = '" + cmbDatabaseName.Text + "'); 
            ALTER DATABASE " + cmbDatabaseName.Text + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
            DROP DATABASE " + cmbDatabaseName.Text + "; 
            RESTORE DATABASE " + cmbDatabaseName.Text + " FROM DISK = '" + openFileDialog1.FileName + "';
");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 超时已过。 在操作完成之前超时时间已过或服务器没有响应。 该语句已终止 - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated 超时时间已到。 在操作完成之前超时或服务器没有响应。 在远程Windows .net上工作 - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. working on remote windows .net Linq Count() 超时 - 执行超时已过期。 操作完成前超时时间已过或服务器未响应 - Linq Count() timing out -Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding 超时已过。 操作完成前超时时间已过或服务器未响应。 从数据库中获取记录时 - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. While fetching records from database SQL Server异常:超时已过期。 操作完成之前经过的超时时间或服务器未响应 - SQL Server Exception:Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding ExecuteQueryin linq:超时已过期。 操作完成之前经过的超时时间或服务器没有响应 - ExecuteQueryin linq :Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding 超时时间已到。 操作完成之前经过的超时时间或服务器未响应 - Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding 超时时间已到。 操作完成之前经过的超时时间或服务器未响应 - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding 在sis中执行软件包会导致超时过期。 操作完成之前经过的超时时间或服务器未响应 - Execute package in ssis causes Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding 超时已过。 操作完成前超时时间已过或服务器未响应 - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM