Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.

Slides:



Advertisements
Similar presentations
Course 2786B Module 8: Implementing an Active Directory® Domain Services Monitoring Plan Presentation: 60 minutes Lab: 60 minutes This module helps students.
Advertisements

Module 3: Creating and Tuning Indexes. Planning Indexes Creating Indexes Optimizing Indexes.
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Anil Desai Austin CodeCamp 2010.
Advanced SQL Schema Customization & Reporting Presented By: John Dyke As day to day business needs become more complex so does the need for specifically.
Module 12: Auditing SQL Server Environments
– Optimizing Performance Paweł Hofman PLSSUG Wrocław 7 grudnia 2009.
Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.
Troubleshooting Techniques Lesson 29. Skills Matrix.
Module 15: Managing Transactions and Locks. Overview Introduction to Transactions and Locks Managing Transactions SQL Server Locking Managing Locks.
Anil Desai Austin CodeCamp  Anil Desai ◦ Independent consultant (Austin, TX) ◦ Author of several SQL Server books ◦ Instructor, “Implementing and.
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.
Passage Three Introduction to Microsoft SQL Server 2000.
SQL Server Management Studio Introduction
SQL Server Performance Audit and Tuning Jason Pack.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
Module 13 Automating SQL Server 2008 R2 Management.
Module 17 Storing XML Data in SQL Server® 2008 R2.
Module 2: Using Transact-SQL Querying Tools. Overview SQL Query Analyzer Using the Object Browser Tool in SQL Query Analyzer Using Templates in SQL Query.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Monitoring and Optimizing SQL Server 2005 Performance Anil Desai.
Module 12 Handling Errors in T-SQL Code. Module Overview Understanding T-SQL Error Handling Implementing T-SQL Error Handling Implementing Structured.
Module 8 Improving Performance through Nonclustered Indexes.
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
Configuring Encryption and Advanced Auditing
Module 7: Fundamentals of Administering Windows Server 2008.
Module 19 Managing Multiple Servers. Module Overview Working with Multiple Servers Virtualizing SQL Server Deploying and Upgrading Data-Tier Applications.
DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
How to solve a SQL performance problem Paul Zgondea.
Module 9 Designing and Implementing Stored Procedures.
Module 6 Backup of SQL Server 2008 R2 Databases. Module Overview Backing up Databases and Transaction Logs Managing Database Backups Working with Backup.
Module 11: Programming Across Multiple Servers. Overview Introducing Distributed Queries Setting Up a Linked Server Environment Working with Linked Servers.
Module 5 Planning for SQL Server® 2008 R2 Indexing.
Module 14 Configuring Security for SQL Server Agent.
Monitoring Windows Server 2012
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
Module 16: Performing Ongoing Database Maintenance
Module 10 Assigning Server and Database Roles. Module Overview Working with Server Roles Working with Fixed Database Roles Creating User-defined Database.
Module 15 Monitoring SQL Server 2008 R2 with Alerts and Notifications.
A Brief Documentation.  Provides basic information about connection, server, and client.
Module 14 Monitoring and Optimizing SharePoint Performance.
Module 8: Implementing Stored Procedures. Overview Implementing Stored Procedures Creating Parameterized Stored Procedures Working With Execution Plans.
Module 4 Designing and Implementing Views. Module Overview Introduction to Views Creating and Managing Views Performance Considerations for Views.
Module 8: Implementing an Active Directory Domain ® Services Monitoring Plan.
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
Module 11 Authorizing Users to Access Resources. Module Overview Authorizing User Access to Objects Authorizing Users to Execute Code Configuring Permissions.
Module 5: Implementing Merge Replication. Overview Understanding Merge Replication Architecture Implementing Conflict Resolution Planning and Deploying.
Module 1 Introduction to SQL Server® 2008 R2 and its Toolset.
Module 10: Windows Firewall and Caching Fundamentals.
Module 12: Configuring and Managing Storage Technologies
Module 10: Implementing Administrative Templates and Audit Policy.
Module 11: Managing Transactions and Locks
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Module 14: Managing Transactions and Locks. Overview Introducing Transactions and Locks Managing Transactions Understanding SQL Server Locking Architecture.
SQL SERVER AUDITING. Jean Joseph DBA/Consultant Contact Info: Blog:
Module 10 Merging Data and Passing Tables. Module Overview Using the MERGE Statement Implementing Table Types Using Table Types As Parameters.
Module 9: Using Advanced Techniques. Considerations for Querying Data Working with Data Types Cursors and Set-Based Queries Dynamic SQL Maintaining Query.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
SQL Database Management
Planning a Migration.
Monitoring Windows Server 2012
SQL Server Monitoring Overview
Overview Implementing Triggers Implementing XML Schemas.
Module 10: Implementing Managed Code in the Database
Presentation transcript:

Module 17 Tracing Access to SQL Server 2008 R2

Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine Tuning Advisor Working with Tracing Options

Lesson 1: Capturing Activity using SQL Server Profiler Overview of SQL Server Profiler Available Tracing Output Options Commonly used Trace Events Commonly used Trace Columns Filtering Traces Working with Trace Templates Demonstration 1A: Capturing Activity using SQL Server Profiler

Overview of SQL Server Profiler Based on the SQL Trace programming interface Used in many scenarios such as debugging, performance monitoring, deadlock monitoring, and many others Replay functionality for stress testing SQL Server Profiler is a tool used to trace activity against SQL Server.

Available Tracing Output Options Profiler traces can be saved in tables and files For file output, ensure that you configure:  Maximum file size (default of 5MB is almost always too small)  Enable file rollover (if appropriate)

Commonly used Trace Events  Events: The occurrence of an action within SQL Server Categories: Groups of related trace events Events: The occurrence of an action within SQL Server Categories: Groups of related trace events Example EventDescription SQL:BatchCompleted A SQL Server batch completed SQL:StmtCompleted A T-SQL statement completed RPC:Completed A remote procedure call (stored procedure) completed Audit Login / Audit LogoutLogin or Logout occurred Deadlock Graph An XML description of a deadlock was captured

Commonly used Trace Columns Avoid capturing too many columns, to minimize trace size Not all events provide data in every column Columns can be used to group event data Trace columns represent data (often attributes) that can be captured when an event occurs.

Filtering Traces Avoid capturing too many events, to minimize:  Trace size  Performance impact  Complexity during analysis Filter is only applied when the filtered column is supported by the selected event

Working with Trace Templates SQL Server provides a number of standard templates Users can save trace templates from existing trace configurations Trace templates are predefined (or user-defined) sets of event classes and trace columns.

Demonstration 1A: Capturing Activity using SQL Server Profiler In this demonstration, you will see: How to create and run a trace using SQL Server Profiler How to use a trace to capture SQL Server activity How to save the trace to a file

Lesson 2: Improving Performance with the Database Engine Tuning Advisor Overview of Performance Tuning Available Options for Performance Tuning Introduction to the Database Engine Tuning Advisor Database Engine Tuning Advisor Options Demonstration 2A: Using the Database Engine Tuning Advisor

Overview of Performance Tuning Define Goals Select Tools Identify Metrics Implement Changes Monitor Outcomes Analyze Results

Available Options for Performance Tuning Database Engine Tuning Advisor SSMS  Activity Monitor  Standard Reports  Custom Reports Dynamic Management Objects SQL Server Data Collection SQL Server Profiler SQL Trace SQL Server Extended Events Reliability and Performance Monitor

Database Engine Tuning Advisor Reports and Recommendations Workload Database Engine Tuning Advisor Database and Database Objects Used to suggest index and statistics changes for improving performance Processes workloads captured by SQL Server Profiler as traces

Database Engine Tuning Advisor Options Limit the time for analysis  Analysis can take a long time for large schemas and workloads Determine the types of recommendations that should be returned

Demonstration 2A: Using the Database Engine Tuning Advisor In this demonstration you will see how to use the Database Engine Tuning Advisor to generate indexing and partitioning recommendations for a query

Lesson 3: Working with Tracing Options Overview of SQL Trace SQL Trace vs. SQL Server Profiler Demonstration 3A: SQL Trace Retrieving Trace Output Replaying Traces Default Trace Combining Traces with Reliability and Performance Monitor Logs Demonstration 3B: Combining Traces with Reliability and Performance Monitor Logs

Overview of SQL Trace SQL Server Profiler can be used to script SQL traces Events can be sent to files or SMO objects SQL Server Profiler uses SMO to create and consume traces SQL Trace is a programming interface that is based on system stored procedures and is used for capturing activity against SQL Server.

SQL Trace vs. SQL Server Profiler SQL Trace Defined through procedures Runs directly within the database engine Writes events to files or SMO Used for:  Long term monitoring  Performance-critical traces  Large traces SQL Server Profiler Use via a Graphical tool Utilizes SQL Trace Write to files or database tables Used for:  Debugging on test systems  Short term analysis  Small traces

Demonstration 3A: SQL Trace In this demonstration, you will see:  How to script a trace using SQL Server Profiler  How to start a SQL Trace  How to viewing a SQL Trace using SQL Server Profiler

Retrieving Trace Output SQL Server Traces are written to files Traces can be analyzed by:  Opening the trace in SQL Server Profiler  Importing the trace into a SQL Server table CREATE TABLE dbo.tracetable ( TextData varchar(max) NULL, BinaryData varbinary(max) NULL,... ); INSERT INTO dbo.tracetable SELECT * FROM fn_trace_gettable('L:\Traces\adworks.trc',default); CREATE TABLE dbo.tracetable ( TextData varchar(max) NULL, BinaryData varbinary(max) NULL,... ); INSERT INTO dbo.tracetable SELECT * FROM fn_trace_gettable('L:\Traces\adworks.trc',default);

Replaying Traces Multithreaded playback engine to reproduce activity  Validate configuration changes  Test performance changes Specific Events and Columns must be present in trace file  Use TSQL_Replay trace template

Default Trace Traces mostly configuration changes for troubleshooting  Written to log directory of SQL Server  Uses up to five 20MB trace rollover files Is on by default  Can be configured using sp_configure: EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'default trace enabled', 1; RECONFIGURE; EXEC sp_configure 'show advanced options', 0; RECONFIGURE; EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'default trace enabled', 1; RECONFIGURE; EXEC sp_configure 'show advanced options', 0; RECONFIGURE;

Combining Traces with Performance Monitor Logs Correlate Performance Monitor with SQL Trace events in SQL Server Profiler

Demonstration 3B: Combining Traces with Performance Monitor Logs In this demonstration, you will see how to combine a SQL Server trace with a performance monitor log.

Lab 17: Tracing Access to SQL Server Exercise 1: Capture a trace using SQL Server Profiler Exercise 2: Analyze a trace using Database Engine Tuning Advisor Challenge Exercise 3: Configure SQL Trace (Only if time permits) Logon information Estimated time: 45 minutes

Lab Scenario The developers for the new marketing application are concerned about the performance of their queries. When the developers were testing the application they were working with small amounts of data and performance was acceptable. The developers are unsure that they have created appropriate indexes to support the application. You will use SQL Server Profiler to capture traces of application execution. You will then analyze the traces using the Database Engine Tuning Advisor. If you have time, you will configure traces using the SQL Trace system stored procedures.

Lab Review In what situations would you use SQL Trace rather than SQL Server Profiler? How would you limit the contents of your trace to events that are related to a specific database?

Module Review and Takeaways Review Questions Best Practices