SQL Server Database Transaction Log Files- Virtual Log Files: DBCC LOGINFO: Part 1

Hi Friends,

Today, I am going to explain the internal of SQL Server database transaction log files architecture by using DBCC LOGINFO.

Our Transaction log file is just divided into multiple Virtual Log Files known as VLFs. We cannot configure the number of VLF files and the size of VLF Files. When we create a new database then number of virtual log file depends on the initial size Transaction Log file i.e

Case 1 : Number of VLF files are 4 when Transaction Log Size is less than or equals to 64 MB

CREATE DATABASE [TLOG1] ON  PRIMARY 
( NAME = N'TLOG1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\TLOG1.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'TLOG1_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\TLOG1_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO

1_SQL Server_Database_Transaction_Log_Virtual_Log_Files_Circular_Behavior_Part1

Case 2: Number of VLF files are 8 when Transaction Log Size is greater than 64 MB and less than or equals to 1 GB

CREATE DATABASE [TLOG2] ON  PRIMARY 
( NAME = N'TLOG2', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\TLOG2.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'TLOG2_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\TLOG2_log.ldf' , SIZE = 102400KB , FILEGROWTH = 10%)
GO

After creating the above datbase now just chcek the architecture of Log file by running DBCC LOGINFO.The below mention output showing that there are eight VLF files.

2_SQL Server_Database_Transaction_Log_Virtual_Log_Files_Circular_Behavior_Part1

   

Case 3: Number of VLF files are 16 when Transaction Log Size is greater than 1 GB

CREATE DATABASE [TLOG3] ON  PRIMARY 
( NAME = N'TLOG3', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\TLOG3.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'TLOG3_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\TLOG3_log.ldf' , SIZE = 1049600KB , FILEGROWTH = 10%)
GO

After creating the above datbase now just chcek the architecture of Log file by running DBCC LOGINFO.The below mention output showing that there are sixteen VLF files.

3_SQL Server_Database_Transaction_Log_Virtual_Log_Files_Circular_Behavior_Part1

The output of DBCC LOGINFO contains following columns:

1-  FileId : represent log file identifier

2-  FileSize: Size of Virtual Log File

3-  StartOffset: beginning of VLF in terms of bytes

4-  FSeqNo: VLF Sequence number

5-  Status: 0 represent inactive, 2 represents active

6-  Parity: parity information,value may be 0 or 64 or 128

7-  CreateLSN: Log Sequence No. from which VLF begins.

 

Regards

Prince Rastogi

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook

   

About Prince Rastogi

Prince Rastogi is working as Database Administrator at Elephant Insurance, Richmond. He is having more than 8 years of experience and worked in ERP Domain, Wealth Management Domain. Currently he is working in Insurance domain. In the starting of his career he was working on SQL Server, Internet Information Server and Visual Source Safe. He is post graduate in Computer Science. Prince is ITIL certified professional. Prince likes to explore technical things for Database World and Writing Blogs. He is Technical Editor and Blogger at SQLServerGeeks.com. He is a regular speaker at DataPlatformDay events in Delhi NCR. He has also presented some in depth sessions about SQL Server in SQL Server Conferences in Bangalore.

View all posts by Prince Rastogi →

2 Comments on “SQL Server Database Transaction Log Files- Virtual Log Files: DBCC LOGINFO: Part 1”

  1. Hi Prince,

    Nice writeup,

    Just wanted to add: The No. of VLF’s also depend upon the growth size of TLog you’ve configured.

Leave a Reply

Your email address will not be published.