0

I want to discuss about the Transaction Log of SQL Server, and I searched around, found some product which is accomplished, for example, Lumigent Log Explorer. But I am still interested about it.

Methods I known: 1.Read directly from physical log file 2.Using database command/query, DBCC LOG or through fn_dblog

Problems/difficulties: 1.Log file structure is hard to reverse engineered. 2.When I do lots of INSERTs, the fn_dblog didn't has all of them, for example, when I INSERT 50000 records, the fn_dblog just has 29616 LOP_INSERT_ROWS records, which means 20384 records are truncated?I don't know the internal logical about fn_dblog, can someone explain it?Does the fn_dblog has limitations?

Glad to hear some researches about SQL Server Transaction Log.

1
  • 1
    Were you inserting 50,000 rows in a single statement or 50,000 separate statements. If separate was it still all in one transaction? Also what recovery model is your database in and has it ever been backed up? (i.e. maybe your log is in auto truncate mode at the moment) Commented Sep 11, 2011 at 10:47

3 Answers 3

6

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

ApexSQL Log is a SQL Server transaction log reader which reads online transaction logs, detached transaction logs and transaction log backups – both native and natively compressed. As an LDF viewer, it’s focused on operations (both DML and DDL, 45 in total), and what was changed by execution of these operations: Open LDF file and view LDF file content

Disclaimer: I work as a Product Support Engineer at ApexSQL

3

As paulsm4 already pointed out - transaction log is not meant to be human readable but there are ways to read it using third party tools.

Only tool that really specializes in this is ApexSQL Log but you can also try Quest Toad

1

The SQL Server transaction log isn't meant to be "human readable". It's meant to support SQL Server, allowing transactions, read consistency, etc etc.

SUGGESTION: If you really want to understand SQL Server internals (including how the transaction log works), I strongly encourage you to get a copy of this book:

SQL Server 2008 Internals, Kalen Delaney

It's an excellent book; you will learn a LOT of practical and important information. Satisfaction guaranteed!

1
  • Sure, I have read some part of this book, but it isn't that helpful to know the structures of the file. Commented Sep 11, 2011 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.