join the MSSQLTips community

Today's Site Sponsor


 

Find performance issues related to Analysis Services memory limits.
 


Monitor Your SQL Server Virtual Log Files with Policy Based Management
Written By: Thomas LaRock -- 2/9/2010 -- 0 comments -- printer friendly -- become a member




        Win SQL Books  -----  SharePoint Tips  -----  Live Webcast - SQL Backup Mistakes  -----  Bookmark and Share        

Problem

SQL Server splits your physical transaction log file into logical chucks, called virtual log files (VLF). While your transaction log file may look like one file, logically it is fragmented and the level of fragmentation can result in performance degradation. You can take action to correct the situation, but first you need to know if the situation exists  In this tip I will walk you through how to identify this issue.

Solution

You can use Policy Based Management (PBM) to determine which databases currently have extensive VLF fragmentation. The creation of a policy will allow for you to quickly and easily scan all databases in your enterprise.


Inside of SSMS, navigate to the policies folder, right-click, and select 'New Policy...'.

In the name field enter in 'T-Log VLF Check Policy', then click on the arrow in the Check condition dropdown and select 'New condition...':

In the name field enter 'T-Log VLF Check Condition'. For the Facet select 'Database', then click on the ellipses next to the 'Field' dropdown.

Here is where the magic will happen. Cut and paste the following code into the 'Cell value':

ExecuteSql('Numeric', '
create table #tmp (FileID varchar(3), FileSize numeric(20,0),
   StartOffset bigint, FSeqNo bigint, Status char(1),
   Parity varchar(4), CreateLSN numeric(25,0))
insert into #tmp
EXEC (''dbcc loginfo'')
select COUNT(*) from #tmp
drop table #tmp
')

Click 'OK'

Then set the Value field to be 50, the Operator to be less than or equal to, and click OK again.

Make certain the check box for every database is enabled, and click OK again.

Your policy is created, next up is to evaluate, right click on the policy and select Evaluate:

Click Evaluate, then Run if you get prompted (again) about your policy containing a script. Any databases with more than 50 VLF’s will be flagged.


Result

Here is a screenshot of a sample result set returned by the policy.


 

Next Steps

  • Navigate to an instance of SQL 2008 and create the policy as outlined above.
  • If you find a database with more than 50 VLF's, you should take action as outlined here.
Readers Who Read This Tip Also Read Comment or Ask Questions About This Tip Twitter This Tip!


The complete performance solution for Microsoft SQL Server

SQL Sentry Software, a complete performance monitoring and optimization solution for Microsoft SQL Server

    SQL Sentry Performance Advisor for SQL Server   SQL Sentry Performance Advisor for SQL Server   SQL Sentry Performance Advisor for SQL Server  
  SQL Server + Windows
Performance Dashboard
Powerful SSAS Performance
Dashboard
Calendar Views of Top SQL,
Blocks, Deadlocks & Jobs
  Real-Time & Historical
Performance Analysis
Innovative Workload and
Bottleneck Profiling
Calendar Views of SSAS,
SQL Server, SSIS, and SSRS
  Disk Activity, Latency,
and Capacity Monitoring
Capture of all Heavy MDX,
XMLA and DMX
Easy Job Chaining
and Queuing
 
  Top SQL Analysis Highlights
Heaviest Queries
Aggregation, Partition and
Dimension Activity by Query
Robust Alerting and
Response System
  Graphical Blocking and
Deadlock Analysis
SSAS Cache and Storage
System Monitoring
     
 
Free Trial Download: sqlsentry.net
SQL Sentry, Inc.  

 

 

Idera - SQL comparison toolset

Idera SQL comparison toolset is a set of products that perform object and data comparison, as well as synchronization. No need to purchase two separate products…get both in a single toolset! The tools are easy-to-use and can save hours of development time and make object and data comparison and synchronization quick and easy.

Download now!



More SQL Server Tools
SQL defrag manager

SQL compliance manager

SQL diagnostic manager

SQL Backup

SQL comparison toolset


Sponsor Information
Free SQL Server performance monitoring dashboard – Idera SQL check

The SQL Toolbelt – all 13 Red Gate SQL Server Tools.

What you don't know could be your biggest asset! Innovative SQL Server Consultants.

Looking for SQL Server interview questions and answers?

Learn SQL Server 2008, Performance Tuning, Development, Administration, DR, Replication and more from these web casts

All SQL Server, all the time! Sign-up for the MSSQLTips newsletter!

Interested in SharePoint? Love the tips? Check this out...

Free whitepaper - How to Achieve 40:1 Backup Compression with LiteSpeed® for SQL Server’s



Copyright (c) 2006-2010 Edgewood Solutions, LLC All rights reserved
privacy statement | disclaimer | copyright | advertise | write for mssqltips | feedback | about
Some names and products listed are the registered trademarks of their respective owners.