开发者

Monitor SELECT statements with ETW and EVENT SESSION

开发者 https://www.devze.com 2023-04-01 19:54 出处:网络
I am currently working with ETW on SQL Server 2008 to monitor (and eventually log) SQL statement execution. The events that I am looking to monitor are stored proc execution, INSERT, UPDATE, DELETE an

I am currently working with ETW on SQL Server 2008 to monitor (and eventually log) SQL statement execution. The events that I am looking to monitor are stored proc execution, INSERT, UPDATE, DELETE and... SELECT statements.

I am able to monitor the SPs, INSERT, UPDATE and DELETE by creating an EVENT SESSION with the following events:

  • sqlserver.sp_statement_completed
  • sqlserver.sp_statement_starting
  • sqlserver.sql_statement_completed
  • sqlserver.sql_statement_starting

I also include an action with each event to add the actual SQL statement to the event: sqlserver.sql_text

My session basically looks something like this:

CREATE EVENT SESSION SomeTestEventSession ON SERVER
ADD EVENT sqlserver.sp_statement_completed (ACTION (sqlserver.sql_text) WHERE sqlserver.database_id >开发者_运维知识库 4),
(...)

What event should I add to the ones above to monitor simple SELECT statements on my database? I am aware this will create a lot of activity, but once I can monitor the statements, I will try to fine tune the beast by adding some filtering actions to reduce the actual number of logged events.

Thanks in advance!


All, I must have overlooked something, because it seems the sql_statement_completed does monitor the SELECT statements.

0

精彩评论

暂无评论...
验证码 换一张
取 消