Monday, December 1, 2025

VLF Counts on all databases

 


---Script to check VLFs count on all databases


SELECT [name], s.database_id,

COUNT(l.database_id) AS 'VLF Count',

SUM(vlf_size_mb) AS 'VLF Size (MB)',

SUM(CAST(vlf_active AS INT)) AS 'Active VLF',

SUM(vlf_active*vlf_size_mb) AS 'Active VLF Size (MB)',

COUNT(l.database_id)-SUM(CAST(vlf_active AS INT)) AS 'In-active VLF',

SUM(vlf_size_mb)-SUM(vlf_active*vlf_size_mb) AS 'In-active VLF Size (MB)'

FROM sys.databases s

CROSS APPLY sys.dm_db_log_info(s.database_id) l

GROUP BY [name], s.database_id

ORDER BY 'VLF Count' DESC

GO

1 comment:

  1. I found this blog really interesting and informative. The content is presented in a clear and engaging way, making it easy for readers to understand the main points. I appreciate the useful information and practical ideas shared throughout the article. It is always helpful to come across blogs that provide meaningful knowledge while keeping the explanation simple and reader-friendly. This article definitely gives readers something valuable to learn and explore. Thank you for putting together such helpful content. I will surely keep an eye out for more informative posts from this blog. Keep sharing great articles and useful insights. Best Fashion Designing institute in Delhi NCR
    Best Makeup Training Institute in Delhi NCR.
    best computer institute in delhi NCR
    Typing & Shorthand Institute in Delhi NCR

    ReplyDelete