Converting Trace to Extended Events

  • Comments posted to this topic are about the item Converting Trace to Extended Events

  • This can also be done in PowerShell. I wrapped a slightly modified version of Jonathan's procedure in ConvertTo-DbaXESession and added it to dbatools

    Here's how to convert the trace with id of 2 on two different servers, convert them to XE sessions named "Long Running Queries" then start them immediately

    Get-DbaTrace -SqlInstance sql2017, sql2012 | Where Id -eq 2 | ConvertTo-DbaXESession -Name 'Long Running Queries' | Start-DbaXESession

  • Ah, should have added that to the article. I'll put a note at the end.

  • Good write-up, Steve.  I like that once you have the session defined the way you like, you can script it out, and I think it might actually be easier than profiler to set up a quick trace.  For example, if I'm searching for text showing up in a query, or specific stored proc, I can have that script saved and do a find/replace anywhere the sql_text is set on an action and fire up the session.  Thanks for sharing!

  • Personally I like Extended Events better than profiler. But my biggest complaint is not setting up the session, but changing it. It was easier on profiler than editing the query and getting the parentheses and commas right in XE

  • alen teplitsky - Thursday, June 21, 2018 2:54 PM

    Personally I like Extended Events better than profiler. But my biggest complaint is not setting up the session, but changing it. It was easier on profiler than editing the query and getting the parentheses and commas right in XE

    Not using the UI?

  • S. Kusen - Thursday, June 21, 2018 7:02 AM

    Good write-up, Steve.  I like that once you have the session defined the way you like, you can script it out, and I think it might actually be easier than profiler to set up a quick trace.  For example, if I'm searching for text showing up in a query, or specific stored proc, I can have that script saved and do a find/replace anywhere the sql_text is set on an action and fire up the session.  Thanks for sharing!

    The same thing works in XE, which also then could have a much lower performance impact. I'd save out the ALTER script and then do the search/replace in the predicate if needed.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply