extended-events

Capture Linked server queries using SQL Extended Events

混江龙づ霸主 提交于 2021-02-08 05:37:41
问题 I tried many event types but could not achieve logging for Linked server. I could figure out events for all other databases but no luck with linked server. Any suggestions ? 回答1: You can use the OLEDB_DATA_READ event to track queries to linked servers. If the results from this event are more verbose than you want, you may need to add filters to capture the the particular information that is needed. The following DDL creates this extended event and adjusting the options (i.e. FILENAME , MAX

Deadlock graph from Extended Events not showing

北战南征 提交于 2021-01-01 13:40:55
问题 I have this query which is from "Sql Server 2017 Query Performance Tuning"(a book). Code for the book can be found here: https://github.com/Apress/sql-server-2017-query-perf-tuning DECLARE @path NVARCHAR(260) --to retrieve the local path of system_health files SELECT @path = dosdlc.path FROM sys.dm_os_server_diagnostics_log_configurations AS dosdlc; SELECT @path = @path + N'system_health_*'; WITH fxd AS (SELECT CAST(fx.event_data AS XML) AS Event_Data FROM sys.fn_xe_file_target_read_file(

Deadlock graph from Extended Events not showing

喜欢而已 提交于 2021-01-01 13:35:14
问题 I have this query which is from "Sql Server 2017 Query Performance Tuning"(a book). Code for the book can be found here: https://github.com/Apress/sql-server-2017-query-perf-tuning DECLARE @path NVARCHAR(260) --to retrieve the local path of system_health files SELECT @path = dosdlc.path FROM sys.dm_os_server_diagnostics_log_configurations AS dosdlc; SELECT @path = @path + N'system_health_*'; WITH fxd AS (SELECT CAST(fx.event_data AS XML) AS Event_Data FROM sys.fn_xe_file_target_read_file(

How to filter a table name in Extended Events?

荒凉一梦 提交于 2019-12-25 04:45:29
问题 I created an Extended Event Session using a script with a Where clause in order to filter commands which refers to a table whose name is MySchema.MyTable: WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N'%MySchema.MyTbl%')) The problem is that the table can appear in one of the 4 following ways: MySchema.MyTable [MySchema].MyTable MySchema.[MyTable] [MySchema].[MyTable] I can create a long Where clause with al those options and the "Or" operator between them (a to find

SQL Query XML for Extended Events system table for Session object (not data file) in predicate_XML field

有些话、适合烂在心里 提交于 2019-12-25 01:29:37
问题 I am querying the system tables for Extended Events in SQL to get some data about the extended event itself, and I want to get the database that is set in the Extended Events when its created. if I run this query from system tables here: SELECT SESE.predicate_xml FROM sys.server_event_sessions SEV LEFT OUTER JOIN sys.server_event_session_fields SESF ON SEV.event_session_id = SESF.event_session_id LEFT OUTER JOIN sys.server_event_session_events SESE ON SEV.event_session_id = SESE.event_session

Extended event session on SQL Server 2014 to capture stored procedure calls and arguments passed

本秂侑毒 提交于 2019-12-23 23:18:04
问题 I have an application which generates certain reports while values are entered and generate button is clicked on an application. I know to which database this application is connecting, but don’t know which stored procedure is getting called. The database is having 100s of stored procedures. So I need to track which stored procedure is called and what arguments are passed while clicking each button on the application. Guys, please could you help me to create an extended event session which

Create Trigger to log SQL that affected table?

空扰寡人 提交于 2019-12-17 03:19:09
问题 I'm trying to find out what is updating the value of a column and i have very little knowledge of the application. At a quick glance I've noticed about 90% of the applications business logic is handled on the database. Needless to say the depth of SP's, functions, and triggers is crazy. I'd like to create a trigger on the table in question that will log the SQL that affected the table. What SQL could be used to grab the executed SQL in the context of the table being updated? Details: MS SQL

How to clear SQL Server Extended Events Event File

╄→гoц情女王★ 提交于 2019-12-12 11:21:48
问题 How to clear SQL Server extended events that are stored in a file? Background Where are the files for SQL Server Extended Events Event File target stored? I want to delete months worth of log files; but SQL Server doesn't tell me where the files are: 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. Attempt#3 I tried doing the single most obvious thing that any user interface

extended events blocked process report missing from sys.dm_xe_objects

柔情痞子 提交于 2019-12-02 16:41:21
问题 Trying to create SERVER EVENT SESSION to capture blocked_process_report & xml_deadlock_report events to a file for later analysis with the following statement; CREATE EVENT SESSION [blocked_process] ON SERVER ADD EVENT sqlserver.blocked_process_report( ACTION(sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.database_name)) , ADD EVENT sqlserver.xml_deadlock_report ( ACTION(sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.database_name)) ADD TARGET package0

extended events blocked process report missing from sys.dm_xe_objects

北战南征 提交于 2019-12-02 10:30:14
Trying to create SERVER EVENT SESSION to capture blocked_process_report & xml_deadlock_report events to a file for later analysis with the following statement; CREATE EVENT SESSION [blocked_process] ON SERVER ADD EVENT sqlserver.blocked_process_report( ACTION(sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.database_name)) , ADD EVENT sqlserver.xml_deadlock_report ( ACTION(sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.database_name)) ADD TARGET package0.asynchronous_file_target (SET filename = N'c:\temp\XEventSessions\blocked_process.xel', metadatafile = N'c: