如何清除SQL Server扩展事件事件文件 [英] How to clear SQL Server Extended Events Event File

查看:179
本文介绍了如何清除SQL Server扩展事件事件文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何清除存储在文件中的SQL Server 扩展事件?

How to clear SQL Server extended events that are stored in a file?

SQL Server扩展事件事件文件目标的文件存储在哪里?

Where are the files for SQL Server Extended Events Event File target stored?

我想删除价值数月的日志文件;但是SQL Server不会告诉我文件在哪里:

I want to delete months worth of log files; but SQL Server doesn't tell me where the files are:

我将遵循Microsoft SQL Server论坛上的建议:

I would follow the advice on Microsoft's SQL Server forums:

Clear events in file target?

Simply stop the session and delete .xel file if it’s no longer required.

尝试#3

我尝试做任何一件最显而易见的事情,即任何值得其用户赞扬的用户界面设计人员都会从一开始就创建:右键单击事件文件目标,然后选择:

I tried doing the single most obvious thing that any user interface designer worth their salt would have created from the beginning: Right-click the event file target, and select:

  • 清除
  • 删除
  • 清除

除了没有其他选择可以做这些显而易见的事情之外,

Except there is no option to do any of those obvious things:

尝试#4

我还尝试了进入扩展事件菜单,然后单击清除数据.但是该选项被莫名其妙地禁用:

I also tried going into the Extended Events menu, and clicking Clear Data. But the option is inexplicably disabled:

尝试#5

我还尝试编写扩展事件会话脚本,以查看其将文件存储在何处.但是,当然,SQL Server团队没有帮助:

I also tried to script the Extended Events Session, in order to see where it is storing the files. But of course SQL Server team is not helpful:

ADD TARGET package0.event_file(SET filename=N'Expensive Queries',max_file_size=(25),max_rollover_files=(4)),

尝试#6

在SQL Server Profiler中.如果要清除事件,请按按钮以清除事件:

In SQL Server Profiler. If you wanted to clear the events you pushed the button to clear the events:

不推荐使用SQL事件探查器,并且它的替代方法无法清除事件.

SQL Profiler is deprecated, and it's replacement provides no way to clear the events.

清除事件的方法是什么?

What is the way to clear the events?

  • Query to clear sql server logs over a certain age
  • Clear events in file target?
  • BOL: Targets for Extended Events in SQL Server
  • BOL: Event File Target

推荐答案

默认情况下,路径看起来应该是

By default the path seems like it would be

C:\Program Files\Microsoft SQL Server\MSSQLXX.MSSQLSERVER\MSSQL\Log\*.xel

或基本上是为SQL Server保存的系统文件的任何位置(即默认的ERRORLOG位置).如果没有任何内容,则可能是您的扩展事件设置为环形缓冲区,在这种情况下,仅保留最新信息并将其存储在内存中.在这种情况下,清除日志的唯一方法似乎是停止并启动会话.

or basically wherever the system files are kept for SQL Server (i.e. the default ERRORLOG location). If there is nothing there then it may be that your Extended Event is set to ring buffer in which case only the latest information is kept and it's stored in memory. Seems the only way to clear the log in this case would be to stop and start the session.

这篇关于如何清除SQL Server扩展事件事件文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆