How to open the SQL Server Transaction Log File(LDF)?

16.7k views Asked by At

I mean the way to open the LDF file and read/analyze it.

Now, I have ability to extract the backup LDF file, but it seems that the LDF file is SHARE_DENY_READ when the database is working.

But the other 3rd-party software like Lumigent Log Explorer,how could they open the file?Does this kind of software read LDF directly?

3

There are 3 answers

2
AudioBubble On

I'm not sure I'm understanding your question, but yes these 3rd party tools read the ldf file directly.

You can also use the DBCC LOG command, but it is undocumented and the output is a bit cryptic.

0
Iza Pastoor On

SQL Server transaction log format is not documented and therefore can’t be used to read data from it directly.

There are tools such as ApexSQL Log that can read the transaction log but it’s only because they probably spent a ton of time reverse engineering its format.

Options for reading are to:

a) figure the format on your own (not recommended) b) get yourself a third party tool c) using functions such as fn_dblog that are also not documented but can give you some details.

0
Ivan Stankovic On

There are different ways to open an LDF file, and most of them do just that – opens it. It’s tricky to get any human readable information and make a use of it though

To be able to read transaction logs in order to see the operation type, the schema and object name of the object affected, the time when the operation was executed, the name of the user who executed the operation, and more, check out the Open LDF file and view LDF file content online article

Note that the provided solution is not affected by whether you read an online transaction log or not - there are no locks that prevent the process of reading and analyzing the transaction log

Disclaimer: I work as a Product Support Engineer at ApexSQL