sql power tools - enhance your effectiveness with extended events bob ‘the tool man’ taylor mca,...

29
SQL Power Tools - Enhance Your Effectiveness with Extended Events boB ‘The Tool Man’ Taylor MCA, MCM, MCSD.Net, MCT Microsoft Corporation DBI410

Upload: andrea-stokes

Post on 18-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

SQL Power Tools - Enhance Your Effectiveness with Extended EventsboB ‘The Tool Man’ TaylorMCA, MCM, MCSD.Net, MCTMicrosoft Corporation

DBI410

[email protected]

Blogs.msdn.com/bobtaylor

@SQL_MCA_MCSM

boB ‘The Tool Man’ Taylor

Tweeting? Use #TechEd and #DBI410 hash tags

Why are you here today?

A. I am a SQL Server DBAB. I am a SQL Server DeveloperC. I am an application developerD. The title just sounded coolE. All the above

Which tools do you use on a regular basis?A. SQL Server TraceB. SQL Server ProfilerC. SQLDiagD. RML UtilitiesE. SQL NexusF. All of the above

What do they have in common?

They all use SQL Server Trace

They’ve taken away your tools!

SQL ProfilerSQL TraceSQL DiagRML UtilitiesSQL Nexus

Now what do you do?

Don’t Despair

Good News – New tools are available!Well… not totally newComplete engine coverageFull Tool Support

Bad News – There is a learning curveNot as steep as it used to be

Good News – You will learn these new tools today!

Extended Events Refresher

Real-time data captureNo performance penaltyBased on Event Tracing for Windows (ETW)Full programmability support

Extended Events Object Model

PackagesEvents and ActionsFilters and PredicatesSessionsTargets

Module

Package(s)Events

TargetsActions

Types

Predicates

Maps

Channels

Packages in SQL Server 2012

Name Description

package0 Default package. Contains all standard types, maps, compare operators, actions and targets

sqlos Extended events for SQL Operating System

XeDkPkg Extended events for SQLDK binary (SQLDK.dll now loads package0 and sqlos)

sqlserver Extended events for Microsoft SQL Server

SecAudit Security Audit Events

ucs Extended events for Unified Communications Stack

sqlclr Extended events for SQL CLR

filestream Extended events for SQL Server FILESTREAM and FileTable

sqlserver Extended events for Microsoft SQL Server

System Sessions

system_healthAlwaysOn_health

What does that give me?

Errors reportedNon-yielding schedulersDeadlocksInternal and external wait infosp_server_diagnostics outputPersisted to file or in memory

Viewing a real-time snapshot of system_health

SELECT CAST(xet.target_data as xml) FROM sys.dm_xe_session_targets xetJOIN sys.dm_xe_sessions xe

ON (xe.address = xet.event_session_address)

WHERE xe.name = 'system_health'

demo

boB ‘The Tool Man’ TaylorMCA, MCM, MCSD.Net, MCTMicrosoft Corporation

Extended Events Profiler

What other things can you look at?

sqlserver packagePage splits – see Jonathan Kehayias blogauto_statsbegin / end transaction Over 500 different items!

sqlos packagewait_infowait_info_externalspinlock_backoffsSixty different items

But what about your other tools?

RML Utilities created by SQL Server escalation engineersThose same engineers drove the UI in Management StudioThe Top 10 by CPU or Duration are there out of the box!

demo

boB ‘The Tool Man’ TaylorMCA, MCM, MCSD.Net, MCTMicrosoft Corporation

RML Type Reporting

What about all my Profiler traces definitions?

Almost every Event and column available can be converted into Extended Event equivalents

1. Create a new session2. Look up every trace event and column and convert to events and actions – add to your new session3. Determine if any filters that exists and add those as predicates4. Add target(s)

CREATE EVENT SESSION [SampledQueries] ON SERVER ADD EVENT sqlserver.error_reported( ACTION(sqlserver.client_app_name,sqlserver.database_id,sqlserver.query_hash,sqlserver.session_id) WHERE ((([package0].[divides_by_uint64]([sqlserver].[session_id],(5))) AND ([package0].[greater_than_uint64]([sqlserver].[database_id],(4)))) AND ([package0].[equal_boolean]([sqlserver].[is_system],(0))))),

ADD EVENT sqlserver.sql_batch_completed(ACTION(sqlserver.client_app_name,sqlserver.database_id,sqlserver.query_hash,sqlserver.session_id) WHERE ((([package0].[divides_by_uint64]([sqlserver].[session_id],(5))) AND ([package0].[greater_than_uint64]([sqlserver].[database_id],(4)))) AND ([package0].[equal_boolean]([sqlserver].[is_system],(0))))) ADD TARGET package0.ring_bufferWITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS, MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB, MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)GO

Am I serious?

That is a lot of workIt is if you attempt to do this manually

What we need is a tool!boB ‘The Tool Man’ Taylor is happy to announce…

announcing

http://SQLPie.CodePlex.com

SQLPIE on CodePlex

demo

boB ‘The Tool Man’ TaylorMCA, MCM, MCSD.Net, MCTMicrosoft Corporation

Profiler Into Events (PIE)

Conclusion

They have taken away your old tools!You don’t care!The new tools are better anyway!

Call to actionStart using Extended Events today!

Time for Questions!

Resources

Connect. Share. Discuss.

http://northamerica.msteched.com

Learning

Microsoft Certification & Training Resources

www.microsoft.com/learning

TechNet

Resources for IT Professionals

http://microsoft.com/technet

Resources for Developers

http://microsoft.com/msdn

Complete an evaluation on CommNet and enter to win!

MS Tag

Scan the Tagto evaluate thissession now onmyTechEd Mobile

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.