Getting VLF stats for multiple databases

After watching Paul Randal’s (blog | twitter) MCM video on log files, I wanted to find a quick way to get VLF (Virtual Log File) statistics across multiple databases and servers. I went two routes, PowerShell and T-SQL. Our internal monitoring uses T-SQL already, so I wanted to be able to easily work with the existing framework. I wanted to create a PowerShell version, as some others might find it useful and I just like working with PowerShell.

T-SQL Version
I wound up making my table structure the same as David Levy in this blog post. Michelle Ufford has a very similar script at her blog post.

PowerShell Version
Thanks to Aaron Nelson (blog | twitter) for giving me an idea to tweak this.

More on VLFs:

1 thought on “Getting VLF stats for multiple databases

  1. retracement

    Good post there Eric. I wrote something similar in C# with GUI front end a long time ago now, but I really think the Powershell version is a great example of a good reason for DBAs to be learning PS -its simplicity and power.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.