Advanced Oracle Troubleshooting Live Session. Randolf Geist

Similar documents
Advanced Oracle Troubleshooting Live Session

Advanced Oracle Performance Troubleshooting. Query Transformations Randolf Geist

Identifying performance issues beyond the Oracle wait interface

EZY Intellect Pte. Ltd., #1 Changi North Street 1, Singapore

Oracle Database 12c: Performance Management and Tuning

Oralogic Education Systems

Essential (free) Tools for DBA!

Quo Vadis SQLTXPLAIN

Learning Objectives : This chapter provides an introduction to performance tuning scenarios and its tools.

Katharina Römer Principal Sales Consultant STCC Stuttgart ORACLE Deutschland GmbH

Oracle Database 11g: Performance Tuning DBA Release 2

IT-Tage Dezember 2016 Frankfurt am Main Maritim Hotel

PERFORMANCE TUNING TRAINING IN BANGALORE

Oracle Database 11g: Performance Tuning DBA Release 2

In the Oracle Database 12c: Performance Management and

Oracle Database 11g : Performance Tuning DBA Release2

Oracle Database 12c Performance Management and Tuning

Adaptive Optimization. Presented by: Kerry Osborne Red Gate Webinar, Nov. 2013

Anthony AWR report INTERPRETATION PART I

Oracle Performance Tuning. Overview of performance tuning strategies

Advanced Oracle SQL Tuning v3.0 by Tanel Poder

Hacking Oracle's Memory About Internals & Troubleshooting

Addressing a Performance issue The drilldown approach. Laurent Léturgez

Exadata X3 in action: Measuring Smart Scan efficiency with AWR. Franck Pachot Senior Consultant

Introduction. Assessment Test. Chapter 1 Introduction to Performance Tuning 1. Chapter 2 Sources of Tuning Information 33

Independent consultant. Oracle ACE Director. Member of OakTable Network. Available for consulting In-house workshops. Performance Troubleshooting

AMON User's Guide. Author: Andrej Simon Creation date: 11-Mar-2009 Last changed: 11-Aug-2010 AMON Version: 0.32

Using Automatic Workload Repository for Database Tuning: Tips for Expert DBAs. Kurt Engeleiter Product Manager

Under the hood of dynamic and adaptive database features

Identifying Performance Problems in a Multitenant Environment

2010 (c)2013 OraPub, Inc. This presentation was given by Craig Shallahamer at the NoCOUG conference on 15-AUG-2013.

Independent consultant. Oracle ACE Director. Member of OakTable Network. Available for consulting In-house workshops. Performance Troubleshooting

End-to-end Management with Grid Control. John Abrahams Technology Sales Consultant Oracle Nederland B.V.

Vijay Mahawar

Using Active Session History for Performance Tuning: Advanced Topics in Performance Diagnostics

This is the forth SAP MaxDB Expert Session and this session covers the topic database performance analysis.

Oracle Database 10g The Self-Managing Database

Oracle 1Z0-054 Exam Questions and Answers (PDF) Oracle 1Z0-054 Exam Questions 1Z0-054 BrainDumps

Taming the AWR Tsunami

Performance Monitoring

"Charting the Course... Oracle Database 12c: Architecture & Internals. Course Summary

Resolving Child Cursor Issues Resulting In Mutex Waits

The Oracle SQLT Utility. By Kevin Gilpin, Rolta TUSC Wednesday March 14, 2012

ORACLE DIAGNOSTICS PACK

<Insert Picture Here>

Addressing a performance issue: the drilldown approach

Oracle 1Z0-417 Exam Questions and Answers (PDF) Oracle 1Z0-417 Exam Questions 1Z0-417 BrainDumps

Copyright 2018, Oracle and/or its affiliates. All rights reserved.

RAC Performance Monitoring and Diagnosis using Oracle Enterprise Manager. Kai Yu Senior System Engineer Dell Oracle Solutions Engineering

Using Oracle STATSPACK to assist with Application Performance Tuning

<Insert Picture Here> DBA s New Best Friend: Advanced SQL Tuning Features of Oracle Database 11g

Oracle Database 12c Administration I

Database Performance Analysis Techniques Using Metric Extensions and SPA

Oracle EXAM - 1Z Oracle Database 11g: Performance Tuning. Buy Full Product.

IT Best Practices Audit TCS offers a wide range of IT Best Practices Audit content covering 15 subjects and over 2200 topics, including:

Resolving Latch Contention

OracleMan Consulting

Oracle Database 11g: SQL Tuning Workshop

Effec%ve Use of Oracle s 12c Database Opera%on Monitor

Let s Tune Oracle8 for NT

Oracle 10g Self-Management Framework Internals: Exploring the Automatic Workload Repository. Open World September 2005

Session id: The Self-Managing Database: Guided Application and SQL Tuning

Oracle 9i Application Development and Tuning

Oracle and Toad Course Descriptions Instructor: Dan Hotka

Course Contents of ORACLE 9i

Join Methods. Franck Pachot CERN

YOUR machine and MY database a performing relationship!? (#141)

1Z Oracle Database Performance and Tuning Essentials 2015 Exam Summary Syllabus Questions

IT115: Oracle Database 12c Administration I

Performance by combining different log information. Daniel Stein Nürnberg,

PeopleSoft: A Properly Instrumented Application? David Kurtz Go-Faster Consultancy Ltd.

Tuning Oracle SQL with SQLTXPLAIN

Demystifying SQL Tuning: Tips and Techniques for SQL Experts

1z0-064.exam.57q. Number: 1z0-064 Passing Score: 800 Time Limit: 120 min File Version: 1. Oracle 1z0-064

Internals of Active Dataguard. Saibabu Devabhaktuni

<Insert Picture Here> Maximizing Database Performance: Performance Tuning with DB Time

Full Throttle: SQL Tuning & Ressource Consumption Appr.

<Insert Picture Here> DBA Best Practices: A Primer on Managing Oracle Databases

Oracle Exam 1z0-054 Oracle Database 11g: Performance Tuning Version: 5.0 [ Total Questions: 192 ]

OpenWorld 2018 SQL Tuning Tips for Cloud Administrators

October 3, 2017 Vit Spinka Chief Architect

Common Performance Monitoring Mistakes

Resource Mapping A Wait Time Based Methodology for Database Performance Analysis

Tuning slow queries after an upgrade

IT100: Oracle Administration

Oracle Database 12c. The Best Oracle Database 12c Tuning Features for Developers and DBAs. Presented by: Alex Zaballa, Oracle DBA

1z0-062.exam.215q 1z0-062 Oracle Database 12c: Installation and Administration

Custom Performance Reporting Changes in Oracle 10g. Brian Doyle BEZ Systems VP, Product Service

Software Development & Education Center. Oracle D2K

Oracle database overview. OpenLab Student lecture 13 July 2006 Eric Grancher

Automatic Workload Repository: Soup to Nuts. Graham Wood Doug Burns

Gather Schema Statistics Oracle 10g Examples

Exam Name: Oracle Database 11g: Performance Tuning

Oracle Database 11g: Real Application Testing & Manageability Overview

Key to A Successful Exadata POC

The Oracle DBMS Architecture: A Technical Introduction

MILOŠ RADIVOJEVIĆ, PRINCIPAL DATABASE CONSULTANT, BWIN GVC, VIENNA, AUSTRIA

Oracle 1Z0-497 Exam Questions and Answers (PDF) Oracle 1Z0-497 Exam Questions 1Z0-497 BrainDumps

Tuning SQL without the Tuning Pack. John Larkin JP Morgan Chase

Oracle SQL Tuning for Developers Workshop Student Guide - Volume I

Transcription:

Advanced Oracle Troubleshooting Live Session Randolf Geist http://oracle-randolf.blogspot.com/ http://www.sqltools-plusplus.org:7676/ info@sqltools-plusplus.org

Who am I Independent Consultant Located in Germany Oracle ACE OCP 8i, 9i, 10g Member of the OakTable Network http://www.oaktable.net 2

Who am I Regular speaker at UKOUG, SIOUG, DOAG, MOTS etc. My Blog: Oracle related stuff http://oracle-randolf.blogspot.com Maintainer of SQLTools++ http://www.sqltools-plusplus.org:7676/ http://sqltpp.sourceforge.net 3

Who am I Co-author of the latest OakTable book "Expert Oracle Practices" 4

Highlights Introduction to Troubleshooting vs. Tuning Basic Troubleshooting techniques - recap Active Session History - ASH Resource Contention: Latches / Mutexes Logical I/O investigations: Excessive consistent gets Tracing on O/S Level Oracle Heapdumps / Errorstacks / Systemstate dumps etc. Questions and Answers 5

Loosely based Advanced Oracle Troubleshooting on my chapter 8 Understanding Performance Optimization Methods 6

Advanced Oracle Troubleshooting Extensive usage of Tanel Poder s tools http://tech.e2sn.com http://blog.tanelpoder.com Download his toolset at: http://tech.e2sn.com/oracle-scripts-and-tools 7

Troubleshooting vs. Tuning Troubleshooting is not the same as tuning Troubleshooting is identifying the root cause of why something is taking longer than expected Tuning means fixing this identified root cause Finding a good tuning fix without any side effects is not a trivial task think about adding an index This presentation focuses solely on the Troubleshooting part 8

Troubleshooting Basics Performance is about time response time, not about certain metrics Identify the issue by a clear problem statement Good: This end-user report takes 10 times longer than expected Not good: The number of buffer gets is too high 9

Troubleshooting Basics Avoid looking at the system from an aggregated level (metrics, ratios) AWR / STATSPACK can be useful, if: You plan to increase efficiency of the whole system (avoid hardware upgrades) Your process is exclusively running on the system Systematic approach start with the business process affected most 10

Troubleshooting Basics Identify the affected process ideally by good application instrumentation or end user feedback! You can also try to identify via Top Activity / Sessions / SQL If you don t have an diagnostic license you can try MOATS (M)other (O)f (A)ll (T)uning (S)cripts http://www.oracle-developer.net/utilities.php 11

Troubleshooting Basics Once process is identified, first things to check: Session Statistics and Wait Interface => Best tool: Tanel Poder's "snapper Extremely powerful and flexible, no installation If you have identified SQLs or sessions that are taking longer than expected, use proven technology: Extended SQL trace DBMS_XPLAN.DISPLAY_CURSOR (>= 10g) (Active Session History / ASH, more on that later) 12

Troubleshooting Basics These two tools are complementary: Both tell you where most of the time is spent Extended SQL trace with waits enabled shows additionally the wait events, scope is session DBMS_XPLAN.DISPLAY_CURSOR shows the estimated cardinalities together with the actual ones (Starts + Rows), scope is a single SQL Furthermore it shows the estimated memory requirements along with the actual memory used and the amount of TEMP space used when spilling to disk 13

Troubleshooting Basics Bad execution plans are often caused by incorrect cardinality estimates Check the estimated and actual cardinalities reported by DBMS_XPLAN.DISPLAY_CURSOR 14

Troubleshooting Basics 11g added SQL Real-Time Monitoring Requires additional tuning & diagnostics pack license V$SQL_MONITOR V$SQL_PLAN_MONITOR DBMS_SQLTUNE.REPORT_SQL_MONITOR: Combines information from V$SQL_PLAN_MONITOR, V$SESSION_LONGOPS and V$ACTIVE_SESSION_HISTORY Loads of parameters and options - worth to study the details 15

Pimp Up Your Basic Tools Adrian Billington's XPLAN wrapper for DBMS_XPLAN.DISPLAY* functions Use alternative trace file analyzers in addition to TKPROF: Oracle's own Trace Analyzer (TRCA / TRCANLZR) See MOS Note 224270.1, and see also extended Explain Plan 215187.1 SQLT (SQLTXPLAIN) Both tools require an installation and are a bit cumbersome to use, however they provide a wealth of detailed information 16

Pimp Up Your Basic Tools More free trace file analyzers / tools: Christian Antognini's TVD$XTAT (http://antognini.ch/top) Alberto Dell'Era's XPLAN / XTRACE tools (http://www.adellera.it/) OraSRP (http://www.oradba.ru/orasrp) SQLDeveloper (!) Support your developers by using Method R's MR Trace SQLDeveloper plug-in - allows to automatically fetch trace files from the server Or write your own little helper tool that transports trace files to the client automatically 17

Advanced Oracle Troubleshooting Demo Time! basic_troubleshooting_summary.sql snapper_to_trace.sql 18

Active Session History Oracle 10g has added Active Session History (ASH) No rocket science simply takes a sample of all active sessions once a second Goldmine for troubleshooting, in particular for production issues that are transient / hard to reproduce 19

Active Session History Interfaces: V$ACTIVE_SESSION_HISTORY and DBA_HIST_ACTIVE_SESS_HISTORY Standard report available: RDBMS/ADMIN/ASHRPT.SQL Customized queries / reports possible Requires additional license: Diagnostic pack 20

Active Session History The good news is that Active Session History is not rocket science, in principle it is about sampling V$SESSION Therefore you don't need necessarily an additional license, but can do it yourself or use instead Kyle Hailey's S-ASH scripts for an "Active Session History" without ASH license http://ashmasters.com See also Oracle ASH project on Sourceforge by Marcin Przepiorowski http://sourceforge.net/projects/orasash/ http://oracleprof.blogspot.com/ 21

Advanced Oracle Troubleshooting Demo Time! ash_queries.sql 22

Resource Contention: Latches / Mutexes If multiple processes compete for certain resources you might see so called "latch / mutex contention Latches and Mutexes protect and serialize access to in-memory structures of the SGA So Latches and Mutexes are effectively light-weight locks 23

Resource Contention: Latches / Mutexes Most commonly "latch cache buffer chain" contention when multiple processes excessively attempt to access buffers protected by the same latch buffer chain Another common issue is library cache contention due to excessive (hard) parsing activity 24

Resource Contention: Latches / Mutexes Note that latch contention is usually a symptom rather than a cause Since spinning on latches burns CPU, excessive buffer gets can significantly increase CPU load On the other hand if you overload your CPUs then latch contention can be exaggerated by this CPU overload since the latches are held for too long and therefore contention of latches will be observed 25

Resource Contention: Latches / Mutexes So latch contention can cause CPU load but can also be a symptom of CPU overload In general there is not much you can do about this except for changing the application logic In case of excessive buffer gets check if a bad statement execution plan causes this (mostly plans including NESTED LOOP operations) 26

Resource Contention: Latches / Mutexes Details about latch/mutex activity can be obtained from dynamic performance views and internal X$ fixed tables Tanel Poder's tool set comes handy: LATCHPROF / LATCHPROFX (only as SYS or when X$ fixed views are accessible) 27

Resource Contention: Latches / Mutexes In 10.2 and 11g library cache is protected by Mutexes rather than latches, therefore details can be obtained via V$MUTEX_SLEEP_HISTORY Use MUTEXPROF instead of LATCHPROF/X in that case More information: Tanel Poder's presentations and blog posts 28

Advanced Oracle Troubleshooting Demo Time! latch_contention.sql library_cache_contention.sql 29

Logical I/O investigations: Excessive consistent gets Tracing and DBMS_XPLAN.DISPLAY_CURSOR tell you the number of consistent gets performed, but don't tell you the reason why they have been performed If you suspect that the number of consistent gets is higher than expected, it would be interesting to know the "reason" why the consistent get was performed 30

Logical I/O investigations: Excessive consistent gets Excessive consistent gets can be caused by different reasons The most obvious reasons: Bad execution plans Reconstructing of older versions of a block by applying undo Bugs, e.g. ASSM with non-default block sizes 31

Logical I/O investigations: Excessive consistent gets Up to version 10g internal X$ tables can be used to obtain information about the reason For 11g the internal structure has changed the contents are no longer updated 32

Logical I/O investigations: Excessive consistent gets If you connect with a user capable of accessing X$ tables, snapper can show you this as well Jonathan Lewis provides a nice script which takes a snapshot of this structure and outputs the delta afterwards http://www.jlcomp.demon.co.uk/buffer_usage.html Alternatively use event 10200/10202 to trace consistent gets (11g) 33

Advanced Oracle Troubleshooting Demo Time! excessive_consistent_gets.sql 34

Leaving the instrumented area Now we'll come to the point where above tools do not allow a detailed diagnosis any longer You hit the limits for example if you have a case that: consistently sits on CPU, but doesn't show anything in the session statistics, so you don't have a clue what the process is actually doing performs some uninstrumented code section and therefore doesn't update the wait interface and/or the session statistics accordingly 35

Leaving the instrumented area Examples: PL/SQL processing Parsing bugs Instrumentation bugs, for example external table access up to 11.1.0.6 In these cases a different approach is required if we need more details 36

Leaving the instrumented area Trace the process on OS level using: Tanel Poder's OSStackProf DTrace (Solaris) procstack (AIX) gdb backtrace (Linux) In future may be: probevue (>= AIX 6.1), systemtap (Linux) 37

Leaving the instrumented area Sometimes it is also useful to find out the system calls performed by the process using: truss (Solaris, AIX) strace (Linux) ptrace Use My Oracle Support document 175982.1 to get an idea about the purpose of the functions traced 38

Advanced Oracle Troubleshooting Demo Time! tpt_public/aot/demo4.sql ostackprof.sql 39

O/S Explain Tracing the process can also be used to create an Explain Plan on OS level to find out if a particular plan operation is responsible for most of the execution time (for example excessive nested loop operations) Tanel Poder s os_explain shell script 40

Advanced Oracle Troubleshooting Demo Time! basic_troubleshooting_sample.sql os_expl_short_stack.sql 41

Oracle Heapdumps / Errorstacks / Systemstate etc. One particular helpful feature of the dumps is reading current bind values. Since these are stored in the process memory private to the process these cannot be accessed easily. With SQL Monitoring in 11g these are copied to shared memory structures, but we can help ourselves with certain DUMPs 42

Advanced Oracle Troubleshooting Demo Time! basic_troubleshooting_sample.sql cursordump.sql 43

Oracle Heapdumps / Errorstacks / Systemstate etc. If you can't tell from the call stack what is going on, sometimes it might be helpful to analyze the process using the available dumps, in particular if you see suspicious activity in the session statistics (for example, ever increasing pga / uga memory consumption) 44

Advanced Oracle Troubleshooting Demo Time! xmldom_pga_uga_memory_fragmentation_demo.sql pga_heap.sql 45

Summary Define clear and concise problem statement Performance is about time Systematic approach Know your basic toolset Use advanced techniques only if instrumentation is not sufficient 46

Questions Advanced Oracle Troubleshooting & Answers 47

Reference My Oracle Support TRCANLZR: 224270.1 SQLTXPLAIN: 215187.1 Kernel functions: 175982.1 Jonathan Lewis http://www.jlcomp.demon.co.uk/buffer_usage.html Tanel Poder http://tech.e2sn.com & http://blog.tanelpoder.com http://tech.e2sn.com/oracle-scripts-and-tools Adrian Billington http://www.oracle-developer.net Oracle ASH / S-ASH http://sourceforge.net/projects/orasash/ & http://oracleprof.blogspot.com/ http://www.ashmasters.com 48

Advanced Oracle Troubleshooting Thank you! http://oracle-randolf.blogspot.com/ http://www.sqltools-plusplus.org:7676/ info@sqltools-plusplus.org 49