Quantcast
Channel: Active questions tagged audit - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 147

Correlating SQL Audit transaction_id to LSN

$
0
0

I have a relatively simple question that is "Google resistant".

I have a SQL Database Audit spec that logs a transaction_id. I also have a Change Data Capture (CDC) spec that logs __$seqval (LSN). As a sysadmin I can easily correlate the two via sys.fn_dblog().

However, what I'd like to do is set up DML triggers to insert that correlation into a lookup table, and if possible, would like to preserve the context of any user with DML write access to the audited/CDCed table.

To that end, is there a function, DMV or otherwise that can retrieve a Transaction ID when given a LSN - that does not require the sysadmin role to execute/query?

I suspect the answer is probably no, because it doesn't make a whole lot of sense for a user to poke around the transaction log, and if that's the case I'll probably have to take a different route and look at what context I can pull out during the actual DML event.

Thanks!


Viewing all articles
Browse latest Browse all 147

Trending Articles