Structure of Log Block

In the previous post, I already describe about how to locate the physical address of log block. Each log block in Microsoft SQL Server 2000’s LDF file contains the log records, depends on amount of slot id that is allocated.

I will use the following database to describe the structure of log block :


Now let’s take LSN 00000ec0:00000079:0003. The file sequence number for this LSN is 0xEC0 = 3776. So, the log block is located at this offset :

0x79 = (121 * 512) + 8192 which is at offset 70144 = 0x11200.

By using hex editor program, and for ease of structure interpretation, I copied the located block into new file :


The red box contains the number of slots available in this log block. In this sample, contains 6 slots.

The green one denotes the size of this log block. In this sample is 0x0240.

The size of log block is the sum of all log record + the size of slot offset allocation.

To determine the location of each slot, at the end of last log record, the block contains all slot offsets. In this sample, the slot offset is located at offset 0x0235 :


In this sample :

1st slot is located at offset 0x0018
2nd slot is located at offset 0x0054
3rd slot  is located at offset 0x008C, etc.

This kind of low level of interpretation is sometime indispensable, because, even the DBCC LOG can not access all of the log record data, as I have encountered in my post about the study case of using the log file for data recovery.

After the block structure is defined, now the next task is to decipher the log record, that will be the subject of my next post. Stay tuned 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: