由于工作需要,决定深入研究SQL Server的扩展事件(Extended Events/xEvents),经过资料搜索,发现国外大牛的系列文章,作为“学习”阶段,我先翻译这系列文章,后续在工作中的心得作为原创添加。原文地址:Stairway to SQL Server Extended Events ,由于英语水平有限,如认为看原文更好,可以自行查阅。另外,在翻译过程中,我会适当增加一些自己的看法或者删除作者的某些我认为不重要、不影响学习的内容,所以不是纯粹的直译。
本系列目前包含4篇文章:第一篇即本文
SQL Server 扩展事件(Extented Events)从入门到进阶(1)——从SQL Trace到Extented Events SQL Server 扩展事件(Extented Events)从入门到进阶(2)——在GUI中创建基础扩展事件 SQL Server 扩展事件(Extented Events)从入门到进阶(3)——通过界面操作Extented Event SQL Server 扩展事件(Extented Events)从入门到进阶(4)——扩展事件引擎——基本概念 下面开始第一篇文章:从SQL Trace到Extented Events
前言:
扩展事件(Extended Events/xEvents)作为旨在替代SQL Trace(跟踪)的一个重要功能而从SQL Server 2008开始引入。但是在SQL 2008中并没有GUI界面可供操作,使得这个功能并没有被广泛应用。直到SQL Server 2012才出现在SSMS(SQL Server Management Studio)中,也就是说不需要再使用XQuery来解析XML事件结果。从那时开始,DBA和开发人员才真正开始尝试把SQL Trace和Profiler中替换成扩展事件。 本系列将详细探讨扩展事件作为一个诊断SQL Server性能问题、收集辅助数据的工具的相关内容。第一节是从很多DBA所熟悉的常用工具——SQL Trace开始,介绍如何用SQL Trace追踪和调查长运行语句(long-running queries)。并以此为基础,展示如何使用扩展事件,用不同的方式完成同一个任务。 扩展事件其实是为了替代SQL Trace和Profiler。通过这个系列,你可以看到如何使用扩展事件实现过去使用SQL Trace这种高开销、或者使用困难,甚至完成不了的技术所实现不了的情况和任务。 由于微软决心用扩展事件替代SQL Trace和Profiler,所以这个从1998年SQL Server 7.0发布的功能,将不再得到改进和增强,所以在后续版本中,读者应该增强扩展事件的学习和研究。
什么是扩展事件?
扩展事件(Extended Events/xEvents)是从SQL Server 2008开始引入的一套新的事件收集基础架构。通过扩展事件,可以收集和分析关于在SQL Server实例和数据库中发生的各种类型的事件诊断数据。扩展事件是SQL OS的一部分,由多个模块组成并作为SQL Server启动时被作为加载内容被加载进去。它对SQL Trace可监控的事件进行了大量的扩展、提高。 总得来说:扩展事件是从SQL 2008开始引入的,高度扩展性能监控和故障侦测的工具,用于替代从SQL 2012开始不建议使用的SQL Trace。其轻量级、事件丰富,可低成本地满足很多在SQL Trace中实现不了或者代价很高的任务。 从微软决定用扩展事件替代SQL Trace开始,就直接从头做起,重新设计事件收集的体系架构。这个体系的其中一个目标就是:高度可扩展性,允许简单地按需添加新的事件。同时微软也对扩展事件添加了对SQL Server新特性的支持,如Availability Groups、In-Memory OLTP和列存储索引,可以通过扩展事件来跟踪这些功能的性能及故障。对于SQL 2012及以上版本,使用扩展事件跟踪极其重要,因为这些功能的事件仅可用于Extented Events。 下表列出了主要SQL Server版本中的可用事件数。同时在下面这些版本中,SQL Trace仅仅只有180个事件。扩展事件对SQL Trace所提供的事件完全覆盖,虽然不是严格的一一对应:
SQL Server版本 事件数量 备注 2008 SP3 253 2008 R2 SP2 262 2012 SP3 646 覆盖所有SQL Trace中的可用事件 2014 870 874 874 v.12.0.2402 v.12.0.4100 v.12.0.4427
另外一个设计目标就是:尽可能低成本地收集事件数据。也就是说在侦测问题时,减少所需的额外资源开销(每个操作必然增加开销,只是多还是少的问题)。扩展事件通过下面几个方式实现这个目标,在后面文章中会详细讨论: 降低每个事件的默认装载量——默认情况下,每个事件只收集最小数量的事件数据列。如果你需要收集更多的列信息,必须显式添加这些到事件中。相对来说,SQL Trace会收集大量默认数据(即装载量很大),然后再由用户进行过滤。 强大的预过滤功能——通过限定,扩展事件提供了细粒度过滤,所以我们只收集符合特定标准的数据。可以通过谓词去收集某些事件,比如每隔15次出现的事件,或者收集特定情况下才会出现的事件,如当数据列的值(如持续时间,Duration)超过之前的最大值时的数据。最重要的是,扩展事件的限定功能发生在事件触发之前,也就避免了高负载的收集,从而避免了收集不必要数据的整体负载。 改进目标(Advanced targets)——和内存内(ring_buffer)和文件系统(event_file)目标一样,类似于SQL Trace的功能,扩展事件提供改进目标,根据特定条件“预聚合(pre-aggregate)”数据。 上面内容说明,即使我们定义了相对复杂的事件会话收集大量事件数据,也可以通过合理的限定词和目标采集数据的筛选来最小化服务器上的负载压力。 简而言之,大量的可用事件内容,搭配强大的筛选功能和丰富的数据收集功能,使得扩展事件远远优于Trace。
从熟悉的功能开始:SQL Trace
就个人的经验(作者)而言,最简单的方式之一就是在你已知的内容基础上再扩展。所以这里从你熟悉的SQL Trace和Profiler为基础开始切入,以便了解扩展事件是如何工作的及其与SQL Trace/Profiler的区别。 很多数据专家的常见工作就是处理性能低下的SQL语句。传统方式下,我们需要创建一个Trace获取存储过程或查询相关的事件数据。可能还会对跟踪设置过滤条件捕获那些超过特定读数量或特定运行事件或者消耗最多CPU的查询。 通常第一步是打开Profiler(可以理解为Trace的GUI)定义一个跟踪。我们可以新建跟踪或者使用已经设置的跟踪模版,连到特定实例,然后选择所需的事件,如下图,我们这里仅选择两个事件,RPC:Completed和SQL:StmtCompleted,每个事件都获取相同的数据列:(注:译者使用SQL 2014作为演示)
当使用Profiler或SQL Trace时,都应该添加过滤条件。其中一个在xEvents中被解决的但在SQL Trace中存在的问题,就是延后过滤(late filtering)。当在SQL Trace中定义过滤条件时,SQL Trace/Profiler依旧把实例上的所有相关事件的数据都收集起来,然后才进行过滤筛选。可见它在收集过程中依旧产生很大的量,但是即便如此,添加过滤条件也可以大大减少返回给客户端或文件的结果集。 在本例中,我们选择逻辑读大于等于10000的,如下图:
设置完事件、所需列、过滤条件之后,Trace文件已经算配置完毕。有经验的DBA和开发人员都知道使用Profiler会带来明显的性能问题(可以看这篇文章:当您使用 SQL 事件探查器实例中执行客户端跟踪的事件的 SQL Server 实例的执行速度很慢 ),因此,为了最小化对生产环境的影响。最好的方式是生成脚本然后以服务器端跟踪形式替代GUI形式,如下图:
生成的脚本大概如下: [sql] view plain copy 在CODE上查看代码片派生到我的代码片 /****************************************************/ /* Created by: SQL Server 2014 Profiler */ /* Date: 2016/12/05 15:36:16 */ /****************************************************/ -- Create a Queue declare @rc int declare @TraceID int declare @maxfilesize bigint set @maxfilesize = 5 -- Please replace the text InsertFileNameHere, with an appropriate -- filename prefixed by a path, e.g., c:\MyFolder\MyTrace. The .trc extension -- will be appended to the filename automatically. If you are writing from -- remote server to local drive, please use UNC path and make sure server has -- write access to your network share exec @rc = sp_trace_create @TraceID output, 0, N'InsertFileNameHere', @maxfilesize, NULL if (@rc != 0) goto error -- Client side File and Table cannot be scripted -- Set the events declare @on bit set @on = 1 exec sp_trace_setevent @TraceID, 10, 1, @on exec sp_trace_setevent @TraceID, 10, 9, @on exec sp_trace_setevent @TraceID, 10, 2, @on exec sp_trace_setevent @TraceID, 10, 10, @on exec sp_trace_setevent @TraceID, 10, 6, @on exec sp_trace_setevent @TraceID, 10, 11, @on exec sp_trace_setevent @TraceID, 10, 12, @on exec sp_trace_setevent @TraceID, 10, 13, @on exec sp_trace_setevent @TraceID, 10, 14, @on exec sp_trace_setevent @TraceID, 10, 15, @on exec sp_trace_setevent @TraceID, 10, 16, @on exec sp_trace_setevent @TraceID, 10, 17, @on exec sp_trace_setevent @TraceID, 10, 18, @on exec sp_trace_setevent @TraceID, 12, 1, @on exec sp_trace_setevent @TraceID, 12, 9, @on exec sp_trace_setevent @TraceID, 12, 11, @on exec sp_trace_setevent @TraceID, 12, 6, @on exec sp_trace_setevent @TraceID, 12, 10, @on exec sp_trace_setevent @TraceID, 12, 12, @on exec sp_trace_setevent @TraceID, 12, 13, @on exec sp_trace_setevent @TraceID, 12, 14, @on exec sp_trace_setevent @TraceID, 12, 15, @on exec sp_trace_setevent @TraceID, 12, 16, @on exec sp_trace_setevent @TraceID, 12, 17, @on exec sp_trace_setevent @TraceID, 12, 18, @on -- Set the Filters declare @intfilter int declare @bigintfilter bigint exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - 358151fc-d46a-40df-b18d-bc242e301373' set @bigintfilter = 10000 exec sp_trace_setfilter @TraceID, 16, 0, 4, @bigintfilter -- Set the trace status to start exec sp_trace_setstatus @TraceID, 1 -- display trace id for future references select TraceID=@TraceID goto finish error: select ErrorCode=@rc finish: go
下面我们快速浏览这段代码。初始化部分调用sp_trace_create存储过程,创建trace定义。这里需要手动定义@maxfilesize的值,默认是5MB。同时可以定时是否允许滚动更新。关于sp_trace_create的详细说明可以访问:sp_trace_create (Transact-SQL) 输出文件的路径也需要手动指定,在运行脚本之前,替换 N'InsertFileNameHere' 使用合适的文件路径,比如C:\temp\ReadsFilter_trace。注意脚本的注释部分,在文件名中不要包含.trc! -- Create a Queue DECLARE @rc INT DECLARE @TraceID INT DECLARE @maxfilesize BIGINT SET @maxfilesize = 5
-- Please replace the text InsertFileNameHere, with an appropriate -- filename prefixed by a path, e.g., c:\MyFolder\MyTrace. The .trc extension -- will be appended to the filename automatically. If you are writing from -- remote server to local drive, please use UNC path and make sure server has -- write access to your network share
EXEC @rc = sp_trace_create @TraceID OUTPUT, 0, N'InsertFileNameHere', @maxfilesize, NULL IF ( @rc != 0 ) GOTO error 当你开始运行脚本后,这个跟踪需要手动停止或者SQL 服务关闭、重启,否则会一直运行。作为应对措施,可以对sp_trace_create中的@DateTime输入一个特定值来限定运行的结束事件。比如@DateTime = dateadd(hh,1,getdate())使跟踪只运行一小时。 第二部分是对收集事件的定义。这些事件定义不直观,可以借助sp_trace_setevent (Transact-SQL) 来查看对应的事件和列名,下面是手动加上去的注释: -- Set the events declare @on bit set @on = 1 exec sp_trace_setevent @TraceID, 10, 10, @on --RPC:Completed, AppName exec sp_trace_setevent @TraceID, 10, 3, @on --RPC:Completed, DatabaseID exec sp_trace_setevent @TraceID, 10, 12, @on --RPC:Completed, SPID exec sp_trace_setevent @TraceID, 10, 13, @on --RPC:Completed, Duration exec sp_trace_setevent @TraceID, 10, 14, @on --RPC:Completed, StartTime exec sp_trace_setevent @TraceID, 10, 15, @on --RPC:Completed, EndTime exec sp_trace_setevent @TraceID, 10, 16, @on --RPC:Completed, Reads exec sp_trace_setevent @TraceID, 10, 18, @on --RPC:Completed, CPU exec sp_trace_setevent @TraceID, 10, 26, @on --RPC:Completed, ServerName exec sp_trace_setevent @TraceID, 41, 3, @on --SQL:StmtCompleted, DatabaseID exec sp_trace_setevent @TraceID, 41, 10, @on --SQL:StmtCompleted, AppName exec sp_trace_setevent @TraceID, 41, 12, @on --SQL:StmtCompleted, SPID exec sp_trace_setevent @TraceID, 41, 13, @on --SQL:StmtCompleted, Duration exec sp_trace_setevent @TraceID, 41, 14, @on --SQL:StmtCompleted, StartTime exec sp_trace_setevent @TraceID, 41, 15, @on --SQL:StmtCompleted, EndTime exec sp_trace_setevent @TraceID, 41, 16, @on --SQL:StmtCompleted, Reads exec sp_trace_setevent @TraceID, 41, 18, @on --SQL:StmtCompleted, CPU exec sp_trace_setevent @TraceID, 41, 26, @on --SQL:StmtCompleted, ServerName exec sp_trace_setevent @TraceID, 41, 61, @on --SQL:StmtCompleted, Offset 在数据库引擎内部,trace controller会检查事件是否被捕获(前提是不属于默认跟踪,default trace)。如果是,trace controller就捕获这些事件,然后把结果输出到Profiler或者文件中。在输出之前,trace controller会把未被选中的列移除。比如前面定义的事件中,没有选择DatabaseName,但是SQL Server默认依旧会捕获所有事件的DatabaseName。 最后一步,代码使用sp_trace_setfilter(http://msdn.microsoft.com/zh-cn/library/ms174404.aspx)。第一个sp_trace_setfilter默认都存在,意味着去除所有由Profiler GUI界面产生的'admin'查询(如SELECT SERVERPROPERTY等): [sql] view plain copy 在CODE上查看代码片派生到我的代码片 exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - 358151fc-d46a-40df-b18d-bc242e301373' 但是后面那一串数字会不一样。在这个例子中,我们仅仅过滤了逻辑读大于等于10000的事件内容(@bigintfilter = 10000)。再次提醒,这些过滤是在提交前而不是在收集前发生的。 -- Set the Filters DECLARE @intfilter INT DECLARE @bigintfilter BIGINT
EXEC sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - f45d52c9-c0eb-45da-8bae-dc6f1a945251' SET @bigintfilter = 10000 EXEC sp_trace_setfilter @TraceID, 16, 0, 4, @bigintfilter 代码的最后部分使用sp_trace_setstatus(http://msdn.microsoft.com/zh-cn/library/ms176034.aspx)开始跟踪,并显示跟踪ID(TraceID),对于服务器当前跟踪而言,TraceID都是唯一的。 -- Set the trace status to start EXEC sp_trace_setstatus @TraceID, 1
-- display trace id for future references SELECT TraceID = @TraceID GOTO finish
error: SELECT ErrorCode = @rc
finish: go 当你运行脚本之后,跟踪会开始收集数据直到达到停止条件位置。 那么下面一部分就是开始如何用扩展事件来替代了。
把跟踪替换成扩展事件事件会话:
在这里,我(作者)选择使用T-SQL来定义扩展事件,并且使用另外一位专家编写的封装脚本:sp_SQLskills_ConvertTraceToExtendedEvents下载地址如下:https://www.sqlskills.com/blogs/jonathan/converting-sql-trace-to-extended-events-in-sql-server-2012/ [sql] view plain copy 在CODE上查看代码片派生到我的代码片 USE [master] GO IF OBJECT_ID('sp_SQLskills_ConvertTraceToExtendedEvents') IS NOT NULL DROP PROCEDURE sp_SQLskills_ConvertTraceToExtendedEvents; GO /***************************************************************************** * FileName: sp_SQLskills_ConvertTraceToExtendedEvents.sql * * Summary: Converts a SQL Trace definition on a SQL Server to a Extended * Events Session using the SQLskills_Trace_XE_Column_Map table * to map the column definitions across. * * Date: January 2, 2012 * * SQL Server Versions: * 2012 * ****************************************************************************** * Copyright (C) 2011 Jonathan M. Kehayias, SQLskills.com * All rights reserved. * * For more scripts and sample code, check out * http://sqlskills.com/blogs/jonathan * * You may alter this code for your own *non-commercial* purposes. You may * republish altered code as long as you include this copyright and give * due credit. * * * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF * ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A * PARTICULAR PURPOSE. * ******************************************************************************/ CREATE PROCEDURE sp_SQLskills_ConvertTraceToExtendedEvents ( @TraceID INT, @SessionName NVARCHAR(128), @PrintOutput BIT = 1, @Execute BIT = 0) AS SET NOCOUNT ON IF NOT EXISTS (SELECT 1 FROM sys.traces WHERE id = @TraceID) BEGIN RAISERROR('The specified @TraceID does not exist on the server. Please check the id of the trace in sys.traces.', 16, 1) WITH NOWAIT; RETURN; END CREATE TABLE [#SQLskills_Trace_XE_Column_Map]( [trace_event_id] [int] NOT NULL, [trace_column_id] [int] NOT NULL, [event_package_name] [nvarchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [xe_event_name] [nvarchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [column_name] [nvarchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [action_package_name] [nvarchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [xe_action_name] [nvarchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] CREATE CLUSTERED INDEX CX_#SQLskills_Trace_XE_Column_Map ON [#SQLskills_Trace_XE_Column_Map](trace_event_id, trace_column_id) INSERT INTO [#SQLskills_Trace_XE_Column_Map] SELECT te.trace_event_id, tc.trace_column_id AS trace_column_id, txem.package_name AS event_package_name, txem.xe_event_name, tab.column_name, CASE WHEN tab.column_name IS NOT NULL THEN NULL ELSE txam.package_name END AS action_package_name, CASE WHEN tab.column_name IS NOT NULL THEN NULL ELSE txam.xe_action_name END AS xe_action_name FROM sys.trace_events AS te JOIN sys.trace_categories AS cat ON te.category_id = cat.category_id JOIN sys.trace_event_bindings AS teb ON te.trace_event_id = teb.trace_event_id JOIN sys.trace_columns AS tc ON teb.trace_column_id = tc.trace_column_id JOIN sys.trace_xe_event_map AS txem ON te.trace_event_id = txem.trace_event_id LEFT JOIN ( SELECT p.name AS event_package_name, o.name AS event_name, oc.name AS column_name FROM sys.dm_xe_packages AS p JOIN sys.dm_xe_objects AS o ON p.guid = o.package_guid JOIN sys.dm_xe_object_columns AS oc ON o.name = oc.object_name AND o.package_guid = oc.object_package_guid WHERE (p.capabilities IS NULL OR p.capabilities & 1 = 0) AND (o.capabilities IS NULL OR o.capabilities & 1 = 0) AND o.object_type = 'event' AND oc.column_type = 'data') as tab ON tab.event_package_name COLLATE SQL_Latin1_General_CP1_CI_AS = txem.package_name COLLATE SQL_Latin1_General_CP1_CI_AS AND tab.event_name COLLATE SQL_Latin1_General_CP1_CI_AS = txem.xe_event_name COLLATE SQL_Latin1_General_CP1_CI_AS AND CASE WHEN tc.name = 'ObjectID' THEN 'object_id' WHEN tc.name = 'Type' THEN 'object_type' --WHEN tc.name = 'NestLevel' THEN 'nest_level' WHEN tc.name = 'ObjectName' THEN 'object_name' WHEN tc.name = 'DatabaseID' THEN 'database_id' WHEN tc.name = 'DatabaseName' THEN 'database_name' WHEN tc.name = 'IndexID' THEN 'index_id' WHEN tc.name = 'Reads' THEN 'logical_reads' WHEN tc.name = 'CPU' THEN 'cpu_time' WHEN tc.name = 'RowCounts' THEN 'row_count' --WHEN tc.name = 'Severity' THEN 'error_severity' --WHEN tc.name = 'Type' THEN 'object_type' WHEN tc.name = 'Error' THEN 'error_number' ELSE tc.name END = tab.column_name LEFT JOIN sys.trace_xe_action_map AS txam ON tc.trace_column_id = txam.trace_column_id WHERE cat.name NOT IN ('User configurable') AND tc.name NOT IN ('EventClass', 'StartTime', 'EndTime') AND (tab.column_name IS NOT NULL OR txam.xe_action_name IS NOT NULL) UNION ALL SELECT CAST(trace_event_id AS INT) AS trace_event_id, -- trace_event_name, CAST(trace_column_id AS INT) AS trace_column_id, -- trace_column_name, event_package_name, xe_event_name, NULLIF(column_name, '') AS column_name, NULLIF(action_package_name, '') AS action_package_name, NULLIF(xe_action_name, '') AS xe_action_name FROM ( VALUES ('10', 'RPC:Completed', '1', 'TextData', 'sqlserver', 'rpc_completed', 'statement', '', ''), ('10', 'RPC:Completed', '31', 'Error', 'sqlserver', 'rpc_completed', 'result', '', ''), ('11', 'RPC:Starting', '1', 'TextData', 'sqlserver', 'rpc_starting', 'statement', '', ''), ('12', 'SQL:BatchCompleted', '1', 'TextData', 'sqlserver', 'sql_batch_completed', 'batch_text', '', ''), ('12', 'SQL:BatchCompleted', '31', 'Error', 'sqlserver', 'sql_batch_completed', 'result', '', ''), ('13', 'SQL:BatchStarting', '1', 'TextData', 'sqlserver', 'sql_batch_starting', 'batch_text', '', ''), ('14', 'Audit Login', '1', 'TextData', 'sqlserver', 'login', 'options_text', '', ''), ('14', 'Audit Login', '2', 'BinaryData', 'sqlserver', 'login', 'options', '', ''), ('14', 'Audit Login', '25', 'IntegerData', 'sqlserver', 'login', 'packet_size', '', ''), ('17', 'ExistingConnection', '1', 'TextData', 'sqlserver', 'existing_connection', 'options_text', '', ''), ('17', 'ExistingConnection', '2', 'BinaryData', 'sqlserver', 'existing_connection', 'options', '', ''), ('17', 'ExistingConnection', '25', 'IntegerData', 'sqlserver', 'existing_connection', 'packet_size', '', ''), ('18', 'Audit Server Starts And Stops', '21', 'EventSubClass', 'sqlserver', 'server_start_stop', 'operation', '', ''), ('19', 'DTCTransaction', '2', 'BinaryData', 'sqlserver', 'dtc_transaction', 'unit_of_work_id', '', ''), ('19', 'DTCTransaction', '21', 'EventSubClass', 'sqlserver', 'dtc_transaction', 'transaction_state', '', ''), ('19', 'DTCTransaction', '25', 'IntegerData', 'sqlserver', 'dtc_transaction', 'isolation_level', '', ''), ('21', 'EventLog', '1', 'TextData', 'sqlserver', 'error_reported', 'message', '', ''), ('22', 'ErrorLog', '1', 'TextData', 'sqlserver', 'errorlog_written', 'message', '', ''), ('23', 'Lock:Released', '1', 'TextData', 'sqlserver', 'lock_released', 'resource_description', '', ''), ('23', 'Lock:Released', '2', 'BinaryData', 'sqlserver', 'lock_released', 'lockspace_workspace_id', '', ''), ('23', 'Lock:Released', '52', 'BigintData1', 'sqlserver', 'lock_released', 'resource_2', '', ''), ('23', 'Lock:Released', '56', 'ObjectID2', 'sqlserver', 'lock_released', 'associated_object_id', '', ''), ('23', 'Lock:Released', '57', 'Type', 'sqlserver', 'lock_released', 'resource_type', '', ''), ('23', 'Lock:Released', '58', 'OwnerID', 'sqlserver', 'lock_released', 'owner_type', '', ''), ('24', 'Lock:Acquired', '1', 'TextData', 'sqlserver', 'lock_acquired', 'resource_description', '', ''), ('24', 'Lock:Acquired', '2', 'BinaryData', 'sqlserver', 'lock_acquired', 'lockspace_workspace_id', '', ''), ('24', 'Lock:Acquired', '52', 'BigintData1', 'sqlserver', 'lock_acquired', 'resource_2', '', ''), ('24', 'Lock:Acquired', '56', 'ObjectID2', 'sqlserver', 'lock_acquired', 'associated_object_id', '', ''), ('24', 'Lock:Acquired', '57', 'Type', 'sqlserver', 'lock_acquired', 'resource_type', '', ''), ('24', 'Lock:Acquired', '58', 'OwnerID', 'sqlserver', 'lock_acquired', 'owner_type', '', ''), ('25', 'Lock:Deadlock', '1', 'TextData', 'sqlserver', 'lock_deadlock', 'resource_description', '', ''), ('25', 'Lock:Deadlock', '2', 'BinaryData', 'sqlserver', 'lock_deadlock', 'lockspace_workspace_id', '', ''), ('25', 'Lock:Deadlock', '25', 'IntegerData', 'sqlserver', 'lock_deadlock', 'deadlock_id', '', ''), ('25', 'Lock:Deadlock', '56', 'ObjectID2', 'sqlserver', 'lock_deadlock', 'associated_object_id', '', ''), ('25', 'Lock:Deadlock', '57', 'Type', 'sqlserver', 'lock_deadlock', 'resource_type', '', ''), ('25', 'Lock:Deadlock', '58', 'OwnerID', 'sqlserver', 'lock_deadlock', 'owner_type', '', ''), ('26', 'Lock:Cancel', '1', 'TextData', 'sqlserver', 'lock_cancel', 'resource_description', '', ''), ('26', 'Lock:Cancel', '2', 'BinaryData', 'sqlserver', 'lock_cancel', 'lockspace_workspace_id', '', ''), ('26', 'Lock:Cancel', '52', 'BigintData1', 'sqlserver', 'lock_cancel', 'resource_2', '', ''), ('26', 'Lock:Cancel', '56', 'ObjectID2', 'sqlserver', 'lock_cancel', 'associated_object_id', '', ''), ('26', 'Lock:Cancel', '57', 'Type', 'sqlserver', 'lock_cancel', 'resource_type', '', ''), ('26', 'Lock:Cancel', '58', 'OwnerID', 'sqlserver', 'lock_cancel', 'owner_type', '', ''), ('27', 'Lock:Timeout', '1', 'TextData', 'sqlserver', 'lock_timeout', 'resource_description', '', ''), ('27', 'Lock:Timeout', '2', 'BinaryData', 'sqlserver', 'lock_timeout', 'lockspace_workspace_id', '', ''), ('27', 'Lock:Timeout', '56', 'ObjectID2', 'sqlserver', 'lock_timeout', 'associated_object_id', '', ''), ('27', 'Lock:Timeout', '57', 'Type', 'sqlserver', 'lock_timeout', 'resource_type', '', ''), ('27', 'Lock:Timeout', '58', 'OwnerID', 'sqlserver', 'lock_timeout', 'owner_type', '', ''), ('28', 'Degree of Parallelism', '2', 'BinaryData', 'sqlserver', 'degree_of_parallelism', 'dop', '', ''), ('28', 'Degree of Parallelism', '21', 'EventSubClass', 'sqlserver', 'degree_of_parallelism', 'statement_type', '', ''), ('28', 'Degree of Parallelism', '25', 'IntegerData', 'sqlserver', 'degree_of_parallelism', 'workspace_memory_grant_kb', '', ''), ('34', 'SP:CacheMiss', '1', 'TextData', 'sqlserver', 'sp_cache_miss', 'cached_text', '', ''), ('34', 'SP:CacheMiss', '28', 'ObjectType', 'sqlserver', 'sp_cache_miss', 'object_type', '', ''), ('35', 'SP:CacheInsert', '1', 'TextData', 'sqlserver', 'sp_cache_insert', 'cached_text', '', ''), ('35', 'SP:CacheInsert', '28', 'ObjectType', 'sqlserver', 'sp_cache_insert', 'object_type', '', ''), ('36', 'SP:CacheRemove', '1', 'TextData', 'sqlserver', 'sp_cache_remove', 'cached_text', '', ''), ('36', 'SP:CacheRemove', '21', 'EventSubClass', 'sqlserver', 'sp_cache_remove', 'remove_method', '', ''), ('36', 'SP:CacheRemove', '28', 'ObjectType', 'sqlserver', 'sp_cache_remove', 'object_type', '', ''), ('37', 'SP:Recompile', '1', 'TextData', 'sqlserver', 'sql_statement_recompile', 'statement', '', ''), ('37', 'SP:Recompile', '21', 'EventSubClass', 'sqlserver', 'sql_statement_recompile', 'recompile_cause', '', ''), ('37', 'SP:Recompile', '28', 'ObjectType', 'sqlserver', 'sql_statement_recompile', 'object_type', '', ''), ('37', 'SP:Recompile', '29', 'NestLevel', 'sqlserver', 'sql_statement_recompile', 'nest_level', '', ''), ('37', 'SP:Recompile', '55', 'IntegerData2', 'sqlserver', 'sql_statement_recompile', 'offset_end', '', ''), ('38', 'SP:CacheHit', '1', 'TextData', 'sqlserver', 'sp_cache_hit', 'cached_text', '', ''), ('38', 'SP:CacheHit', '28', 'ObjectType', 'sqlserver', 'sp_cache_hit', 'object_type', '', ''), ('40', 'SQL:StmtStarting', '1', 'TextData', 'sqlserver', 'sql_statement_starting', 'statement', '', ''), ('40', 'SQL:StmtStarting', '29', 'NestLevel', 'sqlserver', 'sql_statement_starting', '', 'sqlserver', 'tsql_stack'), ('40', 'SQL:StmtStarting', '55', 'IntegerData2', 'sqlserver', 'sql_statement_starting', 'offset_end', '', ''), ('41', 'SQL:StmtCompleted', '1', 'TextData', 'sqlserver', 'sql_statement_completed', 'statement', '', ''), ('41', 'SQL:StmtCompleted', '25', 'IntegerData', 'sqlserver', 'sql_statement_completed', 'row_count', '', ''), ('41', 'SQL:StmtCompleted', '29', 'NestLevel', 'sqlserver', 'sql_statement_completed', '', 'sqlserver', 'tsql_stack'), ('41', 'SQL:StmtCompleted', '55', 'IntegerData2', 'sqlserver', 'sql_statement_completed', 'offset_end', '', ''), ('42', 'SP:Starting', '1', 'TextData', 'sqlserver', 'module_start', 'statement', '', ''), ('42', 'SP:Starting', '28', 'ObjectType', 'sqlserver', 'module_start', 'object_type', '', ''), ('42', 'SP:Starting', '29', 'NestLevel', 'sqlserver', 'module_start', '', 'sqlserver', 'tsql_stack'), ('42', 'SP:Starting', '62', 'SourceDatabaseID', 'sqlserver', 'module_start', 'source_database_id', '', ''), ('43', 'SP:Completed', '1', 'TextData', 'sqlserver', 'module_end', 'statement', '', ''), ('43', 'SP:Completed', '28', 'ObjectType', 'sqlserver', 'module_end', 'object_type', '', ''), ('43', 'SP:Completed', '29', 'NestLevel', 'sqlserver', 'module_end', '', 'sqlserver', 'tsql_stack'), ('43', 'SP:Completed', '62', 'SourceDatabaseID', 'sqlserver', 'module_end', 'source_database_id', '', ''), ('44', 'SP:StmtStarting', '1', 'TextData', 'sqlserver', 'sp_statement_starting', 'statement', '', ''), ('44', 'SP:StmtStarting', '28', 'ObjectType', 'sqlserver', 'sp_statement_starting', 'object_type', '', ''), ('44', 'SP:StmtStarting', '29', 'NestLevel', 'sqlserver', 'sp_statement_starting', 'nest_level', '', ''), ('44', 'SP:StmtStarting', '55', 'IntegerData2', 'sqlserver', 'sp_statement_starting', 'offset_end', '', ''), ('44', 'SP:StmtStarting', '62', 'SourceDatabaseID', 'sqlserver', 'sp_statement_starting', 'source_database_id', '', ''), ('45', 'SP:StmtCompleted', '1', 'TextData', 'sqlserver', 'sp_statement_completed', 'statement', '', ''), ('45', 'SP:StmtCompleted', '28', 'ObjectType', 'sqlserver', 'sp_statement_completed', 'object_type', '', ''), ('45', 'SP:StmtCompleted', '29', 'NestLevel', 'sqlserver', 'sp_statement_completed', 'nest_level', '', ''), ('45', 'SP:StmtCompleted', '55', 'IntegerData2', 'sqlserver', 'sp_statement_completed', 'offset_end', '', ''), ('45', 'SP:StmtCompleted', '62', 'SourceDatabaseID', 'sqlserver', 'sp_statement_completed', 'source_database_id', '', ''), ('46', 'Object:Created', '21', 'EventSubClass', 'sqlserver', 'object_created', 'ddl_phase', '', ''), --('46', 'Object:Created', '25', 'IntegerData', 'sqlserver', 'object_created', '', 'package0', 'attach_activity_id'), ('46', 'Object:Created', '28', 'ObjectType', 'sqlserver', 'object_created', 'object_type', '', ''), ('46', 'Object:Created', '56', 'ObjectID2', 'sqlserver', 'object_created', 'related_object_id', '', ''), ('47', 'Object:Deleted', '21', 'EventSubClass', 'sqlserver', 'object_deleted', 'ddl_phase', '', ''), --('47', 'Object:Deleted', '25', 'IntegerData', 'sqlserver', 'object_deleted', '', 'package0', 'attach_activity_id'), ('47', 'Object:Deleted', '28', 'ObjectType', 'sqlserver', 'object_deleted', 'object_type', '', ''), ('47', 'Object:Deleted', '56', 'ObjectID2', 'sqlserver', 'object_deleted', 'related_object_id', '', ''), ('50', 'SQLTransaction', '21', 'EventSubClass', 'sqlserver', 'sql_transaction', 'transaction_state', '', ''), ('50', 'SQLTransaction', '25', 'IntegerData', 'sqlserver', 'sql_transaction', 'transaction_type', '', ''), ('53', 'CursorOpen', '25', 'IntegerData', 'sqlserver', 'cursor_open', 'cursor_type', '', ''), ('53', 'CursorOpen', '33', 'Handle', 'sqlserver', 'cursor_open', 'protocol_execution_id', '', ''), ('54', 'TransactionLog', '22', 'ObjectID', 'sqlserver', 'transaction_log', 'alloc_unit_id', '', ''), ('54', 'TransactionLog', '24', 'IndexID', 'sqlserver', 'transaction_log', 'alloc_unit_id', '', ''), ('55', 'Hash Warning', '21', 'EventSubClass', 'sqlserver', 'hash_warning', 'hash_warning_type', '', ''), ('55', 'Hash Warning', '22', 'ObjectID', 'sqlserver', 'hash_warning', 'query_operation_node_id', '', ''), ('55', 'Hash Warning', '25', 'IntegerData', 'sqlserver', 'hash_warning', 'recursion_level', '', ''), ('58', 'Auto Stats', '1', 'TextData', 'sqlserver', 'auto_stats', 'statistics_list', '', ''), ('58', 'Auto Stats', '21', 'EventSubClass', 'sqlserver', 'auto_stats', 'status', '', ''), ('58', 'Auto Stats', '25', 'IntegerData', 'sqlserver', 'auto_stats', 'count', '', ''), ('58', 'Auto Stats', '31', 'Error', 'sqlserver', 'auto_stats', 'last_error', '', ''), ('58', 'Auto Stats', '55', 'IntegerData2', 'sqlserver', 'auto_stats', 'job_id', '', ''), ('58', 'Auto Stats', '57', 'Type', 'sqlserver', 'auto_stats', 'job_type', '', ''), ('59', 'Lock:Deadlock Chain', '1', 'TextData', 'sqlserver', 'lock_deadlock_chain', 'resource_description', '', ''), ('59', 'Lock:Deadlock Chain', '2', 'BinaryData', 'sqlserver', 'lock_deadlock_chain', 'lockspace_workspace_id', '', ''), ('59', 'Lock:Deadlock Chain', '21', 'EventSubClass', 'sqlserver', 'lock_deadlock_chain', 'resource_owner_type', '', ''), ('59', 'Lock:Deadlock Chain', '25', 'IntegerData', 'sqlserver', 'lock_deadlock_chain', 'deadlock_id', '', ''), ('59', 'Lock:Deadlock Chain', '56', 'ObjectID2', 'sqlserver', 'lock_deadlock_chain', 'associated_object_id', '', ''), ('59', 'Lock:Deadlock Chain', '57', 'Type', 'sqlserver', 'lock_deadlock_chain', 'resource_type', '', ''), ('59', 'Lock:Deadlock Chain', '58', 'OwnerID', 'sqlserver', 'lock_deadlock_chain', 'owner_type', '', ''), ('60', 'Lock:Escalation', '1', 'TextData', 'sqlserver', 'lock_escalation', 'statement', '', ''), ('60', 'Lock:Escalation', '21', 'EventSubClass', 'sqlserver', 'lock_escalation', 'escalation_cause', '', ''), ('60', 'Lock:Escalation', '25', 'IntegerData', 'sqlserver', 'lock_escalation', 'hobt_lock_count', '', ''), ('60', 'Lock:Escalation', '55', 'IntegerData2', 'sqlserver', 'lock_escalation', 'escalated_lock_count', '', ''), ('60', 'Lock:Escalation', '56', 'ObjectID2', 'sqlserver', 'lock_escalation', 'hobt_id', '', ''), ('60', 'Lock:Escalation', '57', 'Type', 'sqlserver', 'lock_escalation', 'resource_type', '', ''), ('60', 'Lock:Escalation', '58', 'OwnerID', 'sqlserver', 'lock_escalation', 'owner_type', '', ''), ('61', 'OLEDB Errors', '1', 'TextData', 'sqlserver', 'oledb_error', 'parameters', '', ''), ('61', 'OLEDB Errors', '31', 'Error', 'sqlserver', 'oledb_error', 'hresult', '', ''), ('61', 'OLEDB Errors', '45', 'LinkedServerName', 'sqlserver', 'oledb_error', 'linked_server_name', '', ''), ('61', 'OLEDB Errors', '46', 'ProviderName', 'sqlserver', 'oledb_error', 'provider_name', '', ''), ('61', 'OLEDB Errors', '47', 'MethodName', 'sqlserver', 'oledb_error', 'method_name', '', ''), ('67', 'Execution Warnings', '1', 'TextData', 'sqlserver', 'execution_warning', 'server_memory_grants', '', ''), ('67', 'Execution Warnings', '21', 'EventSubClass', 'sqlserver', 'execution_warning', 'warning_type', '', ''), ('68', 'Showplan Text (Unencoded)', '1', 'TextData', 'sqlserver', 'query_pre_execution_showplan', 'showplan_xml', '', ''), ('68', 'Showplan Text (Unencoded)', '2', 'BinaryData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_cost', '', ''), ('68', 'Showplan Text (Unencoded)', '25', 'IntegerData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_rows', '', ''), ('68', 'Showplan Text (Unencoded)', '28', 'ObjectType', 'sqlserver', 'query_pre_execution_showplan', 'object_type', '', ''), ('68', 'Showplan Text (Unencoded)', '29', 'NestLevel', 'sqlserver', 'query_pre_execution_showplan', 'nest_level', '', ''), ('69', 'Sort Warnings', '21', 'EventSubClass', 'sqlserver', 'sort_warning', 'sort_warning_type', '', ''), ('70', 'CursorPrepare', '33', 'Handle', 'sqlserver', 'cursor_prepare', 'protocol_execution_id', '', ''), ('71', 'Prepare SQL', '33', 'Handle', 'sqlserver', 'prepare_sql', 'statement_handle', '', ''), ('72', 'Exec Prepared SQL', '33', 'Handle', 'sqlserver', 'exec_prepared_sql', 'statement_handle', '', ''), ('73', 'Unprepare SQL', '33', 'Handle', 'sqlserver', 'unprepare_sql', 'statement_handle', '', ''), ('74', 'CursorExecute', '25', 'IntegerData', 'sqlserver', 'cursor_execute', 'cursor_type', '', ''), ('74', 'CursorExecute', '33', 'Handle', 'sqlserver', 'cursor_execute', 'protocol_execution_id', '', ''), ('76', 'CursorImplicitConversion', '2', 'BinaryData', 'sqlserver', 'cursor_implicit_conversion', 'final_cursor_type', '', ''), ('76', 'CursorImplicitConversion', '25', 'IntegerData', 'sqlserver', 'cursor_implicit_conversion', 'initial_cursor_type', '', ''), ('76', 'CursorImplicitConversion', '33', 'Handle', 'sqlserver', 'cursor_implicit_conversion', 'protocol_execution_id', '', ''), ('77', 'CursorUnprepare', '33', 'Handle', 'sqlserver', 'cursor_unprepare', 'protocol_execution_id', '', ''), ('78', 'CursorClose', '33', 'Handle', 'sqlserver', 'cursor_close', 'protocol_execution_id', '', ''), ('79', 'Missing Column Statistics', '1', 'TextData', 'sqlserver', 'missing_column_statistics', 'column_list', '', ''), ('81', 'Server Memory Change', '21', 'EventSubClass', 'sqlserver', 'server_memory_change', 'memory_change', '', ''), ('81', 'Server Memory Change', '25', 'IntegerData', 'sqlserver', 'server_memory_change', 'new_memory_size_mb', '', ''), ('92', 'Data File Auto Grow', '25', 'IntegerData', 'sqlserver', 'database_file_size_change', 'size_change_kb', '', ''), ('92', 'Data File Auto Grow', '36', 'FileName', 'sqlserver', 'database_file_size_change', 'file_name', '', ''), ('93', 'Log File Auto Grow', '25', 'IntegerData', 'sqlserver', 'database_file_size_change', 'size_change_kb', '', ''), ('93', 'Log File Auto Grow', '36', 'FileName', 'sqlserver', 'database_file_size_change', 'file_name', '', ''), ('94', 'Data File Auto Shrink', '25', 'IntegerData', 'sqlserver', 'database_file_size_change', 'size_change_kb', '', ''), ('94', 'Data File Auto Shrink', '36', 'FileName', 'sqlserver', 'database_file_size_change', 'file_name', '', ''), ('95', 'Log File Auto Shrink', '25', 'IntegerData', 'sqlserver', 'database_file_size_change', 'size_change_kb', '', ''), ('95', 'Log File Auto Shrink', '36', 'FileName', 'sqlserver', 'database_file_size_change', 'file_name', '', ''), ('96', 'Showplan Text', '2', 'BinaryData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_cost', '', ''), ('96', 'Showplan Text', '25', 'IntegerData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_rows', '', ''), ('96', 'Showplan Text', '28', 'ObjectType', 'sqlserver', 'query_pre_execution_showplan', 'object_type', '', ''), ('96', 'Showplan Text', '29', 'NestLevel', 'sqlserver', 'query_pre_execution_showplan', 'nest_level', '', ''), ('97', 'Showplan All', '2', 'BinaryData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_cost', '', ''), ('97', 'Showplan All', '25', 'IntegerData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_rows', '', ''), ('97', 'Showplan All', '28', 'ObjectType', 'sqlserver', 'query_pre_execution_showplan', 'object_type', '', ''), ('97', 'Showplan All', '29', 'NestLevel', 'sqlserver', 'query_pre_execution_showplan', 'nest_level', '', ''), ('98', 'Showplan Statistics Profile', '2', 'BinaryData', 'sqlserver', 'query_post_execution_showplan', 'estimated_cost', '', ''), ('98', 'Showplan Statistics Profile', '25', 'IntegerData', 'sqlserver', 'query_post_execution_showplan', 'estimated_rows', '', ''), ('98', 'Showplan Statistics Profile', '28', 'ObjectType', 'sqlserver', 'query_post_execution_showplan', 'object_type', '', ''), ('98', 'Showplan Statistics Profile', '29', 'NestLevel', 'sqlserver', 'query_post_execution_showplan', 'nest_level', '', ''), ('100', 'RPC Output Parameter', '1', 'TextData', 'sqlserver', 'rpc_completed', 'output_parameters', '', ''), ('119', 'OLEDB Call Event', '1', 'TextData', 'sqlserver', 'oledb_call', 'parameters', '', ''), ('119', 'OLEDB Call Event', '21', 'EventSubClass', 'sqlserver', 'oledb_call', 'opcode', '', ''), ('119', 'OLEDB Call Event', '31', 'Error', 'sqlserver', 'oledb_call', 'hresult', '', ''), ('119', 'OLEDB Call Event', '45', 'LinkedServerName', 'sqlserver', 'oledb_call', 'linked_server_name', '', ''), ('119', 'OLEDB Call Event', '46', 'ProviderName', 'sqlserver', 'oledb_call', 'provider_name', '', ''), ('119', 'OLEDB Call Event', '47', 'MethodName', 'sqlserver', 'oledb_call', 'method_name', '', ''), ('120', 'OLEDB QueryInterface Event', '1', 'TextData', 'sqlserver', 'oledb_query_interface', 'parameters', '', ''), ('120', 'OLEDB QueryInterface Event', '21', 'EventSubClass', 'sqlserver', 'oledb_query_interface', 'opcode', '', ''), ('120', 'OLEDB QueryInterface Event', '31', 'Error', 'sqlserver', 'oledb_query_interface', 'hresult', '', ''), ('120', 'OLEDB QueryInterface Event', '45', 'LinkedServerName', 'sqlserver', 'oledb_query_interface', 'linked_server_name', '', ''), ('120', 'OLEDB QueryInterface Event', '46', 'ProviderName', 'sqlserver', 'oledb_query_interface', 'provider_name', '', ''), ('120', 'OLEDB QueryInterface Event', '47', 'MethodName', 'sqlserver', 'oledb_query_interface', 'method_name', '', ''), ('121', 'OLEDB DataRead Event', '1', 'TextData', 'sqlserver', 'oledb_data_read', 'parameters', '', ''), ('121', 'OLEDB DataRead Event', '21', 'EventSubClass', 'sqlserver', 'oledb_data_read', 'opcode', '', ''), ('121', 'OLEDB DataRead Event', '31', 'Error', 'sqlserver', 'oledb_data_read', 'hresult', '', ''), ('121', 'OLEDB DataRead Event', '45', 'LinkedServerName', 'sqlserver', 'oledb_data_read', 'linked_server_name', '', ''), ('121', 'OLEDB DataRead Event', '46', 'ProviderName', 'sqlserver', 'oledb_data_read', 'provider_name', '', ''), ('121', 'OLEDB DataRead Event', '47', 'MethodName', 'sqlserver', 'oledb_data_read', 'method_name', '', ''), ('122', 'Showplan XML', '1', 'TextData', 'sqlserver', 'query_pre_execution_showplan', 'showplan_xml', '', ''), ('122', 'Showplan XML', '2', 'BinaryData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_cost', '', ''), ('122', 'Showplan XML', '25', 'IntegerData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_rows', '', ''), ('122', 'Showplan XML', '28', 'ObjectType', 'sqlserver', 'query_pre_execution_showplan', 'object_type', '', ''), ('122', 'Showplan XML', '29', 'NestLevel', 'sqlserver', 'query_pre_execution_showplan', 'nest_level', '', ''), ('124', 'Broker:Conversation', '1', 'TextData', 'sqlserver', 'broker_conversation', 'conversation_state', '', ''), ('124', 'Broker:Conversation', '21', 'EventSubClass', 'sqlserver', 'broker_conversation', 'conversation_action', '', ''), ('124', 'Broker:Conversation', '34', 'ObjectName', 'sqlserver', 'broker_conversation', 'conversation_handle', '', ''), ('124', 'Broker:Conversation', '38', 'RoleName', 'sqlserver', 'broker_conversation', 'is_initiator', '', ''), ('124', 'Broker:Conversation', '42', 'TargetLoginName', 'sqlserver', 'broker_conversation', 'service_contract_name', '', ''), ('124', 'Broker:Conversation', '47', 'MethodName', 'sqlserver', 'broker_conversation', 'conversation_group_id', '', ''), ('124', 'Broker:Conversation', '54', 'GUID', 'sqlserver', 'broker_conversation', 'conversation_id', '', ''), ('125', 'Deprecation Announcement', '1', 'TextData', 'sqlserver', 'deprecation_announcement', 'message', '', ''), ('125', 'Deprecation Announcement', '22', 'ObjectID', 'sqlserver', 'deprecation_announcement', 'feature_id', '', ''), ('125', 'Deprecation Announcement', '34', 'ObjectName', 'sqlserver', 'deprecation_announcement', 'feature', '', ''), ('125', 'Deprecation Announcement', '55', 'IntegerData2', 'sqlserver', 'deprecation_announcement', '', 'sqlserver', 'tsql_frame'), ('126', 'Deprecation Final Support', '1', 'TextData', 'sqlserver', 'deprecation_final_support', 'message', '', ''), ('126', 'Deprecation Final Support', '22', 'ObjectID', 'sqlserver', 'deprecation_final_support', 'feature_id', '', ''), ('126', 'Deprecation Final Support', '34', 'ObjectName', 'sqlserver', 'deprecation_final_support', 'feature', '', ''), ('126', 'Deprecation Final Support', '55', 'IntegerData2', 'sqlserver', 'deprecation_final_support', '', 'sqlserver', 'tsql_frame'), ('127', 'Exchange Spill Event', '21', 'EventSubClass', 'sqlserver', 'exchange_spill', 'opcode', '', ''), ('127', 'Exchange Spill Event', '22', 'ObjectID', 'sqlserver', 'exchange_spill', 'query_operation_node_id', '', ''), ('136', 'Broker:Conversation Group', '21', 'EventSubClass', 'sqlserver', 'broker_conversation_group', 'conversation_group_action', '', ''), ('136', 'Broker:Conversation Group', '54', 'GUID', 'sqlserver', 'broker_conversation_group', 'conversation_group_id', '', ''), ('137', 'Blocked process report', '1', 'TextData', 'sqlserver', 'blocked_process_report', 'blocked_process', '', ''), ('137', 'Blocked process report', '32', 'Mode', 'sqlserver', 'blocked_process_report', 'lock_mode', '', ''), ('138', 'Broker:Connection', '1', 'TextData', 'ucs', 'ucs_connection_setup', 'error_message', '', ''), ('138', 'Broker:Connection', '21', 'EventSubClass', 'ucs', 'ucs_connection_setup', 'setup_event', '', ''), ('138', 'Broker:Connection', '34', 'ObjectName', 'ucs', 'ucs_connection_setup', 'connection_id', '', ''), ('138', 'Broker:Connection', '54', 'GUID', 'ucs', 'ucs_connection_setup', 'address', '', ''), ('139', 'Broker:Forwarded Message Sent', '22', 'ObjectID', 'sqlserver', 'broker_forwarded_message_sent', 'time_to_live_sec', '', ''), ('139', 'Broker:Forwarded Message Sent', '23', 'Success', 'sqlserver', 'broker_forwarded_message_sent', 'live_time_sec', '', ''), ('139', 'Broker:Forwarded Message Sent', '24', 'IndexID', 'sqlserver', 'broker_forwarded_message_sent', 'remaining_hop_count', '', ''), ('139', 'Broker:Forwarded Message Sent', '25', 'IntegerData', 'sqlserver', 'broker_forwarded_message_sent', 'fragment_number', '', ''), ('139', 'Broker:Forwarded Message Sent', '36', 'FileName', 'sqlserver', 'broker_forwarded_message_sent', 'to_service_name', '', ''), ('139', 'Broker:Forwarded Message Sent', '37', 'OwnerName', 'sqlserver', 'broker_forwarded_message_sent', 'to_broker_name', '', ''), ('139', 'Broker:Forwarded Message Sent', '38', 'RoleName', 'sqlserver', 'broker_forwarded_message_sent', 'is_initiator', '', ''), ('139', 'Broker:Forwarded Message Sent', '39', 'TargetUserName', 'sqlserver', 'broker_forwarded_message_sent', 'from_service_name', '', ''), ('139', 'Broker:Forwarded Message Sent', '40', 'DBUserName', 'sqlserver', 'broker_forwarded_message_sent', 'from_broker_name', '', ''), ('139', 'Broker:Forwarded Message Sent', '42', 'TargetLoginName', 'sqlserver', 'broker_forwarded_message_sent', 'to_broker_name', '', ''), ('139', 'Broker:Forwarded Message Sent', '47', 'MethodName', 'sqlserver', 'broker_forwarded_message_sent', 'message_type_name', '', ''), ('139', 'Broker:Forwarded Message Sent', '52', 'BigintData1', 'sqlserver', 'broker_forwarded_message_sent', 'message_sequence', '', ''), ('139', 'Broker:Forwarded Message Sent', '54', 'GUID', 'sqlserver', 'broker_forwarded_message_sent', 'conversation_id', '', ''), ('140', 'Broker:Forwarded Message Dropped', '1', 'TextData', 'sqlserver', 'broker_forwarded_message_dropped', 'dropped_reason', '', ''), ('140', 'Broker:Forwarded Message Dropped', '20', 'Severity', 'sqlserver', 'broker_forwarded_message_dropped', 'error_severity', '', ''), ('140', 'Broker:Forwarded Message Dropped', '22', 'ObjectID', 'sqlserver', 'broker_forwarded_message_dropped', 'time_to_live_sec', '', ''), ('140', 'Broker:Forwarded Message Dropped', '24', 'IndexID', 'sqlserver', 'broker_forwarded_message_dropped', 'remaining_hop_count', '', ''), ('140', 'Broker:Forwarded Message Dropped', '25', 'IntegerData', 'sqlserver', 'broker_forwarded_message_dropped', 'fragment_number', '', ''), ('140', 'Broker:Forwarded Message Dropped', '30', 'State', 'sqlserver', 'broker_forwarded_message_dropped', 'error_state', '', ''), ('140', 'Broker:Forwarded Message Dropped', '36', 'FileName', 'sqlserver', 'broker_forwarded_message_dropped', 'to_service_name', '', ''), ('140', 'Broker:Forwarded Message Dropped', '37', 'OwnerName', 'sqlserver', 'broker_forwarded_message_dropped', 'to_broker_name', '', ''), ('140', 'Broker:Forwarded Message Dropped', '38', 'RoleName', 'sqlserver', 'broker_forwarded_message_dropped', 'is_initiator', '', ''), ('140', 'Broker:Forwarded Message Dropped', '39', 'TargetUserName', 'sqlserver', 'broker_forwarded_message_dropped', 'from_service_name', '', ''), ('140', 'Broker:Forwarded Message Dropped', '40', 'DBUserName', 'sqlserver', 'broker_forwarded_message_dropped', 'from_broker_name', '', ''), ('140', 'Broker:Forwarded Message Dropped', '42', 'TargetLoginName', 'sqlserver', 'broker_forwarded_message_dropped', 'to_broker_name', '', ''), ('140', 'Broker:Forwarded Message Dropped', '47', 'MethodName', 'sqlserver', 'broker_forwarded_message_dropped', 'message_type_name', '', ''), ('140', 'Broker:Forwarded Message Dropped', '52', 'BigintData1', 'sqlserver', 'broker_forwarded_message_dropped', 'message_sequence', '', ''), ('140', 'Broker:Forwarded Message Dropped', '54', 'GUID', 'sqlserver', 'broker_forwarded_message_dropped', 'conversation_id', '', ''), ('141', 'Broker:Message Classify', '21', 'EventSubClass', 'sqlserver', 'broker_message_classify', 'route_type', '', ''), ('141', 'Broker:Message Classify', '31', 'Error', 'sqlserver', 'broker_message_classify', 'delayed_error_number', '', ''), ('141', 'Broker:Message Classify', '36', 'FileName', 'sqlserver', 'broker_message_classify', 'to_service_name', '', ''), ('141', 'Broker:Message Classify', '37', 'OwnerName', 'sqlserver', 'broker_message_classify', 'to_broker_instance', '', ''), ('141', 'Broker:Message Classify', '38', 'RoleName', 'sqlserver', 'broker_message_classify', 'is_initiator', '', ''), ('141', 'Broker:Message Classify', '45', 'LinkedServerName', 'sqlserver', 'broker_message_classify', 'message_source', '', ''), ('141', 'Broker:Message Classify', '54', 'GUID', 'sqlserver', 'broker_message_classify', 'conversation_id', '', ''), ('142', 'Broker:Transmission', '20', 'Severity', 'sqlserver', 'broker_transmission_exception', 'error_severity', '', ''), ('142', 'Broker:Transmission', '30', 'State', 'sqlserver', 'broker_transmission_exception', 'error_state', '', ''), ('146', 'Showplan XML Statistics Profile', '1', 'TextData', 'sqlserver', 'query_post_execution_showplan', 'showplan_xml', '', ''), ('146', 'Showplan XML Statistics Profile', '2', 'BinaryData', 'sqlserver', 'query_post_execution_showplan', 'estimated_cost', '', ''), ('146', 'Showplan XML Statistics Profile', '25', 'IntegerData', 'sqlserver', 'query_post_execution_showplan', 'estimated_rows', '', ''), ('146', 'Showplan XML Statistics Profile', '28', 'ObjectType', 'sqlserver', 'query_post_execution_showplan', 'object_type', '', ''), ('146', 'Showplan XML Statistics Profile', '29', 'NestLevel', 'sqlserver', 'query_post_execution_showplan', 'nest_level', '', ''), ('148', 'Deadlock graph', '1', 'TextData', 'sqlserver', 'xml_deadlock_report', 'xml_report', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '21', 'EventSubClass', 'sqlserver', 'broker_remote_message_acknowledgement', 'acknowledgement_type', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '25', 'IntegerData', 'sqlserver', 'broker_remote_message_acknowledgement', 'acknowledgement_fragment_number', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '38', 'RoleName', 'sqlserver', 'broker_remote_message_acknowledgement', 'is_initiator', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '52', 'BigintData1', 'sqlserver', 'broker_remote_message_acknowledgement', 'acknowlegment_message_sequence', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '53', 'BigintData2', 'sqlserver', 'broker_remote_message_acknowledgement', 'message_sequence', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '54', 'GUID', 'sqlserver', 'broker_remote_message_acknowledgement', 'conversation_id', '', ''), ('149', 'Broker:Remote Message Acknowledgement', '55', 'IntegerData2', 'sqlserver', 'broker_remote_message_acknowledgement', 'fragment_number', '', ''), ('155', 'FT:Crawl Started', '1', 'TextData', 'sqlserver', 'full_text_crawl_started', 'crawl_operation', '', ''), ('160', 'Broker:Message Undeliverable', '1', 'TextData', 'sqlserver', 'broker_message_undeliverable', 'message_drop_reason', '', ''), ('160', 'Broker:Message Undeliverable', '20', 'Severity', 'sqlserver', 'broker_message_undeliverable', 'error_severity', '', ''), ('160', 'Broker:Message Undeliverable', '21', 'EventSubClass', 'sqlserver', 'broker_message_undeliverable', 'sequenced_message', '', ''), ('160', 'Broker:Message Undeliverable', '25', 'IntegerData', 'sqlserver', 'broker_message_undeliverable', 'message_fragment_number', '', ''), ('160', 'Broker:Message Undeliverable', '30', 'State', 'sqlserver', 'broker_message_undeliverable', 'error_state', '', ''), ('160', 'Broker:Message Undeliverable', '38', 'RoleName', 'sqlserver', 'broker_message_undeliverable', 'is_initiator', '', ''), ('160', 'Broker:Message Undeliverable', '52', 'BigintData1', 'sqlserver', 'broker_message_undeliverable', 'message_sequence_number', '', ''), ('160', 'Broker:Message Undeliverable', '53', 'BigintData2', 'sqlserver', 'broker_message_undeliverable', 'acknowledgement_sequence_number', '', ''), ('160', 'Broker:Message Undeliverable', '54', 'GUID', 'sqlserver', 'broker_message_undeliverable', 'conversation_id', '', ''), ('160', 'Broker:Message Undeliverable', '55', 'IntegerData2', 'sqlserver', 'broker_message_undeliverable', 'acknowledgement_fragment_number', '', ''), ('161', 'Broker:Corrupted Message', '1', 'TextData', 'sqlserver', 'broker_corrupted_message', 'corruption_description', '', ''), ('161', 'Broker:Corrupted Message', '20', 'Severity', 'sqlserver', 'broker_corrupted_message', 'error_severity', '', ''), ('161', 'Broker:Corrupted Message', '30', 'State', 'sqlserver', 'broker_corrupted_message', 'error_state', '', ''), ('162', 'User Error Message', '1', 'TextData', 'sqlserver', 'error_reported', 'message', '', ''), ('163', 'Broker:Activation', '1', 'TextData', 'sqlserver', 'broker_activation', 'activation_message', '', ''), ('163', 'Broker:Activation', '21', 'EventSubClass', 'sqlserver', 'broker_activation', 'activation_state', '', ''), ('163', 'Broker:Activation', '22', 'ObjectID', 'sqlserver', 'broker_activation', 'queue_id', '', ''), ('163', 'Broker:Activation', '25', 'IntegerData', 'sqlserver', 'broker_activation', 'active_task_count', '', ''), ('164', 'Object:Altered', '21', 'EventSubClass', 'sqlserver', 'object_altered', 'ddl_phase', '', ''), --('164', 'Object:Altered', '25', 'IntegerData', 'sqlserver', 'object_altered', '', 'package0', 'attach_activity_id'), ('164', 'Object:Altered', '28', 'ObjectType', 'sqlserver', 'object_altered', 'object_type', '', ''), ('164', 'Object:Altered', '56', 'ObjectID2', 'sqlserver', 'object_altered', 'related_object_id', '', ''), ('165', 'Performance statistics', '1', 'TextData', 'sqlserver', 'query_cache_removal_statistics', 'execution_statistics', '', ''), ('165', 'Performance statistics', '1', 'TextData', 'sqlserver', 'query_pre_execution_showplan', 'showplan_xml', '', ''), ('165', 'Performance statistics', '1', 'TextData', 'sqlserver', 'uncached_sql_batch_statistics', 'statement', '', ''), ('165', 'Performance statistics', '2', 'BinaryData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_cost', '', ''), ('165', 'Performance statistics', '22', 'ObjectID', 'sqlserver', 'query_cache_removal_statistics', 'compiled_object_id', '', ''), ('165', 'Performance statistics', '25', 'IntegerData', 'sqlserver', 'query_cache_removal_statistics', 'begin_offset', '', ''), ('165', 'Performance statistics', '25', 'IntegerData', 'sqlserver', 'query_pre_execution_showplan', 'estimated_rows', '', ''), ('165', 'Performance statistics', '28', 'ObjectType', 'sqlserver', 'query_cache_removal_statistics', 'compiled_object_type', '', ''), ('165', 'Performance statistics', '28', 'ObjectType', 'sqlserver', 'query_pre_execution_showplan', 'object_type', '', ''), ('165', 'Performance statistics', '52', 'BigintData1', 'sqlserver', 'query_cache_removal_statistics', 'recompile_count', '', ''), ('165', 'Performance statistics', '55', 'IntegerData2', 'sqlserver', 'query_cache_removal_statistics', 'end_offset', '', ''), ('166', 'SQL:StmtRecompile', '1', 'TextData', 'sqlserver', 'sql_statement_recompile', 'statement', '', ''), ('166', 'SQL:StmtRecompile', '21', 'EventSubClass', 'sqlserver', 'sql_statement_recompile', 'recompile_cause', '', ''), ('166', 'SQL:StmtRecompile', '28', 'ObjectType', 'sqlserver', 'sql_statement_recompile', 'object_type', '', ''), ('166', 'SQL:StmtRecompile', '29', 'NestLevel', 'sqlserver', 'sql_statement_recompile', 'nest_level', '', ''), ('166', 'SQL:StmtRecompile', '55', 'IntegerData2', 'sqlserver', 'sql_statement_recompile', 'offset_end', '', ''), ('167', 'Database Mirroring State Change', '1', 'TextData', 'sqlserver', 'database_mirroring_state_change', 'state_change_desc', '', ''), ('167', 'Database Mirroring State Change', '25', 'IntegerData', 'sqlserver', 'database_mirroring_state_change', 'prior_state', '', ''), ('167', 'Database Mirroring State Change', '30', 'State', 'sqlserver', 'database_mirroring_state_change', 'new_state', '', ''), ('168', 'Showplan XML For Query Compile', '1', 'TextData', 'sqlserver', 'query_post_compilation_showplan', 'showplan_xml', '', ''), ('168', 'Showplan XML For Query Compile', '2', 'BinaryData', 'sqlserver', 'query_post_compilation_showplan', 'estimated_cost', '', ''), ('168', 'Showplan XML For Query Compile', '25', 'IntegerData', 'sqlserver', 'query_post_compilation_showplan', 'estimated_rows', '', ''), ('168', 'Showplan XML For Query Compile', '28', 'ObjectType', 'sqlserver', 'query_post_compilation_showplan', 'object_type', '', ''), ('168', 'Showplan XML For Query Compile', '29', 'NestLevel', 'sqlserver', 'query_post_compilation_showplan', 'nest_level', '', ''), ('169', 'Showplan All For Query Compile', '2', 'BinaryData', 'sqlserver', 'query_post_compilation_showplan', 'estimated_cost', '', ''), ('169', 'Showplan All For Query Compile', '25', 'IntegerData', 'sqlserver', 'query_post_compilation_showplan', 'estimated_rows', '', ''), ('169', 'Showplan All For Query Compile', '28', 'ObjectType', 'sqlserver', 'query_post_compilation_showplan', 'object_type', '', ''), ('169', 'Showplan All For Query Compile', '29', 'NestLevel', 'sqlserver', 'query_post_compilation_showplan', 'nest_level', '', ''), ('181', 'TM: Begin Tran starting', '1', 'TextData', 'sqlserver', 'begin_tran_starting', 'statement', '', ''), ('182', 'TM: Begin Tran completed', '1', 'TextData', 'sqlserver', 'begin_tran_completed', 'statement', '', ''), ('184', 'TM: Promote Tran completed', '2', 'BinaryData', 'sqlserver', 'promote_tran_completed', 'dtc_trasaction_token', '', ''), ('185', 'TM: Commit Tran starting', '1', 'TextData', 'sqlserver', 'commit_tran_starting', 'statement', '', ''), ('185', 'TM: Commit Tran starting', '21', 'EventSubClass', 'sqlserver', 'commit_tran_starting', 'new_transaction_started', '', ''), ('186', 'TM: Commit Tran completed', '1', 'TextData', 'sqlserver', 'commit_tran_completed', 'statement', '', ''), ('186', 'TM: Commit Tran completed', '21', 'EventSubClass', 'sqlserver', 'commit_tran_completed', 'new_transaction_started', '', ''), ('187', 'TM: Rollback Tran starting', '1', 'TextData', 'sqlserver', 'rollback_tran_starting', 'statement', '', ''), ('187', 'TM: Rollback Tran starting', '21', 'EventSubClass', 'sqlserver', 'rollback_tran_starting', 'new_transaction_started', '', ''), ('188', 'TM: Rollback Tran completed', '1', 'TextData', 'sqlserver', 'rollback_tran_completed', 'statement', '', ''), ('188', 'TM: Rollback Tran completed', '21', 'EventSubClass', 'sqlserver', 'rollback_tran_completed', 'new_transaction_started', '', ''), ('189', 'Lock:Timeout (timeout > 0)', '1', 'TextData', 'sqlserver', 'lock_timeout_greater_than_0', 'resource_description', '', ''), ('189', 'Lock:Timeout (timeout > 0)', '2', 'BinaryData', 'sqlserver', 'lock_timeout_greater_than_0', 'lockspace_workspace_id', '', ''), ('189', 'Lock:Timeout (timeout > 0)', '56', 'ObjectID2', 'sqlserver', 'lock_timeout_greater_than_0', 'associated_object_id', '', ''), ('189', 'Lock:Timeout (timeout > 0)', '57', 'Type', 'sqlserver', 'lock_timeout_greater_than_0', 'resource_type', '', ''), ('189', 'Lock:Timeout (timeout > 0)', '58', 'OwnerID', 'sqlserver', 'lock_timeout_greater_than_0', 'owner_type', '', ''), ('190', 'Progress Report: Online Index Operation', '21', 'EventSubClass', 'sqlserver', 'progress_report_online_index_operation', 'build_stage', '', ''), ('190', 'Progress Report: Online Index Operation', '52', 'BigintData1', 'sqlserver', 'progress_report_online_index_operation', 'rows_inserted', '', ''), ('190', 'Progress Report: Online Index Operation', '53', 'BigintData2', 'sqlserver', 'progress_report_online_index_operation', 'parallel_process_thread_id', '', ''), ('191', 'TM: Save Tran starting', '1', 'TextData', 'sqlserver', 'save_tran_starting', 'statement', '', ''), ('192', 'TM: Save Tran completed', '1', 'TextData', 'sqlserver', 'save_tran_completed', 'statement', '', ''), ('193', 'Background Job Error', '20', 'Severity', 'sqlserver', 'background_job_error', 'error_severity', '', ''), ('193', 'Background Job Error', '21', 'EventSubClass', 'sqlserver', 'background_job_error', 'job_failure_type', '', ''), ('193', 'Background Job Error', '25', 'IntegerData', 'sqlserver', 'background_job_error', 'retries', '', ''), ('193', 'Background Job Error', '30', 'State', 'sqlserver', 'background_job_error', 'error_state', '', ''), ('193', 'Background Job Error', '55', 'IntegerData2', 'sqlserver', 'background_job_error', 'job_id', '', ''), ('193', 'Background Job Error', '57', 'Type', 'sqlserver', 'background_job_error', 'job_type', '', ''), ('194', 'OLEDB Provider Information', '1', 'TextData', 'sqlserver', 'oledb_provider_information', 'parameters', '', ''), ('194', 'OLEDB Provider Information', '45', 'LinkedServerName', 'sqlserver', 'oledb_provider_information', 'linked_server_name', '', ''), ('194', 'OLEDB Provider Information', '46', 'ProviderName', 'sqlserver', 'oledb_provider_information', 'provider_name', '', ''), ('196', 'Assembly Load', '1', 'TextData', 'sqlserver', 'assembly_load', 'success', '', ''), ('196', 'Assembly Load', '22', 'ObjectID', 'sqlserver', 'assembly_load', 'assembly_id', '', ''), ('196', 'Assembly Load', '34', 'ObjectName', 'sqlserver', 'assembly_load', 'assembly_name', '', ''), ('198', 'XQuery Static Type', '1', 'TextData', 'sqlserver', 'xquery_static_type', 'inferred_type', '', ''), ('198', 'XQuery Static Type', '47', 'MethodName', 'sqlserver', 'xquery_static_type', 'oledb_method', '', ''), ('199', 'QN: Subscription', '1', 'TextData', 'sqlserver', 'qn_subscription', 'query_notification_xml_information', '', ''), ('199', 'QN: Subscription', '21', 'EventSubClass', 'sqlserver', 'qn_subscription', 'activity', '', ''), ('200', 'QN: Parameter table', '1', 'TextData', 'sqlserver', 'qn_parameter_table', 'query_notification_xml_information', '', ''), ('200', 'QN: Parameter table', '21', 'EventSubClass', 'sqlserver', 'qn_parameter_table', 'activity', '', ''), ('201', 'QN: Template', '1', 'TextData', 'sqlserver', 'qn_template', 'query_notification_xml_information', '', ''), ('201', 'QN: Template', '21', 'EventSubClass', 'sqlserver', 'qn_template', 'activity', '', ''), ('202', 'QN: Dynamics', '1', 'TextData', 'sqlserver', 'qn_dynamics', 'query_notification_xml_information', '', ''), ('202', 'QN: Dynamics', '21', 'EventSubClass', 'sqlserver', 'qn_dynamics', 'activity', '', ''), ('212', 'Bitmap Warning', '22', 'ObjectID', 'sqlserver', 'bitmap_disabled_warning', 'query_operation_node_id', '', ''), ('213', 'Database Suspect Data Page', '31', 'Error', 'sqlserver', 'database_suspect_data_page', 'page_error', '', ''), ('214', 'CPU threshold exceeded', '58', 'OwnerID', 'sqlserver', 'cpu_threshold_exceeded', 'session_id', '', ''), ('215', 'PreConnect:Starting', '21', 'EventSubClass', 'sqlserver', 'preconnect_starting', 'preconnect_type', '', ''), ('215', 'PreConnect:Starting', '28', 'ObjectType', 'sqlserver', 'preconnect_starting', 'object_type', '', ''), ('216', 'PreConnect:Completed', '21', 'EventSubClass', 'sqlserver', 'preconnect_completed', 'preconnect_type', '', ''), ('216', 'PreConnect:Completed', '28', 'ObjectType', 'sqlserver', 'preconnect_completed', 'object_type', '', ''), ('216', 'PreConnect:Completed', '30', 'State', 'sqlserver', 'preconnect_completed', 'error_state', '', ''), ('216', 'PreConnect:Completed', '39', 'TargetUserName', 'sqlserver', 'preconnect_completed', 'workload_group_name', '', '') ) AS tab (trace_event_id, trace_event_name, trace_column_id, trace_column_name, event_package_name, xe_event_name, column_name, action_package_name, xe_action_name) -- Create table variable to hold the trace definition DECLARE @TraceInfo TABLE ( eventid INT, te_name NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, columnid INT, columnname NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, event_package_name NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, xe_event_name NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, column_name NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, action_package_name NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, xe_action_name NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, filter_operator NVARCHAR(128) COLLATE SQL_Latin1_General_CP1_CI_AS, filter_value sql_variant ) -- Query the trace functions to get the trace definition INSERT INTO @TraceInfo (eventid, te_name, columnid, columnname, event_package_name, xe_event_name, column_name, action_package_name, xe_action_name, filter_operator, filter_value) SELECT eventid, te.name, tgei.columnid, tc.name, event_package_name, xe_event_name, column_name, action_package_name, xe_action_name, CASE comparison_operator WHEN 0 THEN '=' WHEN 1 THEN '<>' WHEN 2 THEN '>' WHEN 3 THEN '<' WHEN 4 THEN '>=' WHEN 5 THEN '<=' WHEN 6 THEN 'LIKE' WHEN 7 THEN 'NOT LIKE' END AS filter_operator, value AS filter_value FROM sys.fn_trace_geteventinfo(@TraceID) AS tgei LEFT JOIN sys.fn_trace_getfilterinfo(@TraceID) AS tfgi ON tgei.columnid = tfgi.columnid AND CAST(value AS NVARCHAR) NOT LIKE 'SQL Server Profiler%' JOIN sys.trace_columns AS tc ON tgei.columnid = tc.trace_column_id JOIN sys.trace_events AS te ON tgei.eventid = te.trace_event_id LEFT JOIN [#SQLskills_Trace_XE_Column_Map] AS txcm ON tgei.eventid = txcm.trace_event_id AND tgei.columnid = txcm.trace_column_id ORDER BY tgei.eventid, tgei.columnid -- Generate the drop command for the Event Session if it already exists DECLARE @DropCmd NVARCHAR(MAX) = 'IF EXISTS (SELECT 1 FROM sys.server_event_sessions WHERE name = '''+@SessionName+''')' + CHAR(10) + ' DROP EVENT SESSION '+QUOTENAME(@SessionName)+' ON SERVER;' + CHAR(10) -- Execute the drop command if @Execute = 1 IF @Execute = 1 EXECUTE(@DropCmd); -- Generate the start of the create statement for the Event Sesssion DECLARE @sqlcmd NVARCHAR(MAX) = 'CREATE EVENT SESSION '+QUOTENAME(@SessionName)+ CHAR(10) + 'ON SERVER' + CHAR(10) DECLARE @event_list NVARCHAR(MAX) = '' -- Generate the Event list DDL definition for the event session SELECT @event_list = @event_list + -- Add Events to Session CASE WHEN event_package_name IS NULL THEN '/* ' + tab.te_name + ' is not implemented in Extended Events it may be a Server Audit Event */' + CHAR(10) WHEN event_package_name IS NOT NULL AND RowID <> 1 THEN '/* ' + tab.te_name + ' is implemented as the ' + tab.event_package_name + '.' + tab.xe_event_name + ' event in Extended Events */' + CHAR(10) ELSE 'ADD EVENT ' + event_package_name + '.' + xe_event_name + '(' + CHAR(10) + -- Determine whether to create an Action List for Event CASE WHEN NOT EXISTS (SELECT 1 FROM @TraceInfo AS ti WHERE ti.eventid = tab.eventid AND column_name IS NULL) OR RowID <> 1 THEN '' ELSE -- Build Action List for Event CHAR(9) + 'ACTION ' + CHAR(10) + CHAR(9) + '(' + CHAR(10) + STUFF(( SELECT CASE WHEN action_package_name IS NULL AND columnname NOT IN ('StartTime', 'EndTime') THEN CHAR(9) + CHAR(9) + CHAR(9) + '-- ' + columnname + ' not implemented in XE for this event' + CHAR(10) ELSE CHAR(9) + CHAR(9) + CHAR(9) + ', '+ action_package_name + '.' + xe_action_name + CHAR(9) + '-- ' + columnname + ' from SQLTrace' + CHAR(10) END FROM @TraceInfo AS ti WHERE ti.eventid = tab.eventid AND column_name IS NULL ORDER BY CASE WHEN xe_action_name IS NULL THEN 1 ELSE 0 END, xe_action_name FOR XML PATH('')), 1, 4, CHAR(9) + CHAR(9) + CHAR(9)+' ') -- Actions + CHAR(9) + ')' + CHAR(10) END + -- Build in Predicate information CASE WHEN NOT EXISTS (SELECT 1 FROM @TraceInfo AS ti WHERE ti.eventid = tab.eventid AND filter_operator IS NOT NULL) THEN '' ELSE CHAR(9) + 'WHERE ' + CHAR(10) + CHAR(9) + '(' + CHAR(10) + REPLACE( REPLACE( STUFF( ( SELECT CASE WHEN action_package_name IS NULL THEN CHAR(9) + CHAR(9) + CHAR(9) + 'AND ' + column_name + ' ' + filter_operator + ' ' + CASE WHEN SQL_VARIANT_PROPERTY(filter_value, 'BaseType') IN ('nvarchar', 'varchar', 'char', 'nchar') THEN '''%'+CAST(filter_value AS NVARCHAR)+'%''' ELSE CAST(filter_value AS NVARCHAR) END + CHAR(10) ELSE CHAR(9) + CHAR(9) + CHAR(9) + 'AND '+ action_package_name + '.' + xe_action_name + ' ' + filter_operator + ' ' + CASE WHEN SQL_VARIANT_PROPERTY(filter_value, 'BaseType') IN ('nvarchar', 'varchar', 'char', 'nchar') THEN '''%'+CAST(filter_value AS NVARCHAR)+'%''' ELSE CAST(filter_value AS NVARCHAR) END + CHAR(10) END FROM @TraceInfo AS ti WHERE ti.eventid = tab.eventid AND filter_operator IS NOT NULL ORDER BY xe_action_name FOR XML PATH('') ), 1, 7, CHAR(9) + CHAR(9) + CHAR(9)+'') , '>', '>') , '<', '<') -- Predicates www.saiche55.cn + CHAR(9) + ')' www.yxin7.com END + CHAR(10) + '),' + CHAR(10) END FROM ( SELECT eventid, te_name, event_package_name, xe_event_name, ROW_NUMBER() OVER (PARTITION BY event_package_name, xe_event_name ORDER BY eventid) AS RowID FROM ( www.chuangshi88.cn/ SELECT DISTINCT eventid, te_name, event_package_name, xe_event_name, ROW_NUMBER() OVER (PARTITION BY eventid ORDER BY event_package_name DESC) AS Row_ID www.fanboyl.cn FROM @TraceInfo ) AS tab2 WHERE Row_ID = 1 ) AS tab; www.lxinyul.cc/ -- Add Event List to the output command SET @sqlcmd = @sqlcmd + SUBSTRING(@event_list, 0, LEN(@event_list)-1)+CHAR(10) -- Add target definitions to the output command based on trace configuration SELECT @sqlcmd = @sqlcmd + CASE WHEN path IS NULL THEN 'ADD TARGET package0.ring_buffer' + CHAR(10) ELSE 'ADD TARGET package0.event_file' + CHAR(10) + '(' + CHAR(10) + ' SET filename = '''+ SUBSTRING(path, 0, LEN(path)-CHARINDEX('\', REVERSE(path))+1) + '\'+@SessionName+'.xel'',' + CHAR(10) + ' max_file_size = ' + CAST(max_size AS NVARCHAR) + ',' + CHAR(10) + ' max_rollover_files = ' + CAST(max_files AS NVARCHAR) + CHAR(10) + ')' + CHAR(10) END FROM sys.traces WHERE id = @TraceID -- Print the DDL for the Event Session IF @PrintOutput = 1 BEGIN DECLARE @Position INT = 1, @Next INT = 0, @Delimeter NCHAR(1) = CHAR(10), @WorkString VARCHAR(MAX) = @DropCmd + 'GO' + CHAR(10) + @sqlcmd; WHILE (1 = 1) BEGIN www.feishenbo.cn SELECT @Next = CHARINDEX(@Delimeter, @WorkString, @Position) IF (@Next = 0) BREAK www.longboshyl.cn IF (@Position <> @Next) www.boyuanyl.cn PRINT SUBSTRING(@WorkString, @Position, @Next - @Position) SELECT @Position = @Next + 1 END END -- Execute the DDL the create the Event Session on the Server IF @Execute = 1 BEGIN EXECUTE(@sqlcmd); END Quit: GO -- Mark the SP as a system object EXEC sys.sp_MS_marksystemobject sp_SQLskills_ConvertTraceToExtendedEvents; GO -- Test the procedure GO EXECUTE sp_SQLskills_ConvertTraceToExtendedEvents @TraceID = 1, @SessionName = 'XE_Default_Trace', www.sratchina.com @PrintOutput = 1, @Execute = 0;
注意这个脚本仅用于SQL 2012及以上版本。执行完上面语句之后,在执行下面代码: [sql] view plain copy 在CODE上查看代码片派生到我的代码片 EXECUTE sp_SQLskills_ConvertTraceToExtendedEvents @TraceID = 2, @SessionName = 'XE_ReadsFilter_Trace', @PrintOutput = 1, @Execute = 0;
这个代码把TraceID=2(上面SQL Trace代码中产生的跟踪)转换成xEvents。因此必须运行上面的跟踪定义。使用@SessionName指定扩展事件会话的名字,比如例子中的XE_ReadsFilter_Trace。参数@PrintOutput标识是否把扩展事件的定义T-SQL显示出来,1代表显示。最后,如果你想马上创建扩展事件,把@Execute设为1。因为需要说明,所以这里设为0。上面存储过程的结果为:(注意,SQL Trace中我把文件路径指定在D:\Temp\中)
[sql] view plain copy 在CODE上查看代码片派生到我的代码片 IF EXISTS (SELECT 1 FROM sys.server_event_sessions WHERE name = 'XE_ReadsFilter_Trace') DROP EVENT SESSION [XE_ReadsFilter_Trace] ON SERVER; GO CREATE EVENT SESSION [XE_ReadsFilter_Trace] ON SERVER ADD EVENT sqlserver.rpc_completed( www.hsl85.cn ACTION ( www.yunfeizao.cn sqlserver.client_app_name -- ApplicationName from SQLTrace www.yghrcp88.cn/ , sqlserver.client_pid -- ClientProcessID from SQLTrace , sqlserver.nt_username -- NTUserName from SQLTrace , sqlserver.server_principal_name -- LoginName from SQLTrace , sqlserver.session_id -- SPID from SQLTrace -- BinaryData not implemented in XE for this event ) WHERE ( logical_reads >= 10000 www.ycyc66.cn/ ) ), ADD EVENT sqlserver.sql_batch_completed( ACTION ( sqlserver.client_app_name -- ApplicationName from SQLTrace , sqlserver.client_pid -- ClientProcessID from SQLTrace , sqlserver.nt_username -- NTUserName from SQLTrace , sqlserver.server_principal_name -- LoginName from SQLTrace , sqlserver.session_id -- SPID from SQLTrace ) WHERE ( www.lieqibiji.com/ logical_reads >= 10000 ) ) ADD TARGET package0.event_file ( SET filename = 'D:\temp\XE_ReadsFilter_Trace.xel', max_file_size = 5, max_rollover_files = 1 )
分析扩展事件事件会话:
创建事件会话:
首先是IF语句,检查是否有同名的事件会话存在,如果有则删除,没有则创建: IF EXISTS ( SELECT 1 FROM sys.server_event_sessions WHERE name = 'XE_ReadsFilter_Trace' ) DROP EVENT SESSION [XE_ReadsFilter_Trace] ON SERVER; GO 然后在实例层面使用CREATE EVENT SESSION(http://msdn.microsoft.com/zh-cn/library/bb677289.aspx)语法创建一个事件会话。这个雷系sp_trace_create的功能,但是参数不同:
-- Create a Queue DECLARE @rc INT DECLARE @TraceID INT DECLARE @maxfilesize BIGINT SET @maxfilesize = 5
-- Please replace the text --InsertFileNameHere…etc…
EXEC @rc = sp_trace_create @TraceID OUTPUT, 0, N'InsertFileNameHere', @maxfilesize, NULL IF ( @rc != 0 ) GOTO ERROR [sql] view plain copy 在CODE上查看代码片派生到我的代码片 /* Extended Events */ CREATE EVENT SESSION [XE_ReadsFilter_Trace] ON SERVER
添加事件和操作:
接下来,脚本中使用紧跟CREATE EVENT SESSION DDL后面的ADD EVENT子句定义第一个事件,在本例中就是rpc.completed 事件,然后定义一些额外的操作来响应事件触发,在本例中就是收集4个额外的事件数据列。 [sql] view plain copy 在CODE上查看代码片派生到我的代码片 /*Extended Events*/ ADD EVENT sqlserver.rpc_completed ( ACTION ( sqlserver.client_app_name , sqlserver.database_id , sqlserver.server_instance_name , sqlserver.session_id )
/* Trace */ -- Set the events declare @on bit set @on = 1 exec sp_trace_setevent @TraceID, 10, 10, @on exec sp_trace_setevent @TraceID, 10, 3, @on exec sp_trace_setevent @TraceID, 10, 12, @on exec sp_trace_setevent @TraceID, 10, 13, @on exec sp_trace_setevent @TraceID, 10, 14, @on exec sp_trace_setevent @TraceID, 10, 15, @on exec sp_trace_setevent @TraceID, 10, 16, @on exec sp_trace_setevent @TraceID, 10, 18, @on exec sp_trace_setevent @TraceID, 10, 26, @on
对比上面两段代码,可以发现扩展事件和跟踪之间的关键差异。首先,事件名,还有新增加的操作(如client_app_name,database_id),是文本型、直观的。不需要像跟踪那样查找联机丛书,使得扩展事件可读性更高。 其次,注意扩展事件的脚本,不需要指定所需的所有数据列。实际上,很多这些数据列作为默认事件(类似default trace)被加载。显然我们没必要在脚本中指定这些已经在默认事件中的列,下一节可以看到如何使用GUI界面来查看这些由默认负载包含的事件列。 前面提到过,Trace和扩展事件在收集行为上的差异,SQL Trace默认收集全部“可能有用”的列,然后使用过滤条件过滤。扩展事件相比之下更加高效。每个事件虽然也默认收集一些数据列,但是会最小化范围。如果想收集那些不在默认负载中的内容,需要把它们以操作(actions)来添加。比如RPC:Completed 事件,可以看到client_app_name、database_id、server_instance_name,和Session_id都不属于默认负载事件,所以需要作为添加项添加。 原始的数据采集开销是相对很低的。同时操作(actions)是在过滤后才采集,所以是“符合条件”的数据。这些操作都是和事件的同一个线程运行收集,所以如果收集大量操作或者非常大开销的操作(如memory dump等),还是会明显增加扩展事件的整体开销。所以不管是扩展事件还是SQL Trace,都应该注意不要过于广泛地收集。
定义谓词:
在选择了所需的事件和额外的操作之后,下一步就是添加过滤条件,即谓词: [sql] view plain copy 在CODE上查看代码片派生到我的代码片 /* Extended Events */ WHERE ( logical_reads >= 10000 )
/* Trace */
-- Set the Filters declare @intfilter int declare @bigintfilter bigint
exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - f45d52c9-c0eb-45da-8bae-dc6f1a945251' set @bigintfilter = 10000 exec sp_trace_setfilter @TraceID, 16, 0, 4, @bigintfilter
通过对比Trace和扩展事件可以发现,Profiler定义的Trace需要使用sp_trace_setfilter来过滤事件数据,而在事件会话中,只需要简单的WHERE条件即可。 再次提醒,扩展事件在收集数据之前就应用过滤条件,所以收集的数据都是符合条件的最终结果。这与SQL Trace相比,可以明显降低对服务器的负载开销。
添加额外事件:
到目前为止,rpc_completed事件配置完毕,为了添加其他事件,只需要使用ADD EVENT子句,如:sql:statement_completed事件:
ADD EVENT sqlserver.sql_statement_completed( ACTION ( sqlserver.client_app_name -- ApplicationName from SQLTrace , sqlserver.database_id -- DatabaseID from SQLTrace , sqlserver.server_instance_name -- ServerName from SQLTrace , sqlserver.session_id -- SPID from SQLTrace -- EndTime implemented by another Action in XE already -- StartTime implemented by another Action in XE already ) WHERE ( logical_reads >= 10000 )
同样,这里也添加了额外的,不在默认负载中的列作为操作部分。而且添加的多个事件可以配置成OR或者AND的逻辑。这是SQL Trace无法实现的!注意当你设置一个过滤条件时,它会应用在每个事件中。
定义目标:
在添加了所有事件后,使用ADD TARGET定义输出路径、目标,用来存储SQL Server收集的事件数据和相关操作。而Trace的输出只有到文件或者直接在Profiler中查看(不建议方式)。对于扩展事件,我们可以有很多可选的目标,博阿含基于in-memory存储(ring_buffer)和文件系统存储(event_file),有些高级目标还可以对收集结果进行预聚合。 在这里我们只关注event_file目标,输出到文件,和Trace一样(.trc为扩展名),需要在定义时就明确指定: [sql] view plain copy 在CODE上查看代码片派生到我的代码片 /* Extended Events */ ADD TARGET package0.event_file ( SET filename = 'C:\temp\XE_ReadsFilter_Trace.xel', max_file_size = 5, max_rollover_files = 1