Invalid Database IDs In Extended Events

Jonathan Kehayias looks at a strange scenario:

I was recently emailed with a question about tracking database usage information using Extended Events and the person wanted to know why the event session was returning invalid database_id’s as a part of what it was collecting.  The funny thing is that I’ve seen this before during demo’s when I have a very specific concurrent workload running for what I am demonstrating and I used to make sure to do this exact thing so I could explain it during Immersion Events.  The TLDR answer to this is that Extended Events isn’t returning an invalid database_id at the time that the event occurs, the database_id just isn’t valid when the data is being reviewed or consumed.  How could that be you wonder?

The explanation turns out to be pretty easy, though not necessarily intuitive.

Related Posts

Stop Profiling

Wayne Sheffield concludes his two-part series on converting a trace to use Extended Events: This query extracts the data from XE file target. It also calculates the end date, and displays both the internal and user-friendly names for the resource_type and mode columns – the internal values are what the trace was returning. For a […]

Read More

Breakpoint Extended Event

Arun Sirpal is a dangerous man of mystery and danger, but mostly danger: I did a dangerous thing, and I want to make sure that YOU DO NOT do the same. I was creating a couple of extended events sessions and was playing around with some actions. I ended up with the following code where I […]

Read More

Categories

March 2017
MTWTFSS
« Feb Apr »
 12345
6789101112
13141516171819
20212223242526
2728293031