Troubleshooting SQL Server When You Cannot Access The Machine

Slides:



Advertisements
Similar presentations
Configuration management
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
Copyright © 200\8 Quest Software High Performance PL/SQL Guy Harrison Chief Architect, Database Solutions.
10 Things Not To Do With SQL SQLBits 7. Some things you shouldn’t do.
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Performance Dash A free tool from Microsoft that provides some quick real time information about the status of your SQL Servers.
File Systems and Databases Lecture 1. Files and Databases File: A collection of records or documents dealing with one organization, person, area or subject.
A Brief Documentation.  Provides basic information about connection, server, and client.
Srik Raghavan Principal Lead Program Manager Kevin Cox Principal Program Manager SESSION CODE: DAT206.
SQL School is strongly committed to provide COMPLETE PRACTICAL REALTIME Trainings on SQL Server Technologies – Dev, SQL DBA, MSBI (SSIS, SSAS, SSRS) and.
Copyright 2007, Information Builders. Slide 1 Machine Sizing and Scalability Mark Nesson, Vashti Ragoonath June 2008.
Database Administration Basics. Basic Concepts and Definitions  Data Facts that can be recorded and stored  Metadata Data that describes properties.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
7.5 Using Stored-Procedure and Triggers NAME MATRIC NUM GROUP Muhammad Azwan Bin Khairul Anwar CS2305A Muhammad Faiz Bin Badrol Shah CS2305B.
Session Name Pelin ATICI SQL Premier Field Engineer.
Database Design: Solving Problems Before they Start! Ed Pollack Database Administrator CommerceHub.
Basic Outputs to Troubleshooting Queries.
SQL Database Management
Introduction to Databases Transparencies
Platform as a Service (PaaS)
Building Enterprise Applications Using Visual Studio®
With Temporal Tables and More
SQL Server Statistics and its relationship with Query Optimizer
Controlling User Access
How to tune your applications before moving your database to Microsoft Azure SQL Database (MASD) OK, you've jumped into your Azure journey by creating.
SOFTWARE TESTING Date: 29-Dec-2016 By: Ram Karthick.
Designing High Performance BIRT Reports
Platform as a Service (PaaS)
What Is The SSIS Catalog and Why Do I Care?
Query Optimization Techniques
SQL Trace and TKPROF.
Data Virtualization Tutorial: Introduction to SQL Script
Query Tuning without Production Data
UFC #1433 In-Memory tables 2014 vs 2016
Existing Perl/Oracle Pipeline
Introduction to Databases Transparencies
Introduction to Databases
Query Tuning without Production Data
SQL Server Monitoring Overview
UNIT - V STORED PROCEDURE.
Web Applications Security What are web Applications?
Introduction to Databases
Data Virtualization Tutorial: JSON_TABLE Queries
Application Development Theory
Database Performance Tuning and Query Optimization
Translators & Facilities of Languages
Marcos Freccia Stop everything! Top T-SQL tricks to a developer
Third Party Tools for SQL Server
Query Optimization Techniques
SQL Server 2016 Query Data Store
Introduction to Databases
Dynamic SQL: Writing Efficient Queries on the Fly
Using JDeveloper.
Statistics for beginners – In-Memory OLTP
Lecture 1 File Systems and Databases.
Introduction to Databases
Chapter 11 Database Performance Tuning and Query Optimization
Power Query & Database Tuning
Tonga Institute of Higher Education IT 141: Information Systems
Introduction to Databases Transparencies
JavaScript CS 4640 Programming Languages for Web Applications
Dynamic Sql Not so scary?
Configuration management
Tonga Institute of Higher Education IT 141: Information Systems
Change Tracking Live Data Warehouse
Query Optimization Techniques
Web Application Development Using PHP
Presentation transcript:

Troubleshooting SQL Server When You Cannot Access The Machine Vicky Harp Sr. Manager of SQL Server Product Management IDERA

Let’s talk bugs All software has failure conditions Corruption Tampering Most software has bugs Errors in logic Errors in execution

Let’s talk bugs Grey areas Scalability Platform and Hardware Compatibility Language and Regional Support When a customer experiences a problem, it’s no longer a grey area - it’s a bug.

Let’s talk bugs You will have a bug in your database. A customer is going to experience that bug. They will not be able to let you log in to their database. This is going to happen

Troubleshooting without access to the machine is very hard But it’s the best way to troubleshoot!

Why don’t you have access? Security policies Topological constraints Logistics and time zones Language barriers Availability of key personnel Inability to reproduce issue on demand

why shouldn’t you want access?

why shouldn’t you want access? Need for NDAs or security policies on customer data Responsibility for unintended effects No test case enrichment Skillset mismatch Single threaded troubleshooting

It’s better to have scripts More secure More relevant Build up a library which can be used by others Can be re-used in the QA process Usable by wide variety of personnel Easier to train support staff

Build supportability into your apps Distinct application names Metadata information in database Application and database logging Self-tracing or verbose output flags for data access layer Human readable object and column names

Build a support toolbox Create both generic scripts and problem specific scripts Document and maintain these scripts like your production code Use your toolbox during your QA cycle

Build a support toolbox Almost always collect low-cost, useful data Application Metadata Database Topology Fundamental Performance Metrics Scope and Scale Data

Build a support toolbox Make it easy to collect problem-specific data Reproduction Cases Errors Performance Data

Build a support toolbox Create your scripts with security in mind Assume it might be code reviewed Clearly document what the script is doing Do not return potentially sensitive data (you can mask it)

Remote troubleshooting techniques DMV Queries SET STATISTICS IO SET STATISTICS TIME Query Plans Annotated Stored Procedures XEvent Sessions

DMV Queries SQL Server ships with 100s of dynamic management views Most DMVs are lightweight and return almost instantly Very well documented and uncontroversial for users

DMV Queries Practical Uses: Table sizes, rowcounts File and filegroup topology Database status Backup history, job history Performance metrics and blocking chains Index utilization Schema verification

DMV Queries Thoughtfully written scripts will not need modification for different environments DMVs are partially dependent on SQL Server version, but less so with more contemporary releases

DEMO – DMV Queries

SET Statistics IO SET STATISTICS IO ON Verbose and valuable performance data Needs to be paired with the statement to be tuned set statistics io on exec p_myProblemProcedure @input='Repro'

Set Statistics IO set statistics io on exec sp_help Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'Workfile'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'sysschobjs'. Scan count 1, logical reads 41, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'spt_values'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'sysscalartypes'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Set Statistics IO Look for the tables and worktables with a lot of IO Table Name Scan Count Logical Reads Physical Reads Read Ahead Reads Lob Logical Reads Lob Physical Reads Lob Read Ahead Reads Look for the tables and worktables with a lot of IO Look for tables you don’t expect to be accessed

SET STATISTICS TIME SET STATISTICS TIME ON Returns parse, compile, and execution time Works well in conjunction with SET STATISTICS IO ON

SET STATISTICS TIME select count(*) from MyCustomers where left(CustomerName,1) = 'a' select count(*) from MyCustomers where CustomerName like 'a%‘ SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 5 ms. (1 row(s) affected) SQL Server Execution Times: CPU time = 93 ms, elapsed time = 97 ms. SQL Server Execution Times: CPU time = 32 ms, elapsed time = 30 ms.

DEMO – SET STATISTICS IO / SET STATISTICS TIME

Query Plans Gold standard in diagnosing query performance issues Does not require user to actually execute the problem code Requires some level of expertise to interpret

DEMO – Query PLans

Annotated Stored Procedures Add error statements to help troubleshoot logical flow Helpful for complex procedures where query plans are cumbersome Either ship annotated procedures or have them available for swap-in

DEMO – Annotated Stored Procedures

Xevent Sessions Watch what is happening in your application and interpret it after the fact Can be tuned for a very exact use case or a broader diagnostic one May return sensitive information!

DEMO – Xevent Sessions

A note on reproducing issues You do not have to fully reproduce an issue: you may simulate it in code Hard coding wait times Contrived blocking chains Query hints Alternate tables Simulation and reproduction cases should be archived like source code

Questions?