SQL Server 2005 Express (15GB) 的巨大错误日志
使用 SQL Server 2005 Express(在 XP 和 Server 2003 上观察到),我有时会在生产中收到巨大的错误日志文件: 文件 C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG 不断增长以填满磁盘(文件大小超过 15 GB)。
该文件不是事务日志,只是错误日志:SQL Server 的文本日志。
错误日志像这样开始:(似乎很正常)
2009-01-11 09:16:57.04 spid51 Starting up database 'SDomain'.
2009-01-11 10:04:34.21 spid21s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due
to some database maintenance or reconfigure operations.
2009-01-11 10:04:34.23 spid21s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to
some database maintenance or reconfigure operations.
2009-01-11 10:04:34.23 spid21s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due t
o some database maintenance or reconfigure operations.
2009-01-11 10:08:37.32 spid51 Starting up database 'SDomain'.
2009-01-11 10:56:55.48 spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due
to some database maintenance or reconfigure operations.
2009-01-11 10:56:55.49 spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to
some database maintenance or reconfigure operations.
2009-01-11 10:56:55.49 spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due t
o some database maintenance or reconfigure operations.
2009-01-11 11:00:07.51 spid51 Starting up database 'SDomain'.
2009-01-11 11:47:44.73 spid15s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due
to some database maintenance or reconfigure operations.
2009-01-11 11:47:44.74 spid15s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to
some database maintenance or reconfigure operations.
2009-01-11 11:47:44.74 spid15s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due t
o some database maintenance or reconfigure operations.
然后该文件似乎包含无限重复的行,如下所示:
2008-12-17 00:12:24.03 spid13s The log for database 'SDomain' is not available. Check the event log for related error messages. Resolve any errors and restart the database**
仅供参考,Windows事件日志包含完全相同的消息。
知道这个问题发生的原因吗? 难道是SQL Server配置的特殊问题? 或者是代码中的问题导致了这种情况?
With SQL Server 2005 Express (obeserved on XP and Server 2003), I get sometimes huge Error logs files in production:
The file C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG grows to fill the disk (file size becomes more than 15 GB).
This file is not the transaction log, just the error log : a text log for SQL Server.
The error log starts like this: (seems to be normal)
2009-01-11 09:16:57.04 spid51 Starting up database 'SDomain'.
2009-01-11 10:04:34.21 spid21s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due
to some database maintenance or reconfigure operations.
2009-01-11 10:04:34.23 spid21s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to
some database maintenance or reconfigure operations.
2009-01-11 10:04:34.23 spid21s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due t
o some database maintenance or reconfigure operations.
2009-01-11 10:08:37.32 spid51 Starting up database 'SDomain'.
2009-01-11 10:56:55.48 spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due
to some database maintenance or reconfigure operations.
2009-01-11 10:56:55.49 spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to
some database maintenance or reconfigure operations.
2009-01-11 10:56:55.49 spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due t
o some database maintenance or reconfigure operations.
2009-01-11 11:00:07.51 spid51 Starting up database 'SDomain'.
2009-01-11 11:47:44.73 spid15s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due
to some database maintenance or reconfigure operations.
2009-01-11 11:47:44.74 spid15s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to
some database maintenance or reconfigure operations.
2009-01-11 11:47:44.74 spid15s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due t
o some database maintenance or reconfigure operations.
Then the file seems to contain endlessly repeating lines like this:
2008-12-17 00:12:24.03 spid13s The log for database 'SDomain' is not available. Check the event log for related error messages. Resolve any errors and restart the database**
FYI, the windows eventlog contains exactly the same messages.
Any idea of the reason why this problem occurs? Could it be a particular issue of configuration of SQL Server? Or an issue in code causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您有一个名为 SDomain 的数据库,该数据库设置为自动关闭。 每当被访问时,它就被“启动”。 最近您或您附近的人删除或移动了数据库的 LDF 文件。 当访问 SDomdain 数据库的进程尝试打开它时,SQL Server 将在 ERRORLOG 中抱怨该问题。 将数据库还给它的 LDF,并且将停止抱怨。 执行
sp_cycle_errorlog
启动新的 ERRORLOG文件,以便您可以删除旧的文件。You have a database named SDomain that is set to auto-close. Whenever is accessed, it is 'started'. Recently you, or someone near you, deleted or moved the LDF file of the database. When the process that is accessing the SDomdain database is trying to open it, SQL Server will complain about the problem in the ERRORLOG. Give the database back its LDF and will stop complaining. Execute
sp_cycle_errorlog
to start a new ERRORLOG file so you can delete the old one.确保用户帐户 servername\SQLServer2005MSSQLUser$servername$SQLEXPRESS 具有对数据库所在目录的写访问权限。
Ensure user account servername\SQLServer2005MSSQLUser$servername$SQLEXPRESS has write access to the directory that your database is residing in.
也许这可以帮助? http://support.microsoft.com/kb/917828
Maybe this can help? http://support.microsoft.com/kb/917828
数据库开始自行恢复的常见原因有:
在此阶段您的数据库将不会响应任何用户请求。 只有恢复阶段完成后,用户才可以访问数据库。
要找出发生这种情况的原因,您可能需要检查 SQL Server 错误日志并找出在数据库开始恢复之前发现的内容。 任何致命错误或数据库恢复操作都将记录在 SQL Server ERRORLOG 中。
另请检查您的数据库是否启用了“自动关闭”选项。 如果这是真的,您需要关闭该选项,如下所示,
The common reasons why a database would start recovering on its own are:
During this phase your database will not respond to any user requests. Only once the recovery phase is complete will the database be accessible to users.
To find out why this happened you might want to check the SQL Server ERRORLOG and find out what find right before the recovery started on the database. Any fatal errors or database restore operations would be logged in the SQL Server ERRORLOG.
Also check if Auto Close option is enabled for your database. If thats true you need to turn off that option as follows,