管理 Sql Server 2005 上的跟踪文件
我需要管理 Sql Server 2005 Express Edition 上数据库的跟踪文件。数据库的 C2 审核日志记录已打开,它创建的文件正在占用大量空间。
这可以从 Sql Server 内部完成吗?或者我是否需要编写一个服务来监视这些文件并采取适当的操作?
我找到了带有跟踪文件属性的 [master].[sys].[trace] 表。有谁知道这个表中字段的含义吗?
I need to manage the trace files for a database on Sql Server 2005 Express Edition. The C2 audit logging is turned on for the database, and the files that it's creating are eating up a lot of space.
Can this be done from within Sql Server, or do I need to write a service to monitor these files and take the appropriate actions?
I found the [master].[sys].[trace] table with the trace file properties. Does anyone know the meaning of the fields in this table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我想出的在控制台应用程序中运行得很好的方法:
Here's what I came up with that is working pretty good from a console application:
您还可以设置 SQL 跟踪以记录到 SQL 表。然后,您可以设置 SQL 代理任务来自动截断记录。
You can also set up SQL Trace to log to a SQL table. Then you can set up a SQL Agent task to auto-truncate records.
sys.traces 记录了服务器上启动的每个跟踪。由于 SQL Express 没有代理并且无法设置作业,因此您需要外部进程或服务来监视这些作业。您必须自行实施所有内容(监控、归档、跟踪保留策略等)。如果您实施了 C2 审计,我假设您已制定政策来确定必须保留审计的持续时间。
sys.traces has a record for every trace started on the server. Since SQL Express does not have Agent and cannot set up jobs, you'll need an external process or service to monitor these. You'll have to roll your own everything (monitoring, archiving, trace retention policy etc). If you have C2 audit in place, I assume you have policies in place that determine the duration audit has to be retained.