Friday, October 12, 2012

How to describe VLF's

VLF: Virtual Log File

To find Number of VLFs in your log file by using
Command:
        DBCC loginfo.

A simple question from one of the deabtor..
Ex: I have 10 MB Log File with 4 VLF s , each size is 2621440. I wanted to change it as 100MB of Total. After Changing do you know how the VLF s would be?

Explanation:

Basically the adding Chunck ( FutureSize - OriginalSize).. that would be
100MB-10MB = 90MB
So If you are adding < = 64MB Chunk Should creates (adds to the old VLFs) 4 equal sized VLFs
   If you are adding > 64MB and <= 1GB chunk should creates 8 equal sized VLFs
   IF you are adding > 1GB chunk should creates 16 equal sized VLFs

Note : The original VLFs remains same....

Now the calculation part :
Note : The VLFs sizes always in Bytes...

So we have to consider the second case in our situation.
Convert Total Chunk into Bytes ..
90MB = 90*1024 KB = 90* 1024*1024 Bytes = 94371840 Bytes

Now Divide in to 8 Equal parts...11796480 Bytes (As it creates 8 VLFs for 90MB considering Second Ifcondition above)

Finally, You have 12 VLFs there after modifying your log from 10MB to 100MB
and the first/original 4 remains same as earlier
and the latest 8 VLFs holds 11796480 Bytes each.


No comments:

Post a Comment