数据库每隔几个小时就会有“恢复待定”状态
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数据库每隔几个小时就会有“恢复待定”状态相关的知识,希望对你有一定的参考价值。
我最近注意到我的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:inetpubx
Machine name: WIN-IV6CMBTUQ4N
Process information:
Process ID: 2400
Process name: w3wp.exe
Account name: IIS APPPOOLx
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 APPPOOLx
Thread information:
Thread ID: 14
Thread account name: IIS APPPOOLx
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有问题,所以它不应该与数据库有任何直接关系,但那里没有任何其他错误/警告。
我在这里错过了什么吗?
谢谢!
答案
您是否在数据库上启用了“自动关闭”功能?
最佳做法是关闭它
ALTER DATABASE <mydb> SET AUTO_CLOSE OFF
我也在那里检查AUTO_SHRINK
以上是关于数据库每隔几个小时就会有“恢复待定”状态的主要内容,如果未能解决你的问题,请参考以下文章
如何安排代码在 Elixir 或 Phoenix 框架中每隔几个小时运行一次?
WIN7任务栏每隔几十秒就会有一个相机和齿轮状标志的图标闪过导致游戏画面最小化,怎么回事?