Extended events and linked server calls received

215 views Asked by At

I've figured out how to use extended events (xe) to capture queries using a linked server call. I'm curious to know if xe can be used on a reporting server to capture queries coming from a linked server query or call? We have a reporting server that is receiving calls from many other production servers and these calls are in the form of linked servers. We'd like to use xe to capture any calls, where they are coming from and most importantly the query itself. We're hoping xe can do this. If so, how?

1

There are 1 answers

0
Randy in Marin On

You can query the extended event session data. The means will depend upon the target. If you have a file target, then use sys.fn_xe_file_target_read_file. If you have a ring buffer, then use sys.dm_xe_session_targets. Be ready to deal with XML data in your queries. There are plenty of examples online. For example,

https://www.brentozar.com/archive/2015/01/query-extended-events-target-xml/ https://www.mssqltips.com/sqlservertutorial/9209/view-sql-server-extended-events-data/ https://www.sqlskills.com/blogs/jonathan/why-i-hate-the-ring_buffer-target-in-extended-events/ http://davebland.com/extended-events-reading-multiple-session-files

If you have the extended event session running on multiple instances, then you would need to gather the information from either multiple files or from multiple queries to ring buffers if you want one report. Otherwise, perhaps one report per instance is good enough.