30.06.2013 Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

WHERE cntr_type = @PERF_COUNTER_LARGE_RAWCOUNT<br />

AND object_name = @object_name<br />

AND counter_name IN ( 'Log Growths', 'Log Shrinks' )<br />

AND cntr_value > 0<br />

ORDER BY object_name ,<br />

counter_name ,<br />

instance_name<br />

Listing 7.8: Monitoring changes in the size of the transaction log.<br />

279<br />

Chapter 7: OS and Hardware Interaction<br />

Log size adjustments aren't problematical in all cases but it is quite costly to have users on<br />

a busy server waiting while space is being allocated to the log, and an excessive number<br />

of small auto-grow events will fragment the log. Shrinking the log (i.e. removing any<br />

unused space) is, as a general habit, a bad idea as it just means that you are likely to see a<br />

log growth event very soon. The best practice is to have log space pre-allocated and not to<br />

adjust it; free log space is not harmful to performance, but a full log is.<br />

Deprecated feature use<br />

In 2008, a new set of counters was added to show deprecated feature utilization. You can<br />

get to them using a query of the form shown in Listing 7.9. In cases where you've recently<br />

upgraded a system, it's useful to know what deprecated features are still being used, so<br />

that you can plan on updating them, to avoid having them fail when you are upgrading<br />

again in a few years.<br />

DECLARE @object_name SYSNAME<br />

SET @object_name = CASE WHEN @@servicename = 'MS<strong>SQL</strong>SERVER' THEN '<strong>SQL</strong><strong>Server</strong>'<br />

ELSE 'MS<strong>SQL</strong>$' + @@serviceName<br />

END + ':Deprecated Features'<br />

DECLARE @PERF_COUNTER_LARGE_RAWCOUNT INT<br />

SELECT @PERF_COUNTER_LARGE_RAWCOUNT = 65792<br />

SELECT object_name ,<br />

counter_name ,<br />

instance_name ,<br />

cntr_value

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!