Tara Kizer Database Administrator at Qualcomm, Inc. SQL Server MVP

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Tara Kizer

Database Administrator at Qualcomm, Inc.


SQL Server MVP
 Best Practices
 Never run SQL Profiler directly on the database server
 Never trace directly to a table, instead trace to a file
 Filter the results, such as Duration > 500
 Include only the events that you need, such as RPC:Completed
 Instead of SQL Profiler, run a server-side trace (least expensive way to trace)
 Profiler shows Duration in milliseconds; trace file/table is in microseconds
 Quick trace demo
 Query the trace file via ::fn_trace_gettable function
 Script Trace Definition
 Server-side trace
 Schedule SQL Agent job
 sp_trace_create – creates the definition
 sp_trace_setevent – adds the events
 sp_trace_setfilter – sets the filters
 sp_trace_setstatus – start it (1), stop it (0), delete it (2)
 sys.trace_events – list of events (id,name)
 fn_trace_getinfo – shows what server-side traces are running
on the server
 fn_trace_gettable – query the trace file
 http://www.scalesql.com/cleartrace/
 Similar to Read80Trace but with a GUI – normalizes the data
(removes data values so you can group queries together)
 Demo it
 Tables  Jobs
 Numbers (1-10)  Trace Cleanup
 TraceData  Trace Purge
 TraceQueue  Trace Save
 Stored Procedures  Trace Start
 TraceCleanup  Trace Stop
 TracePurge  Trace Stop All
 TraceSave  Trace Stop/Start on Agent
 TraceStart Restart
 TraceStop
 TraceStopAll
 Baseline your system
 Just like SQL Profiler, do not run on the database server
 CPU
 Processor\% Processor Time - _Total
 System\Processor Queue Length
 IO
 Logical Disk\Avg. Disk sec/Read – Data/Log files
 Logical Disk\Avg. Disk sec/Write – Data/Log files
 Memory
 Memory\Available Mbytes
 Memory\Pages/sec
 SQL Server
 MSSQL$InstanceName:Buffer Manager\Buffer cache hit ratio
 MSSQL$InstanceName:Buffer Manager\Page life expectancy
 MSSQL$InstanceName:Memory Manager\Target Server Memory(KB)
 MSSQL$InstanceName:Memory Manager\Total Server Memory(KB)
 MSSQL$InstanceName:SQL Statistics\Batch Requests/sec
 Indexes: http://sqlserverpedia.com/wiki/Index_Related_DMV_Queries
 Find Missing Indexes
 Find Indexes Not In Use
 Where is the bottleneck?
 sys.dm_os_wait_stats:
http://www.mssqltips.com/tip.asp?tip=1949
 sys.dm_os_performance_counters:
http://www.mssqltips.com/tip.asp?tip=2042
 sys.dm_exec_requests, sys.dm_exec_sessions:
http://www.mssqltips.com/tip.asp?tip=1861
 Top SQL Server Performance Issues for OLTP Applications:
http://technet.microsoft.com/en-us/library/cc966401.aspx
Contact - http://weblogs.sqlteam.com/tarad/contact.aspx
SQL Server Blog - http://weblogs.sqlteam.com/tarad
MVP Profile - https://mvp.support.microsoft.com/profile/Tara.Kizer

Watch for a new blog post early next week about this presentation.

You might also like