Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read SQL Server 2005 ldf file

Tags:

c#

sql-server

i will try to explain my question in details. In a program that i am writitng i need to read the content of log file for a certain database. I google a little bit and found that ldf is binary file. But i was no able to find the format of the file or any tutorial showing how to read this file. I am writing the program on C# but any examples on any programing languages will be greatly appreciated.

like image 904
IordanTanev Avatar asked May 25 '26 11:05

IordanTanev


1 Answers

The format of the log file is not documented and not public, even the commercial log readers will not pick up everything from the log - they most likely will of reverse engineered it or hired ex-SQL developers who know about it.

Before you concern yourself with decoding the physical file start by trying to decode the output from:

select * from ::fn_dblog(null,null)

That will get you a formatted output of the log and the log binary data in a field - even that is not trivial to decode. As well as the log file format, you will have to have a very indepth knowledge of SQL itself to understand the entries properly.

Overall - I think you are better off buying one of the existing commercial packages, because if you need to ask about the format - your internal knowledge of SQL is unlikely to be good enough.

like image 75
Andrew Avatar answered May 28 '26 00:05

Andrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!