Anil Desai Austin CodeCamp 2008.  Anil Desai ◦ Independent consultant (Austin, TX) ◦ Author of several SQL Server books ◦ Instructor, “Implementing and.

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

Anil Desai Austin CodeCamp 2010.
Your Data Any Place, Any Time Manageability. SQL Server 2008 Manageability Challenges Challenges face database administrators today : Managing complex.
Module 12: Auditing SQL Server Environments
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
– Optimizing Performance Paweł Hofman PLSSUG Wrocław 7 grudnia 2009.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Performance and Scalability. Optimizing PerformanceScaling UpScaling Out.
MCTS GUIDE TO MICROSOFT WINDOWS 7 Chapter 10 Performance Tuning.
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 SQL Saturday #35 (Dallas, TX).  Anil Desai ◦ Independent consultant (Austin, TX) ◦ Author of several SQL Server books ◦ Instructor, “Implementing.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
The Essentials: DMV’s and T-SQL for the DBA Rocky Mountain Tech Tri-Fecta.
11 MONITORING MICROSOFT WINDOWS SERVER 2003 Chapter 3.
Amit Banerjee Support Escalation Engineer Microsoft Corporation SQL Server FAQ: TroubleshootingSQL:
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.
Passage Three Introduction to Microsoft SQL Server 2000.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
SQL Server Optimization for Developers
Connect with life Praveen Srvatsa Director | AsthraSoft Consulting Microsoft Regional Director, Bangalore Microsoft MVP, ASP.NET.
SQL Server 2005 SP2 Israeli SQL Server User Group March 2005 Ami Levin
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
Performance and Scalability. Performance and Scalability Challenges Optimizing PerformanceScaling UpScaling Out.
1 Chapter Overview Monitoring Server Performance Monitoring Shared Resources Microsoft Windows 2000 Auditing.
Managing Transaction and Lock Vu Tuyet Trinh Hanoi University of Technology 1.
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 |
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
Monitoring and Optimizing SQL Server 2005 Performance Anil Desai.
MCTS Guide to Microsoft Windows 7
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
Module 7: Fundamentals of Administering Windows Server 2008.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Module 10: Monitoring ISA Server Overview Monitoring Overview Configuring Alerts Configuring Session Monitoring Configuring Logging Configuring.
Agenda for Today Do Chapter 14 Final Project Review for Final.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Securing SQL Server 2005 Anil Desai. Speaker Information Anil Desai –Independent consultant (Austin, TX) –Author of several SQL Server books –Instructor,
Transactions and Locks A Quick Reference and Summary BIT 275.
SQL Server 2000 Sys Admin Jeremiah Curtis Engineering Services
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
SQL School is strongly committed to provide COMPLETE PRACTICAL REALTIME Trainings on SQL Server Technologies – Dev, SQL DBA, MSBI (SSIS, SSAS, SSRS) and.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
Your Data Any Place, Any Time Performance and Scalability.
Module 11: Managing Transactions and Locks
Module 14: Managing Transactions and Locks. Overview Introducing Transactions and Locks Managing Transactions Understanding SQL Server Locking Architecture.
Retele de senzori Curs 2 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
Linkedin: dennisegraham Dennis E Graham Reporting For SQL Health.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
Locks, Blocks & Isolation Oh My!. About Me Keith Tate Data Professional for over 14 Years MCITP in both DBA and Dev tracks
Session Name Pelin ATICI SQL Premier Field Engineer.
SQLintersection Locks, Blocks, and Deadlocks Oh My! Randy Knight Wednesday, 2:15-3:15.
Getting the Most from SQL Server 2005 Don Vilen Program Manager SQL Server Microsoft Corporation.
SQL Database Management
Monitoring Windows Server 2012
SQL Server Monitoring Overview
Designing Database Solutions for SQL Server
MONITORING MICROSOFT WINDOWS SERVER 2003
Microsoft Dumps Question Answer - Dumps4download
Transactions, Locking and Query Optimisation
Presentation transcript:

Anil Desai Austin CodeCamp 2008

 Anil Desai ◦ Independent consultant (Austin, TX) ◦ Author of several SQL Server books ◦ Instructor, “Implementing and Managing SQL Server 2005” (Keystone Learning) ◦ Info: or

I. Performance Monitoring Overview II. Monitoring SQL Server III. Using SQL Profiler IV. Using the Database Engine Tuning Advisor V. Managing Processes, Locking, and Deadlocks

Developing processes and approaches for performance optimization

 Best Practices: ◦ Optimize for real-world workloads ◦ Monitor/review performance regularly ◦ Focus on specific issues Establish a baseline Identify bottlenecks Make one change at a time Measure performance Repeat (if desired)

Windows System Monitor Alerts (Performance-Based) System/OS SQL Profiler / SQL Trace Activity Monitor / SQL Server Agent Alerts Dynamic Management Views (DMVs) SQL Server Database Engine Tuning Advisor Query Execution Plans Query- Level

Using various SQL Server features to monitor database activity

 Overviews of SQL Server usage ◦ Can export to Excel or PDF  Server-Level Report Examples: ◦ Server Dashboard ◦ Memory Consumption ◦ Activity – All Block Transactions ◦ Activity – Top Sessions ◦ Performance – Batch Execution Statistics ◦ Performance – Top Queries by Average CPU ◦ Object Execution Statistics

 Examples: ◦ Disk Usage ◦ All Transactions ◦ All Blocking Transactions ◦ Index Usage Statistics ◦ Top Transactions by Age ◦ Schema Changes History  New reports added in Service Packs ◦ Ability to use custom reports

 Windows Event Logs / Event Viewer ◦ Application and System Event Logs  SQL Server Management Studio ◦ SQL Server Logs  Can configure max. # of log files ◦ SQL Server Agent Error logs  Can configure logging levels (Errors, Warnings, Information)  Using the Log File Viewer ◦ Can Export / Load log information ◦ Can search for specific errors/messages

 Purpose: ◦ Monitoring and troubleshooting ◦ View server state and performance details ◦ Returns relational result sets  Scopes: ◦ Server level ◦ Database level

 Examples: ◦ Database Engine  Sys.DM_DB_File_Space_Usage ◦ Indexes  Sys.DM_DB_Index_Operational_Stats  Sys.DM_DB_Index_Physical_Stats ◦ I/O Related  Sys.DM_IO_Pending_IO_Requests  Sys.DM_IO_Virtual_File_Stats ◦ Common Language Runtime ◦ Database Mirroring ◦ Transactions

 Data Collected: ◦ System Information (MSINFO) ◦ Windows Event Logs ◦ SQL Server configuration  Command-Line Utility (SQLDiag.exe) ◦ Stores output to files ◦ Configuration file: SQLDiag.xml ◦ Can run as a service (/R) ◦ Can run in continuous mode

Monitoring SQL Server Activity

 Purpose / Features: ◦ GUI for managing SQL Trace ◦ Monitor important events ◦ Capture performance data / resource usage ◦ Replaying of workloads / transactions ◦ Identifying performance bottlenecks ◦ Correlation of data with System Monitor ◦ Workloads for Database Tuning Advisor  Examples: ◦ Generate a list of the 100 slowest queries ◦ Monitor all failed logins (Security)

 SQL Profiler Terminology ◦ Trace Definitions ◦ Events ◦ Columns ◦ Filters  Creating and Managing SQL Traces ◦ SQL Profiler (GUI) ◦ System Stored Procedures (Transact-SQL)  Trace Templates (Built-In) ◦ Standard (Default), SP_Counts ◦ TSQL, TSQL_Duration, TSQL_Grouped,TSQL_Replay, TSQL_SPs ◦ Tuning

 Groupings: ◦ Event Categories ◦ Event Classes ◦ Events  Examples: ◦ TSQL ◦ Stored Procedures ◦ Performance ◦ Errors and Warnings ◦ Security auditing Event Categories Event Classes Events

 Specify the details to be recorded  Columns can be ordered and grouped  Values can be filtered  Examples of Columns: ◦ StartTime / EndTime ◦ TextData ◦ Duration ◦ Resource Usage (CPU, Reads, Writes) ◦ Information: User, Database, App. Names

 Interactive ◦ Good for “live” monitoring of small sets of data  Trace Files (*.trc) ◦ Can enable file rollover based on size ◦ “Server processes trace data” option  Trace table ◦ Will automatically create the table ◦ Can set maximum number of rows  Scheduling of traces (stop time)

 Launching SQL Profiler  Connecting to a database instance  Configuring output options  Create a trace definition  Specifying events, columns, and filters  Running and viewing a trace

 Creating new templates  Scripting trace definitions  Extracting SQL Server Events ◦ Transact-SQL Events ◦ ShowPlan Events ◦ Deadlock Events

 Purpose / Goal: ◦ Correlate server performance with database performance  Process: ◦ Define and start a counter log ◦ Define and start a SQL Profiler trace ◦ Import Performance Data in SQL Profiler  Required Trace properties ◦ StartTime ◦ EndTime

 Can monitor local or remote computers  Performance Statistics: ◦ Objects ◦ Counters ◦ Instances  Modes: ◦ System Monitor ◦ Performance Logs and Alerts  Counter Logs  Trace Logs  Alerts

Analyzing workloads to optimize physical database structures

 Can make performance-related recommendations  Replaces the “Index Tuning Wizard”  Evaluates Physical Design Structures (PDS) ◦ Indexes (clustered, non-clustered) ◦ Indexed Views ◦ Partitions  Numerous analysis options  Output ◦ Generates modification scripts ◦ Generates Reports for later analysis

 Files ◦ Transact-SQL Files ◦ XML Files ◦ Should represent commonly-used queries  SQL Profiler Trace Files / Tables ◦ Use Tuning built-in trace template ◦ Events:  Transact-SQL Batch  Remote Procedure Call (RPC) ◦ Columns: Event Class and Text Data

 Limit tuning time  Tuning Options ◦ Allowed Physical Design Structures (PDS) ◦ Keep all/specific existing objects ◦ Maximum storage space ◦ Online or offline recommendations ◦ Partitioning

 Reports can be exported to XML files  Report Examples: Workload analysis Column accessTable access View-Table Relations Statement costEvent frequency Index Usage (current / recommended)

 Process: ◦ Generate a workload (file or table) ◦ Select tuning options ◦ Run the analysis ◦ View reports ◦ Save and/or apply recommendations  Running the DTA: ◦ Database Engine Tuning Advisor Application (GUI) ◦ Dta.exe command-line utility

Troubleshooting common SQL Server performance problems

 Processes ◦ Interactive users  SQL Server Management Studio ◦ Applications (Connection Pooling)  SQL Profiler  Database Engine Tuning Advisor  Replication  Service Broker  Process IDs < 50 are system-related

 SQL Server Activity Monitor ◦ Processes (connected users) ◦ Locks (by Process / by Object) ◦ Filtering options ◦ Auto-refresh option  System Stored Procedures / Views ◦ Sys.DM_Exec_Sessions ◦ Sys.DM_Exec_Requests ◦ Sys.SysProcesses ◦ sp_who / sp_who2

 Process Information ◦ Current Process ID: ◦ Session Options: DBCC USEROPTIONS  Killing Processes ◦ KILL ProcessID [WITH STATUSONLY]  Viewing Last Activity ◦ DBCC INPUTBUFFER(ProcessID) ◦ DBCC OUTPUTBUFFER(ProcessID)

 Coordinates multiple accesses to the same data  Ensures ACID Properties for transactions (Atomic, Consistent, Independent, Durable)  Contention can reduce performance  Locking granularity: ◦ Row-Level, Page-Level, Table-Level, etc.  Lock Modes: ◦ Shared, Exclusive, etc.  Lock escalation

 Blocking ◦ When transaction(s) must wait for a lock on a resource ◦ LOCK_TIMEOUT setting (default = wait forever)  Locking Models: ◦ Pessimistic ◦ Optimistic

 Balance of concurrency (performance) vs. consistency ◦ Affects SELECT queries ◦ SET TRANSACTION ISOLATION LEVEL  Transaction Isolation Levels ◦ READ UNCOMMITTED ◦ READ COMMITTED (default) ◦ REPEATABLE READ ◦ SERIALIZABLE  Row-Versioning: ◦ ALLOW_SNAPSHOT_ISOLATION ◦ READ_COMMITTED_SNAPSHOT

 Activity Monitor  SQL Profiler ◦ Locks Event Category  System Monitor: ◦ SQL Server  Locks Object  System Views ◦ Sys.DM_Tran_Locks ◦ Sys.DM_Exec_Requests  System Stored Procedures ◦ sp_Lock

 Deadlocks: ◦ Two or more tasks permanently block each other based on resource locks ◦ Default resolution is within 5 seconds  Deadlock victim ◦ Transaction is rolled-back ◦ Process receives a 1205 error  Example: ◦ Process 1 locks the Customers table and requires access to the Orders Table ◦ Process 2 locks the Orders table and requires access to the Customers Table

 Minimize transaction times ◦ Commit / Rollback transactions as quickly as possibly ◦ Avoid user-related time within a transaction  Access objects in a consistent order  Change the transaction isolation level ◦ Use a lower level isolation level, if appropriate ◦ Use snapshot-based isolation levels

 Deadlock priorities: ◦ SET DEADLOCK_PRIORITY (LOW, NORMAL, HIGH, integer)  Deadlock resolution: ◦ Lower priority is killed first ◦ If equal priorities, least expensive transaction becomes the victim ◦ Application or user should attempt to re-run the transaction

 SQL Server Error Log  SQL Profiler ◦ Locks Event Category  Lock:Deadlock Chain  Lock:Deadlock  Deadlock Graph ◦ Events Extraction Trace Property ◦ Export deadlock XML (.xdl) file  Viewing Deadlock Files ◦ SQL Server Management Studio (File  Open  SQL Deadlock Files (*.xdl)

 Resources from Anil Desai ◦ Web Site ( ◦ ◦ ReportingServicesGuru.com ReportingServicesGuru.com ◦ Keystone Learning Course: “Microsoft SQL Server 2005: Implementation and Maintenance (Exam )”