{"id":668,"date":"2008-11-08T02:37:00","date_gmt":"2008-11-08T02:37:00","guid":{"rendered":"\/blogs\/bobb\/post\/Secrets-hints-and-tips-for-SQL-Server-Extended-Events.aspx"},"modified":"2008-11-08T02:37:00","modified_gmt":"2008-11-08T02:37:00","slug":"secrets-hints-and-tips-for-sql-server-extended-events","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/","title":{"rendered":"Secrets, hints, and tips for SQL Server Extended Events"},"content":{"rendered":"<p>\nI&#39;ve been doing talks and demos on SQL Server 2008 Extended Events for a while now, it&#39;s one of my favorite parts of the product. Per session waitstats, SQL stack, built-in system health session, what&#39;s not to like?\n<\/p>\n<p>\nBefore my talk at TechEd EMEA for&nbsp;IT Professionals&nbsp;last week (which went really well), I discovered something that was very helpful in getting things to run more smoothly. Since the betas, I&#39;ve always used multi-part names, not only for events, actions, and providers, but for predicates too. To be clearer. Lately, I&#39;d been running into a weird problem. Consider the following event session:\n<\/p>\n<p>\ncreate event session errorsession on server<br \/>\nadd event sqlserver.error_reported<br \/>\n(<br \/>\naction <br \/>\n(&nbsp;&nbsp;&nbsp; <br \/>\nsqlserver.session_id,&nbsp; <br \/>\nsqlserver.sql_text&nbsp;&nbsp;&nbsp;&nbsp; <br \/>\n)<br \/>\nwhere sqlserver.error_reported.error = 547 <br \/>\nand package0.counter &lt;= 3&nbsp; <br \/>\n)<br \/>\nadd target package0.ring_buffer<br \/>\ngo\n<\/p>\n<p>\nAbout one third of the time, running this DDL&nbsp;would produce:\n<\/p>\n<p>\nMsg 25706, Level 16, State 8, Line 1<br \/>\nThe event attribute or predicate source, &quot;sqlserver.error_reported.error&quot;, could not be found.\n<\/p>\n<p>\nThen, I&#39;d move the DDL code to another window, execute it again, and it would work. Sometimes starting up the session:\n<\/p>\n<p>\nalter event session errorsession on server state=start\n<\/p>\n<p>\nwould produce the error. And, of course that attribute DID exist, when I got past the weird error, it resultiing session worked like a charm. You can see the attribute\/field in sys.dm_xe_object_columns. Hmmmm, scratches head&#8230;\n<\/p>\n<p>\nAfter looking at the definition of the system_health session, I decided to try a one-part attribute name. Instead of:\n<\/p>\n<p>\n&#8230;where sqlserver.error_reported.error = 547 and&#8230;<br \/>\n&#8212; how about<br \/>\n&#8230;where error = 547 and&#8230;\n<\/p>\n<p>\nBingo! Now CREATE and ALTER SESSION work first time and every time. Don&#39;t know why this should happen, but at least there&#39;s a syntax correction that works. For the folks at the talk, all my event session code will be up on the SQLskills website shortly, under the &quot;Past Conferences&quot; section. With ONE-PART attribute names in predicates.\n<\/p>\n<p>\nBTW, a few other things to remember to save you some head-scratching.\n<\/p>\n<p>\nWhen using the ETW target, your SQL Server service account (which DOES have least-privileges&#8230;right?) needs to be a member of the Performance Monitor Users and Performance Log Users Windows groups.\n<\/p>\n<p>\nWhen using a file-based target, the service account has to have permissions on the directory where you&#39;re writing the file. This sounds obvious, but folks forget that the SQL Server service account isn&#39;t all-powerful. Or at least *shouldn&#39;t be*, if you&#39;re running SQL Server as local system or administrator, FIX IT, using SQL Server Configuration Manager (not Control Panel\/Services).\n<\/p>\n<p>\nUse an asynchronous target with default event latency rather than a synchronous target, for less overhead, better throughput. However the ETW target is synchronous only.\n<\/p>\n<p>\nAll of the events, targets, etc are sharable, mix-n-match, across all packages WITH ONE EXCEPTION. The items in the SecAudit package are private. Folks always want to use SecAudit.asynchronous_security_audit_event_log_target, &#8230; you can&#39;t. It&#39;s for the new Auditing feature only.\n<\/p>\n<p>\nAll that said, Happy extended eventing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#39;ve been doing talks and demos on SQL Server 2008 Extended Events for a while now, it&#39;s one of my favorite parts of the product. Per session waitstats, SQL stack, built-in system health session, what&#39;s not to like? Before my talk at TechEd EMEA for&nbsp;IT Professionals&nbsp;last week (which went really well), I discovered something that [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,29],"tags":[],"class_list":["post-668","post","type-post","status-publish","format-standard","hentry","category-extended-events","category-sql-server-2008"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Secrets, hints, and tips for SQL Server Extended Events - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Secrets, hints, and tips for SQL Server Extended Events - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve been doing talks and demos on SQL Server 2008 Extended Events for a while now, it&#039;s one of my favorite parts of the product. Per session waitstats, SQL stack, built-in system health session, what&#039;s not to like? Before my talk at TechEd EMEA for&nbsp;IT Professionals&nbsp;last week (which went really well), I discovered something that [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2008-11-08T02:37:00+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/\",\"name\":\"Secrets, hints, and tips for SQL Server Extended Events - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2008-11-08T02:37:00+00:00\",\"dateModified\":\"2008-11-08T02:37:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extended Events\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/extended-events\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Secrets, hints, and tips for SQL Server Extended Events\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Secrets, hints, and tips for SQL Server Extended Events - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/","og_locale":"en_US","og_type":"article","og_title":"Secrets, hints, and tips for SQL Server Extended Events - Bob Beauchemin","og_description":"I&#39;ve been doing talks and demos on SQL Server 2008 Extended Events for a while now, it&#39;s one of my favorite parts of the product. Per session waitstats, SQL stack, built-in system health session, what&#39;s not to like? Before my talk at TechEd EMEA for&nbsp;IT Professionals&nbsp;last week (which went really well), I discovered something that [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/","og_site_name":"Bob Beauchemin","article_published_time":"2008-11-08T02:37:00+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/","name":"Secrets, hints, and tips for SQL Server Extended Events - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2008-11-08T02:37:00+00:00","dateModified":"2008-11-08T02:37:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/secrets-hints-and-tips-for-sql-server-extended-events\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Extended Events","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/extended-events\/"},{"@type":"ListItem","position":3,"name":"Secrets, hints, and tips for SQL Server Extended Events"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=668"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/668\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}