How to recreate sql from read transaction logs

Jensen, Randy 0 Reputation points
2025-05-08T13:14:08.5333333+00:00

How to read the transaction log to re-create an insert statement

SQL Server Database Engine
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 75,306 Reputation points Moderator
    2025-05-08T15:14:54.7+00:00

    The transaction log is a log of changed disk pages, so if you study the format and did comparisons you could tell committed vs noncommitted row changes, but this would only tell you the effects of the sql statements, not the statement itself. You could not even tell how many transactions made the changes.

    0 comments No comments

  2. Erland Sommarskog 120.4K Reputation points MVP Moderator
    2025-05-08T20:44:33.2166667+00:00

    A very old story from the days of SQL 2000: Someone spent about a year to study the format of the transaction log and this person was able to produce a tool that was able to read the transaction log and give you the statements. This tool was commercially available for a while, and gained some popularity. However, I was not in business for a very long time. Microsoft change the log format in SQL 2005, so the tool was no longer functional. And they have probably made more changes since then.

    0 comments No comments

Your answer