sql-server – 在Hyper-V中运行SQL Server时“等待操作超时”

我在Hyper-V实例上运行sql Server(2012).它拥有充足的资源和25%的资源总量,VHD放置在速度非常快的SSD驱动器上,可以快速响应.

每隔一段时间,当使用sql Server的应用程序暂时无法访问时,会出现错误“等待操作超时”.当重新加载或重试访问数据库时,它似乎已“被唤醒”并且一如既往地快速.

有没有办法确保在这种环境下不会出现这种软睡眠模式?

添加

异常详细信息:System.ComponentModel.Win32Exception:等待操作超时

解决方法

尝试执行此命令:

exec sp_updatestats

令人难以置信的是,它解决了这个问题.

在执行命令之前的代码上面的错误.

[Win32Exception (0x80004005): The wait operation timed out]

[sqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]
   System.Data.sqlClient.sqlConnection.OnError(sqlException exception,Boolean breakConnection,Action`1 wrapCloseInAction) +1742110
   System.Data.sqlClient.sqlInternalConnection.OnError(sqlException exception,Action`1 wrapCloseInAction) +5279619
   System.Data.sqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncclose) +242
   System.Data.sqlClient.TdsParser.TryRun(RunBehavior runBehavior,sqlCommand cmdHandler,sqlDataReader dataStream,BulkcopySimpleResultSet bulkcopyHandler,TdsParserStateObject stateObj,Boolean& dataReady) +1434
   System.Data.sqlClient.sqlDataReader.TryConsumeMetaData() +61
   System.Data.sqlClient.sqlDataReader.get_MetaData() +90
   System.Data.sqlClient.sqlCommand.FinishExecuteReader(sqlDataReader ds,RunBehavior runBehavior,String resetoptionsstring) +365
   System.Data.sqlClient.sqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,Boolean returnStream,Boolean async,Int32 timeout,Task& task,Boolean asyncWrite) +1355
   System.Data.sqlClient.sqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,String method,taskcompletionsource`1 completion,Boolean asyncWrite) +175
   System.Data.sqlClient.sqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,String method) +53
   System.Data.sqlClient.sqlCommand.ExecuteReader(CommandBehavior behavior,String method) +134
   System.Data.sqlClient.sqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,DataTable[] datatables,Int32 startRecord,Int32 maxRecords,String srcTable,IDbCommand command,CommandBehavior behavior) +140
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet,CommandBehavior behavior) +316
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet,String srcTable) +86
   System.Web.UI.WebControls.sqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1482
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments,DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +79
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterasyncPoint) +974

相关文章

Hyper-V上运行的Linux虚拟机验证是否安装了集成服务 ps aux|...
目录虚拟化介绍虚拟化厂商介绍微软虚拟化发展历程Hyper-v 3....
最近有win10系统用户在开启Hyper-V功能的时候发现无法启动...
Win10系统中的Hyper-V虚拟机组件可以让用户很方便的创建虚拟...
在Win10中使用Hyper-V来创建虚拟机很方便,下面小编就把Hype...
大家都知道Win10家庭版、中文版、普通版和专业版相比是缺少很...