patternsqlModerate
View delete statements in the Transaction log
Viewed 0 times
thedeletelogstatementsviewtransaction
Problem
Is it possible to view
delete statements that have recently occurred in the Transaction Log?Solution
You can view the individual rows that were deleted by looking for LOP_DELETE_ROWS operations still in the log:
If the log was recycled (in simple recovery model) or truncated by backup (in full or bulk recovery model) then you will only be able to see the log operations still available in the log.
Understanding the log operations is quite complex, you need to be aware of things like undo or compensating operations to make sense of some log patterns you can encounter, but straight forward committed DELETEs are fairly easy to comprehend.
select * from fn_dblog(NULL, NULL)
where Operation = 'LOP_DELETE_ROWS'If the log was recycled (in simple recovery model) or truncated by backup (in full or bulk recovery model) then you will only be able to see the log operations still available in the log.
Understanding the log operations is quite complex, you need to be aware of things like undo or compensating operations to make sense of some log patterns you can encounter, but straight forward committed DELETEs are fairly easy to comprehend.
Code Snippets
select * from fn_dblog(NULL, NULL)
where Operation = 'LOP_DELETE_ROWS'Context
StackExchange Database Administrators Q#18463, answer score: 11
Revisions (0)
No revisions yet.