High Level View of Log File

Microsoft SQL Server 2000’s log file consists of many virtual log files (VLF).

The first VLF is located after the first page of size 8192 bytes (file header page), starting from offset 8192 (i.e. 0x2000), the calculation of the next VLF is based on this first log VLF.

Here is a sample of the VLF (the very first VLF) and some important bytes to determine next physically offset location of VLF files :

 VLF1

First offset (red box) is the signature, offset 0x04 through 0x07 is file sequence number. Offset starting from 0x10 is the file size.

So, in order to determine the next VLF, just add the current offset value to the size. In this example, the offset of first VLF is 0x2000 and the size (0x3E000), so the next VLF is :

0x2000 + 0x3E000 = 0x40000.

The VLF at the next offset location also has this same format and information, hence, formed the chain of all VLFs.

This information is useful to do some quick checks of VLF data and also log records of interest whenever the database is in suspect mode or can not be attached, but we want to view the log file.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s


%d bloggers like this: