Part II : Waits Events Kyle Hailey

Slides:



Advertisements
Similar presentations
Database Tuning. Objectives Describe the roles associated with database tuning. Describe the dependency between tuning in different development phases.
Advertisements

Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
The Architecture of Oracle
1 Wait Event Enhancements in Oracle 10g Terry Sutton and Roger Schrag Database Specialists, Inc.
IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Wait Tree - Locks Waits Disk I/O Library Cache Enqueue Undo TX 6 Row Lock TX 4 ITL Lock HW Lock.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Locks REDO Lib Cache Buffer Cache IO Locks Network.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Oracle High Availability Solutions RAC and Standby Database Copyright System Managers LLC 2008.
1 Chapter 16 Latch and Mutex Contention. 2 Architecture Overview of Latches Protect Oracle’s SGA Prevent two processes from updating same area of SGA.
Buffer Cache Waits. #.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Oracle Architecture. Instances and Databases (1/2)
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
The Self-managing Database: Automatic Performance Diagnosis Graham Wood Kyle Hailey Oracle Corporation Session id:
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Architecture. Database instance When a database is started the current state of the database is given by the data files, a set of background (BG)
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Log File Waits  Redo is written to disk when  User commits  Log Buffer.
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Average Session Load (ASL) The Golden Metric ? Kyle Hailey
Waits Events and the Geeks who love them Kyle Hailey
Waits Defined Kyle Hailey #.2 Copyright 2006 Kyle Hailey Top 36 Foreground Waits write complete waits library cache.
1 Copyright © 2009, Oracle. All rights reserved. Exploring the Oracle Database Architecture.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
#.1 Oracle Wait Interface in Oracle 10g. #.2 Today’s Session  Twelve wait event interface enhancements in Oracle 10g that we really like.  Documentation.
Basic Oracle Architecture
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright  Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Anton TopurovIT-DB 23 April 2013 Introduction to Oracle2.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
1 06/05/08 Statspack Kyle Hailey
Oracle 10g Advanced Performance Tuning Kyle Hailey Delphix - wait events docs – tools S-ASH.
Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
#.6 Sampling Kyle Hailey
11 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Tuning.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown President System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2003.
10G - New Manageability Features Presented by Lenka Vanek
#.1 SASH – Simulated ASH and other tools. #.2 OEMDB Optimizer Lab 128SASH performance$100,000$1500$500free SQL Tuning$100,000includedN/A Both$200,000$1500N/A.
3 Copyright © 2006, Oracle. All rights reserved. Statistics and Wait Events.
Preface 1Performance Tuning Methodology: A Review Course Structure 1-2 Lesson Objective 1-3 Concepts 1-4 Determining the Worst Bottleneck 1-5 Understanding.
#.1 Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
OEM 10g Performance and Tuning. #.2 Copyright 2006 Kyle Hailey Performance SQL Diagnostics SQLTuning Performance Session DB HOME.
SQL*Net & Other Waits. #.2 Copyright 2006 Kyle Hailey SQL*Net Waits Session Shadow Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache Host.
8 Copyright © 2006, Oracle. All rights reserved. Tuning the Shared Pool.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
What is Oracle ? Oracle is a relational database management system. It is a management system which uses the relational data model. In the relational data.
Oracle Database Architectural Components
1 PVSS Oracle scalability Target = changes per second (tested with 160k) changes per client 5 nodes RAC NAS 3040, each with one.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Kyle Hailey Redo Waits Kyle Hailey
Part II : Waits Events and the Geeks who love them
Kyle Hailey Enqueue Waits : Locks Kyle Hailey
Oracle Memory Internals
Oracle Architectural Components
Index Index.
Wait Event Enhancements in Oracle 10g
Presentation transcript:

Part II : Waits Events Kyle Hailey

Copyright 2006 Kyle Hailey Oracle InstrumentationRedo Lib Cache Buffer Cache IO Locks Network CPU Database Database

Copyright 2006 Kyle Hailey Wait Tree Waits IO Buffer Cache Library Cache Lock Redo SQL Net Buffer Busy Rollback Free lists IO Read Cache Latches Library Cache Shared Pool TX Row Lock TX ITL Lock HW Lock Write IO Read IO Log Buffer Log File Sync Log File Administrative Application Concurrency Configuration Network Other User I/O Other Network Commit Administrative Concurrency Configuration Application Other Network Commit Administrative Concurrency Configuration Application SQL*Net break/reset to client enq: KO - fast object checkpoint enq: RO - fast object reuse enq: TM - contention enq: TX - row lock contention enq: UL - contention buffer busy wait latch: cache buffers chains os thread startup enq: TX - index contention cursor: pin S cursor: pin X cursor: pin S wait on X latch: library cache latch: library cache lock latch: library cache pin latch: row cache objects latch: shared pool latch library cache load lock library cache lock library cache pin row cache lock SQL*Net message to client SQL*Net more data to client SQL*Net more data from client enq: HW - contention enq: SQ - contention enq: ST - contention enq: TX - allocate ITL entry free buffer wait sort segment request write complete wait log buffer space log file switch (archiving needed) log file switch (checkpoint incomplete) log file switch (private strand flush incomplete) log file switch completion buffer exterminate enq: CF - contention enq: CI - Cross Instance enq: TX - contention kksfbc child completion latch: cache buffers handles latch: cache buffers lru chain latch free data file init write db file parallel read db file scattered read db file sequential read direct path read direct path read temp direct path write direct path write temp local write wait read by other session

Copyright 2006 Kyle Hailey Waits beyond OEM  OEM identifies Wait problems  Provides solutions with ADDM sometimes but …  What do you do when ADDM isn’t sufficient?  What do you do if you don’t have OEM 10g?  Then have to analyze the Waits  Need to know about waits  How they work  How to analyze them

Copyright 2006 Kyle Hailey v$active_session_history  When ADDM fails or we don’t have ADDM we can collect the necessary information from  v$active_session_history 1. Session (user, service, client, package, procedure, etc) 2. SQL statement 3. Wait  P1  P2  P3 4. Blocking_Session (sometimes)

Copyright 2006 Kyle Hailey What are P1,P2,P3 ?  Each Wait has a 3 parameters P1,P2,P3  Give detailed information  Meaning different for each wait  Meaning definitions in V$event_name col parameter1 for a10 col parameter2 for a10 col parameter3 for a10 select parameter1,parameter2, parameter3 from v$event_name from v$event_name where name = '&1';

Copyright 2006 Kyle Hailey Wait Arguments Example NAME PARAMETER1 PARAMETER2 PARAMETER latch: cache buffers chains address number tries free buffer waits file# block# set-id# buffer busy waits file# block# class# latch: redo copy address number tries log buffer space switch logfile command log file sync buffer# db file sequential read file# block# blocks enq: TM - contention name|mode object # table/partition undo segment extension segment# enq: TX - row lock contention name|mode usn<<16 | slot sequence row cache lock cache id mode request library cache pin handle address pin address 100*mode+namesp library cache load lock object address lock address 100*mask+namesp pipe put handle address record length timeout select parameter1,parameter2, parameter3 from v$event_name; from v$event_name;

Copyright 2006 Kyle Hailey Wait Analysis requires p1,p2,p3  Of the top 30 wait events 8 can be solved without ASH  The rest need  SQL  P1,P2,P3  Statspack, AWR fail free buffer waits log buffer space log file switch (archiving needed) log file switch (checkpoint incomplete) log file switch completion log file sync switch logfile command write complete waits Example “hard” waits Buffer busy wait Row cache lock Latch free row lock contention Latch: cache buffers chains

Wait Analysis  SQL  Most often the tuning answer lies in looking at what the application is doing, and changing it  Parameters  Find extended wait information  Parameter1, Parameter2, Parameter3  Defined in v$event_name  Guess Work  Sometimes the wait events that are found are not in the documentation and it takes some educated guesswork to figure out the problem

Copyright 2006 Kyle Hailey Waits we will Ignore One thing that makes waits difficult is knowing which ones to look at and which ones to ignore.  Background  Idle  Resource Manager  Parallel Query  RAC  Good stuff, but not covered in this seminar

Copyright 2006 Kyle Hailey Background & Foreground  Background Processes  DBWR  LGWR  PMON  SMON  Etc  Foreground Processes  SQL*Plus  Pro*C  SQL*Forms  Oracle applications Only interested in Foreground waits

Copyright 2006 Kyle Hailey Background Waits  ASH  Avoid Background waits in ASH with  V$session_wait joined to v$session Select …from v$active_session_history where SESSION_TYPE='FOREGROUND' select … from v$session s, v$session_wait w where w.sid=s.sid and s.type='USER' select … from v$session s, v$session_wait w where w.sid=s.sid and s.type='USER'

Copyright 2006 Kyle Hailey Idle Waits  Filtered Out of ASH by default  10g  where wait_class != ‘Idle’  Create a list  9i  Create a list with  Documentation  List created from 10g  Stats$idle_events from statspack Select name from v$event_name where wait_class=‘Idle’; SQL*Net message from client

Copyright 2006 Kyle Hailey PQO and Resource Manager  Resource manager throttles user  Creates wait  Obfuscates problems  Parallel Query Wait events are unusable  Save waits are both idle and waits  Parallel Query Waits start with ‘PX’ or ‘KX’  PX Deq: Par Recov Reply  PX Deq: Parse Reply select name from v$event_name where wait_class='Scheduler';

Copyright 2006 Kyle Hailey RAC Waits RAC waits are certainly interesting but will be covered outside of this presentation.  You are on your own  Check documentation  If you are not using RAC then no worries  10g  9i  RAC and OPS waits usually contain the word “global” Select event from v$event_name where wait_class=‘Cluster’;

Copyright 2006 Kyle Hailey Additional Support  AWR Tables – on disk for 7 days by default  DBA_HIST_ACTIVE_SESS_HISTORY  1 in 10 ASH samples  DBA_HIST_SEG_STAT  Sometimes make analysis of ITL and buffer busy wait easier  DBA_HIST_SYSTEM_EVENT  Important for getting avg wait times  DBA_HIST_SQLSTAT  sql execution deltas  DBA_HIST_SYSMETRIC_SUMMARY  Statistics avg, max, min  Metric Tables – in memory deltas  V$EVENTMETRIC

Copyright 2006 Kyle Hailey All Events over 7 days select count(*), event from ( select event from DBA_HIST_ACTIVE_SESS_HISTORY where sample_time < ( select min(sample_time) from where sample_time < ( select min(sample_time) from v$active_session_history) v$active_session_history) union all union all select event from v$active_session_history select event from v$active_session_history ) group by event order by event / Union of 7 day history with in memory buffer :

Copyright 2006 Kyle Hailey Avg Wait times nowselect en.name, en.name, (time_waited)/nullif(wait_count,0) avg_ms, (time_waited)/nullif(wait_count,0) avg_ms, wait_count wait_countfrom v$eventmetric e, v$eventmetric e, v$event_name en v$event_name enwhere e.event# = en.event# e.event# = en.event# and en.name like '%&1%‘; and en.name like '%&1%‘; NAME AVG_MS WAIT_COUNT db file sequential read db file scattered read db file parallel write

Object Translation Current fields in v$active_session_history  CURRENT_OBJ#  CURRENT_FILE#  CURRENT_BLOCK#  Called “ROW_WAIT_%” in v$session Only apply to  Buffer Busy Waits  IO Waits  Enqueue TX Ignore these fields for other wait events

Copyright 2006 Kyle Hailey Wait interface Weaknesses  Logons  EM 10g shows these on perf page  Time model helps  V$SYS_TIME_MODEL  connection management call elapsed time (I’ve had problems)  Paging/Memory issues  CPU starvation  Null Events  Bugs – read external table reports CPU 

Copyright 2006 Kyle Hailey Summary  Waits make Tuning Easy  Check Machine Health  Tune Waits  Tune CPU  Tune SQL  Change Application Architecture  Use  OEM10g  Statspack/AWR,  S/ASH  Ignore Background, Idle, Resmgr, PQO  Use ASH if OEM fails  See for more infohttp://oraclemonitor.com Oracle Load (AAS) Top Session Top Wait Top SQL SQL Detail Session Detail File Detail Object Detail Wait Detail Host AAS > #CPU AAS > 1 Waits > CPU CPU > Waits CPU Memory Memory ADDM SQL Tuning Advisor