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
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.
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.
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 Twitter | Follow me on FaceBook
Hi Prince,
Nice writeup,
Just wanted to add: The No. of VLF’s also depend upon the growth size of TLog you’ve configured.
Hi Prince
Nice Articles
PLS ADD YOUR OWN GROUP.
THANKS
09810071963