DAT308 SQL Server 2000 Profiler: The Database Programmer's Best Friend Fernando G. Guerrero S olid Q uality L earning

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

Your Data Any Place, Any Time Manageability. SQL Server 2008 Manageability Challenges Challenges face database administrators today : Managing complex.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
DEV351 ADO.NET Performance Pablo Castro Program Manager – ADO.NET Team Microsoft Corporation.
WEB401 Security Practices for Web Services (Part 2) Keith Ballinger Program Manager XML Messaging Microsoft Corporation.
Virtual techdays INDIA │ 9-11 February 2011 virtual techdays Auditing Made Easy: Change Tracking and Change Data Capture Pinal Dave │ Technology Evangelist,
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Managing and Monitoring SQL Server 2005 Shankar Pal Program Manager SQL Server, Redmond.
Architecting a Large-Scale Data Warehouse with SQL Server 2005 Mark Morton Senior Technical Consultant IT Training Solutions DAT313.
1 Building Management Applications with SQL Server “Yukon” SQL Management Objects (SMO): Overview Bruce Prang Development Manager Microsoft Corporation.
Microsoft Office Project 2003 Resource Kits James Scott & Roy Riley Technical Content Development Microsoft Corporation.
OFC324 Microsoft Project Server: Putting Enterprise Project Management (EPM) To Work Sam Brooks
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
DEV334 Creating Application Starting Points & Sharing Best Practices with Enterprise Templates Marc Gusmano Director of Emerging Technologies The Information.
Designing for Performance General Database Optimizations Presentation Highlight: The Anatomy of a Data Modification Wednesday, 12 November 2003 – 16:30-18:00.
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
OFC304 Excel 2003 Overview: XML Support Joseph Chirilov Program Manager.
OFC 200 Microsoft Solution Accelerator for Intranets Scott Fynn Microsoft Consulting Services National Practices.
DAT336 SQL Server “Yukon” – The Future of Business Intelligence Jason Carlson Product Unit Manager SQL Server Microsoft Corporation Brian Welcker Microsoft.
DEV290 Building Office Solutions with Visual Studio Eric Carter Lead Developer Developer Platform & Evangelism Microsoft Corporation.
DAT430 Extending SQL Server 2000 Functionality with User-Defined Functions: Hidden Tricks Fernando G. Guerrero S olid Q uality L earning
SEC303 Assessing and Managing Privacy in the Enterprise JC Cannon Privacy Strategist.
DAT305 Boost Your Data-Driven Application Development Using SQL Server Centric.NET Code Generator Pascal Belaud Microsoft France.
OFC 303 Advanced Word XML: Customer-Defined Schemas Brian Jones Program Manager Authoring Services.
DEV325 Deploying Visual Studio.NET Applications Billy Hollis Author / Consultant.
OFC290 Information Rights Management in Microsoft Office 2003 Lauren Antonoff Group Program Manager.
DEV339 Best Practices for Debugging Visual Studio.NET Applications Keith Pleas Architect, Guided Design
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
OFC 307 Office 2003 Solution Case Studies Ray Stephenson Smart Client Technical Evangelist
Paul Butterworth Management Technology Architect
DAT 360: DTS in SQL Server 2000 Best Practices Euan Garden Group Manager, SQL Server Microsoft Corporation.
DEV384 COM+ Lives : New Features in Enterprise Services Included in Windows Server 2003 Catherine Heller Senior Consultant Microsoft Spain.
DEV333 Instrumenting Applications for Manageability with the Enterprise Instrumentation Framework David Keogh Program Manager Visual Studio Enterprise.
DBA 328 Designing for Performance: Optimization with Indexes Kimberly L. Tripp Solid Quality Learning – SolidQualityLearning.com
MBL401.Net Compact Framework: Data Access Best Practices Paul Foster Mobile solutions architect.
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
DAT 332 SQL Server 2000 Data Transformation Services (DTS) Best Practices Euan Garden Product Unit Manager SQL Server Development Microsoft Corporation.
DEV330 Visual Studio.NET IDE Tips and Tricks Billy Hollis Author / consultant.
DEP331 Migrating to Windows XP Mike Coleman Lead Product Manager, Windows XP Microsoft Corporation.
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
MSG331 Exchange Server 2000/2003 Software Development Kit Susan Hill Lead Programmer Writer Microsoft Corporation.
DAT300 SQL Server Notification Services: Application Development Ken Henderson Technical Lead, SQL Server Support Microsoft Corporation
DBA331 Managing a Microsoft SQL Server 2000 Reporting Services Implementation Brian Welcker Group Program Manager SQL Server Microsoft Corporation.
EBIZ302 Jupiter Business Process Automation and Web Services David Fong Program Manager.
DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant.
DAT200 Microsoft® ADO.NET for ADO Classic Developers: Introducing ADO.NET Jackie Goldstein Renaissance Computer Systems
Pinal Dave Mentor | Solid Quality India |
MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation.
OFC311 Developing Microsoft Office InfoPath 2003 Solutions: Technical Drilldown Part 1 Tudor Toma Group Program Manager Office Microsoft Corporation.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
Meeting Date: September 27, 2007 Topic: Converting DTS to SSIS by Brian Knight.
DAT 390 Advanced ADO.NET Programming Techniques Jackie Goldstein Renaissance Computer Systems
SQL Database Management
6/16/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
11/12/2018 6:58 PM © 2004 Microsoft Corporation. All rights reserved.
TechEd /15/2019 8:08 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Microsoft Connect /17/2019 9:55 PM
Fewer cursors since SQL Server 2012 Came Along
4/15/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Andrew Fryer Microsoft UK
Analyzing Performance Problems Using XEvents, DMVs & Query Store
System Center Operations Manager Assessment Results
Analyzing Performance Problems Using XEvents, DMVs & Query Store
Microsoft Virtual Academy
Il-Sung Lee, Jack Richins Microsoft Corp
Presentation transcript:

DAT308 SQL Server 2000 Profiler: The Database Programmer's Best Friend Fernando G. Guerrero S olid Q uality L earning

Hi Profiler! What is happening in my Server? What really happen in my database server? What all these GUI tools are doing to my server? This “black box” application is behaving badly, what is it sending to SQL Server? I know I have some deadlocks, but how can I fix them?

Quick info about Fernando (2 milliseconds) MCSD, MCSE+Internet (W2K), MCDBA, MCT, SQL Server MVP CEO and principal mentor at Solid Quality Learning Writing for SQL Sever Magazine and SQL Server Professional Co-author of Microsoft SQL Server 2000 Programming by Example (ISBN : ) Author of the.NET Operations Guide and the.NET Deployment Guide for Microsoft TechNet

S olid Q uality L earning (3 ms) An association of SQL Server experts from around the world Principal Mentors: Itzik Ben-Gan Kalen Delaney Fernando G. Guerrero Michael Hotek Brian Moran Ron Talmage Kimberly L. Tripp Helping you get the best out of your SQL Server: Training Consulting Mentoring Stay tuned to

Agenda SQL Profiler as Management Tool Looking under the hood of database tools Defining effective Traces Scripting SQL Server Traces

SQL Profiler as Management tool Performance/Network Monitor counts events Event log heap where events are logged Query Analyzer tool to analyze queries Tool to run administrative scripts SQL Trace Server side component of the auditing engine SQL Profiler GUI tool for SQL Trace

SQL Trace / SQL Profiler SQL Trace was an external tool in SQL Server 6.5 SQL Profiler was the audit tool in SQL Server 7.0 SQL Trace is the internal server side audit component in SQL Server 2000 SQL Profiler is the GUI tool for SQL Trace in SQL Server 2000 C2 auditing is a special case of comprehensive trace to meet C2 requirements

SQL Trace / SQL Profiler (2) You can use SQL Trace without SQL Profiler… as long as you know how to script it in Transact-SQL SQL Trace writes events into an external file SQL Profiler can write traces directly into a SQL Server table (SQL Trace can’t) SQL Trace provides an open audit framework where you can even define your own events

Key components of SQL Profiler/Trace General Trace Properties Events Data Columns Filters

General Trace Properties

Events

Data Columns

Filters

Performance implications SQL Trace runs in the server SQL Profiler shouldn’t run in the server The SQL Trace file shouldn’t be stored in the server The SQL table used by Profiler to store the trace shouldn’t be in the main server Under these conditions, running a trace shouldn’t be a big problem Communication bottlenecks might make Profiler losing some events!events

Profiler lowers CPU utilization in the server?

Profiler lowers CPU utilization in the server? (2) If that happens… you have PROBLEMS: The CPU utilization was too high originally You start a trace and SQL Server can’t cope with the extra workload SQL Server limits the throughput so it can run the trace So, SQL Server executes fewer transactions

Profiler lowers CPU utilization in the server? (3) It looks like you find a way to lower CPU utilization after all: Then, your CPU utilization looks better But your clients complain because they can’t get through STOP that b#$%#$ Trace!!! FIX what caused the CPU to be high in the first place

Looking under the hood of Database Tools Let’s look at some demos: Scripting SQL Server Enterprise Manager actions Optimistic concurrency in ADO 2.8 How the SqlDataAdapter sends updates to SQL Server by default DTC Transactions with COM+ components

Scripting SQL Server Enterprise Manager actions demo demo

What the SqlDataAdapter Update method does to SQL Server demo demo

DTC Transactions with COM+ components demo demo

Defining effective Traces Finding the worst-performing queries Detecting the use of cursors Detecting deadlocks Prioritizing objects’ optimization Identifying table and index scans

Finding the worst-performing queries You want to capture the duration of your queries: Capture at least the Duration and TextData columns for: SQL:BatchCompleted SQL:StmtCompleted RPC:Completed SP:Completed DCTTransaction SQLTransaction

Detecting the use of cursors Cursors are EVIL… in principle Capture the following events: CursorOpen CursorClose CursorExecute CursorImplicitConversion

Detecting deadlocks This could be the most complex and comprehensive trace you can create Errors and warnings Deadlocks SQL statements Transactions I prefer to show it with a demo

Detecting Deadlocks demo demo

Prioritizing objects’ optimization You want to know: How many times every Procedure/UDF is executed What are the procedures/UDFs using more execution time in SQL Server How long it takes to execute each Procedure/UDF in average You want to focus your optimization work on the most “popular” objects You want to get the highest performance boost from your tuning work

Prioritizing objects’ optimization demo demo

Identifying table and index scans You should monitor: Scan: Started Transaction ID Object ID Index ID Mode Scan: Stopped Object ID Index ID Duration Reads

Scripting SQL Server Traces You can create a trace by using the following procedures: Sp_trace_create Sp_trace_setevent Sp_trace_setfilter Sp_trace_setstatus Get information from a trace: Fn_trace_getinfo Fn_trace_gettable Fn_trace_geteventinfo Fn_tarce_getfilterinfo

Scripting a Trace from SQL Server Profiler demo demo

User-defined events = sp_trace_generateevent = ] event_id [, = ] 'user_info' ] [, = ] user_data ] Event_id should be between 82 and 91 User_info is nvarchar(128) (sysname) User_data is varbinary(8000) These events are traced as any other system events

Summary SQL Profiler as Management Tool Looking under the hood of database tools Defining effective Traces Scripting SQL Server Traces Do you love Profiler a bit more? ♥

Ask The Experts Get Your Questions Answered I’ll be at the Ask the Experts area: 2 July 2003: 12:00-14:00 3 July 2003: 11:00-13:00 4 July 2003: 12:00-14:00 You’ll see me around some more times

Community Resources Most Valuable Professional (MVP) Newsgroups Converse online with Microsoft Newsgroups, including Worldwide User Groups Meet and learn with your peers

Suggested Reading And Resources The tools you need to put technology to work! TITLEAvailable Microsoft® SQL Server 2000™ Performance Tuning Technical Reference: Today Microsoft Press books are 20% off at the TechEd Bookstore Also buy any TWO Microsoft Press books and get a FREE T-Shirt

Thank you! Questions? Download the source code of this session from: You can contact me at:

evaluations evaluations

© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.