数据库有"恢复待定"状态每隔几个小时

时间:2018-04-11 07:59:31

标签: asp.net sql-server iis sql-server-2016

我最近注意到我的SQL Server上的大多数数据库在运行几个小时后(有时是6个,有时甚至更多)获得了 Recovery Pending 状态。我无法想象这是预期的结果,所以我决定在这里发布它。

我打开了事件日志查看器,并决定查找有关正在进行的更多信息。似乎我的所有数据库都是"启动"每隔几分钟左右(可以看到here)。其中一些连续多次启动。这应该是那样的吗?

在滚动了一下之后,我从我的一个IIS网站找到了this warning

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 4/11/2018 9:32:05 AM 
Event time (UTC): 4/11/2018 7:32:05 AM 
Event ID: 7911bb726cd34d36941e8232ad78b059 
Event sequence: 18 
Event occurrence: 3 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/5/ROOT-1-131679051910980983 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\x\ 
    Machine name: WIN-IV6CMBTUQ4N 

Process information: 
    Process ID: 2400 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\x

Exception information: 
    Exception type: HttpException 
    Exception message: The remote host closed the connection. The error code is 0x80070057.
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write(ArraySegment`1 data)
at Microsoft.AspNet.SignalR.Hosting.ResponseExtensions.End(IResponse response, String data)
at Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners`2.<>c__DisplayClass2_0.<RunTask>b__0(Task t)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)



Request information: 
    Request URL: http://91.134.116.40:8003/signalr/start?clientProtocol=1.4&transport=webSockets&connectionData=[{"Name":"ChatHub"}]&connectionToken=/y39a+1XOv/u7X/ZFYw5ACLQu58FVNl0hbkMwPHCw1EQ9gdCbpFxPQzPuJVDxRywoP2AaI6akuXxQIxM2Wwa0OLO4cWd/e3csUBetjb9nROsisQnavw52ulTHWVOjK/j&user=User-14D 
    Request path: /signalr/start 
    User host address: 24.13.101.142 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: IIS APPPOOL\x

Thread information: 
    Thread ID: 14 
    Thread account name: IIS APPPOOL\x
    Is impersonating: False 
    Stack trace:    at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write(ArraySegment`1 data)
at Microsoft.AspNet.SignalR.Hosting.ResponseExtensions.End(IResponse response, String data)
at Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners`2.<>c__DisplayClass2_0.<RunTask>b__0(Task t)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Custom event details: 

似乎SignalR有问题,所以它不应该与数据库有任何直接关系,但那里没有任何其他错误/警告。

我在这里错过了什么吗?

谢谢!

1 个答案:

答案 0 :(得分:2)

你有&#34;自动关闭&#34;在数据库上启用了吗?

最佳做法是将其关闭

ALTER DATABASE <mydb> SET AUTO_CLOSE OFF

我在那里时也会检查AUTO_SHRINK