SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Latch and Mutex Contention
 Troubleshooting in Oracle

            Tanel Põder
    http://blog.tanelpoder.com
If you like this session...
  ...then you're probably an Oracle geek like me ;)



  And you will like my tech-blog:
        http://blog.tanelpoder.com


  All my scripts freely downloadable
        http://blog.tanelpoder.com/seminar/seminar-files/
        Look for TPT scripts


  Oh... and I do seminars with much more stuff like this ;-)
        And I also fix these kinds of problems as a consultant
        http://blog.tanelpoder.com/seminar/
        tanel@tanelpoder.com




Tanel Põder                   http://www.tanelpoder.com          2
Intro to latching - 1
  What is a latch?
        Oracle's low-level mechanism for serializing concurrent access to
        very shortly accessed memory structures such as cache buffer
        headers etc...
                                                           Blah blah
                                                             blah!
  Yeah, but what is a latch?
        Latch is just a simple memory structure
        Usually around 100-200B in size (dependent on version,platform)
        Is wrapped into a latch state object structure (since v8.0 I think)
        Can reside in fixed SGA (parent latches) or shared pool
        Is set using hardware-atomic compare-and-swap (CAS) instructions
          • LOCK CMPXCHG on intel
        Latches are taken and released without any OS interaction
          • Actually the OS doesn't even have a clue that Oracle latches exist!
        Can be shared (since Oracle 8.0)
          • Used for some AQ ops
          • For example, used for cache buffers chains latch gets if examining a
              buffer chain

Tanel Põder                      http://www.tanelpoder.com                         3
The real intro to latching




              Latch is a lock
                          period.




Tanel Põder         http://www.tanelpoder.com   4
Latch contention
                          What is latch contention?


            I want to get a latch...
      but someone is already holding it!

                         To troubleshoot, find out:
                1) Who and why tries to get the latch (waiter)
               2) Who and why are holding the latch (blocker)


              In other words - find who and why is blocking us!
                      Just like with regular enqueue locks...

                        Remember, latches are locks!


Tanel Põder                   http://www.tanelpoder.com           5
Latch contention troubleshooting
  V$SESSION_WAIT / V$ACTIVE_SESSION_HISTORY
        PARAMETER1 = latch address for any latch wait event
        sw, WaitProf to see latch addresses of latch wait events
        Addresses map to v$latch_parent/v$latch_children.ADDR column


  SQL Trace
        you need to convert the P1/address number to hex:

   WAIT #3: nam='latch free' ela= 3749 address=15709454624 number=202 tries=1
     obj#=-1 tim=5650189627

   SQL> select to_char(15709454624, 'XXXXXXXXXXXXXXXX') addr_hex from dual;
   ADDR_HEX
   -----------------
            3A85B4120

   SQL> @la 3A85B4120
   ADDR                 LATCH#   CHLD NAME                  GETS
   ---------------- ---------- ------ --------------- ----------
   00000003A85B4120        202      2 kks stats           494562



Tanel Põder                    http://www.tanelpoder.com                        6
Identifying latch holders
  V$LATCHHOLDER
        Shows top-level latch holders from process state objects
          • See the Session ID of latch holder!!!
        Any latch held by a process state object is shown there
        Works in 99.9% of cases - enough for practical troubleshooting
        Additional latches held (while the top-level one is held) are not
        reported by v$latchholder :-(

        In the 0.01% of cases a fallback to old latch contention
        troubleshooting method could be used
          • Alternatively its possible to traverse state object trees via direct SGA
              attach
  SQL> desc v$latchholder
             Name                            Null?            Type
             ------------------------------- --------         ------------
      1      PID                                              NUMBER
      2      SID                                              NUMBER
      3      LADDR                                            RAW(8)
      4      NAME                                             VARCHAR2(64)
      5      GETS                                             NUMBER


Tanel Põder                       http://www.tanelpoder.com                            7
Latch contention troubleshooting approach
  1. Identify the session(s) experiencing problems
         Remember, databases don't have problems, only users, through
         database sessions


  2. Quantify for which latch that session is waiting for the most
         ...and whether the wait time is significant enough


  3. Identify the child latch involved in contention
         Is the contention concentrated on a particular child latch or is it
         spread across many?


  4. Identify where in kernel code (why) the latch is held from
         V$LATCHHOLDER
         LatchProfX / X$KSUPRLAT / X$KSUPR if problem with some
         sessions




Tanel Põder                     http://www.tanelpoder.com                      8
Latch contention troubleshooting with LatchProfX
  Sample V$LATCHHOLDER stats with LatchProfX, fast
        10-100k samples per second!
        @latchprofx <columns> <sid> <latches> <#samples>
        @latchprofx sid,name,func,hmode % % 1000000
 SQL> @latchprofx sid,name,func,hmode &sid % 100000

 -- LatchProfX 1.07 by Tanel Poder ( http://www.tanelpoder.com )

        SID   NAME                                  FUNC                                       HMODE              Held
 ----------   -----------------------------------   ----------------------------------------   ------------ ----------
        139   shared pool                           kghalo                                     exclusive          3174
        139   shared pool                           kghalp                                     exclusive          1294
        139   shared pool                           kghupr1                                    exclusive           704
        139   shared pool simulator                 kglsim_unpin_simhp                         exclusive           581
        139   kks stats                             kksAllocChildStat                          exclusive           489
        139   shared pool simulator                 kglsim_upd_newhp                           exclusive           240
        139   row cache objects                     kqrpre: find obj                           exclusive           158
        139   enqueues                              ksqdel                                     exclusive           116
        139   enqueues                              ksqgel: create enqueue                     exclusive            91
        139   shared pool                           kgh_heap_sizes                             exclusive            90
        139   row cache objects                     kqreqd: reget                              exclusive            58
        139   enqueue hash chains                   ksqgtl3                                    exclusive            57
        139   shared pool simulator                 kglsim_scan_lru: scan                      exclusive            53
        139   shared pool                           kghfre                                     exclusive            49
        139   row cache objects                     kqreqd                                     exclusive            41
        139   enqueue hash chains                   ksqrcl                                     exclusive            36
        139   shared pool simulator                 kglsim_chg_simhp_free                      exclusive            22
        139   shared pool                           kghasp                                     exclusive            18
        139   MinActiveScn Latch                    ktucloGetGlobalMinScn                      shared               14




Tanel Põder                                 http://www.tanelpoder.com                                                9
KGX mutexes
  KGX = Kernel Generic muteX module
        Kernel functions managing mutexes start with kgx


  Introduced in Oracle 10.2
        Physically like a latch (a piece of memory)
          • only more lightweight
          • and smaller
        Can be embedded inside other structures (lib cache object handle)
        Can have flexible spin/yield/wait strategy defined by "client"
        Do not account SPINGETS,YIELDS, only WAITS
          • GETS are accounted internally, but not externalized in any view


  KGX mutexes are not OS mutexes!!!




Tanel Põder                      http://www.tanelpoder.com                    10
Mutexes for Library Cache
  Used for protecting V$SQLSTATS buckets
        oradebug dump cursor_stats 1

  Used for pinning library cache cursors and parent examination
        If _kks_use_mutex_pin=true (default from 10.2.0.2)
        oradebug dump librarycache level 10

  In 11g+ mutexes are used instead of most library cache latches
        Instead of up to 67 library cache latches there's 131072 mutexes!
        Each library cache mutex protects one library cache hash bucket

  Known mutex types in 11g:
        Cursor Parent
        Cursor Pin
        Cursor Stat
        Library Cache
        hash table
        ...

Tanel Põder                   http://www.tanelpoder.com                     11
Mutex troubleshooting
  V$SESSION_WAIT                                 The mutex sleeps are well instrumented
        Shows wait events such:                  in wait interface. P1,P2,P3 values show
          • cursor: mutex S                      what is the hash value of library cache
          • cursor: mutex X                      objects under contention, the session
          • library cache: mutex S
                                                 holding the mutex etc.
                                                 v$event_name and v$session_wait "text"
          • library cache: mutex X
                                                 columns document the meaning of
                                                 P1,P2,P3
  V$MUTEX_SLEEP
        Shows the wait time, and the number of sleeps for each
        combination of mutex type and location. Somewhat useless.

  V$MUTEX_SLEEP_HISTORY
        Shows last individual occurrences of mutex sleeps
        Based on a circular buffer, has most detail
        @mutexprof script

  Systemstate dumps
        http://el-caro.blogspot.com/2007/10/identifying-mutex-holder.html


Tanel Põder                      http://www.tanelpoder.com                                 12
Mutex waits and their meaning - 1
  cursor: mutex S
        We try to get a mutex on Parent cursor or V$SQLSTAT bucket in
        shared mode.
        The mutex is "in flux" (someone is in progress of taking it in shared
        mode) so we have to wait until the holder finishes its shared get.
        Used when:
          • Examining parent cursor, Querying V$SQLSTATS bucket


  cursor: mutex X
        We try to get a mutex on Parent cursor or V$SQLSTAT bucket in
        exclusive mode.
        Someone is already holding the mutex in incompatible mode
        ...Either there's someone already holding the mutex in X mode
        ...Or there may be multiple holders in S mode
        Used when:
          • Loading new child cursor under parent, Modifying V$SQLSTATS bucket,
              Updating bind capture data


Tanel Põder                       http://www.tanelpoder.com                   13
Mutex waits and their meaning - 2
  cursor: pin S
        We try to pin the cursor in shared mode (for execution for example)
        Mutex for child cursor pinning is "in flux", someone is in process of
        pinning that same cursor already.
        We have to wait until the other session completes their pin request


  cursor: pin X
        We try to pin a cursor in exclusive mode, but someone already has
        pinned it in a non-compatible mode
        Either one session has pinned it in X mode or multiple sessions in S
        mode


  cursor: pin S wait on X
        We try to pin a cursor in shared mode, but someone already has
        pinned it in X mode
        Other session is currently loading that child cursor (parsing)


Tanel Põder                   http://www.tanelpoder.com                    14
Mutex waits and their meaning - 3
  In 11g, most library cache latches have been replaced by
  mutexes directly on library cache hash buckets
        131072 KGL hash buckets
        Each is protected by a separate mutex
        Less room for false contention
        http://blog.tanelpoder.com/2008/08/03/library-cache-latches-gone-in-oracle-11g/


  library cache: mutex S
        Trying to get a mutex on library cache hash bucket in S mode
        The mutex is already held in incompatible mode or is "in flux"


  library cache: mutex X
        Trying to get a mutex on library cache hash bucket in X mode
        The mutex is already held in incompatible mode or is "in flux"




Tanel Põder                        http://www.tanelpoder.com                              15
Mutex wait event parameters - 1
SQL> @sed mutex     <-- this script queries v$event_name

EVENT_NAME                    PARAMETER1             PARAMETER2        PARAMETER3
-------------------------     ---------------        ---------------   ------------
cursor: mutex S               idn                    value             where|sleeps
cursor: mutex X               idn                    value             where|sleeps
cursor: pin S                 idn                    value             where|sleeps
cursor: pin S wait on X       idn                    value             where|sleeps
cursor: pin X                 idn                    value             where|sleeps
library cache: mutex S        idn                    value             where
library cache: mutex X        idn                    value             where

  As with any wait event, the parameters (P1,P2,P3) provide
  additional detail, context info about the wait:

        Parameter1 (idn) can be used for finding the cursor related to
        mutex
        Parameter 2 (value) can be used for finding the session holding the
        mutex in exclusive mode
          • For all shared mode holders a systemstate dump would be needed


Tanel Põder                     http://www.tanelpoder.com                         16
Mutex wait event parameters - 2

  PARAMETER1 - idn:
         cursor:* wait events
          •   idn = hash value of the library cache object under protection


         library cache: mutex* wait events
          1) library cache hash bucket number (if idn <= 131072)
          2) idn = hash value of the library cache object under protection (if idn >
              131072)


Find SQL by hash_value:
    SELECT sql_text FROM v$sql WHERE hash_value = &idn;

Find SQL by library cache hash bucket (idn <= 131072):
    SELECT sql_text FROM v$sql WHERE MOD(hash_value, 131072) = &idn;

Find SQL from AWR by SQL_ID (hash_value is the lower half of SQLID):
    SELECT sql_text FROM dba_hist_sqlstat
    WHERE tpt.sqlid_to_sqlhash( sql_id ) = &idn;

You'll find the TPT package in setup directory in TPT_public.zip

Tanel Põder                       http://www.tanelpoder.com                            17
Mutex wait event parameters - 3

  PARAMETER2 - value:
         low bytes of word (2 or 4 bytes) - number of mutex shared
         references
         high bytes of word (2 or 4 bytes) - SID of exclusive holder

SQL> select session_id, event, blocking_session,
  2         to_char(p2, '0XXXXXXX') value_hex
  3 from v$active_session_history
  4 where event like 'library cache: mutex%';

SESSION_ID EVENT                       BLOCKING_SESSION VALUE_HEX
---------- --------------------------- ---------------- ---------
       157 library cache: mutex X                         00830000



  PARAMETER 3 - where:
         where = maps to x$mutex_sleep.location_id
         Useful for understanding from which kernel function the mutex get
         operation was done. Used for advanced diagnostics.

Tanel Põder                    http://www.tanelpoder.com                 18
Questions?




Tanel Põder   http://www.tanelpoder.com   19
Thank you !!!

  Further questions are welcome:
        tanel@tanelpoder.com



  Slides, scripts and my blog:
        http://blog.tanelpoder.com



  If you liked this session, you will also like my
  Advanced Oracle Troubleshooting seminar!
        I do both public and private corporate seminars
        http://blog.tanelpoder.com/seminar/




Tanel Põder                    http://www.tanelpoder.com   20

Mais conteúdo relacionado

Mais procurados

Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizerMauro Pagano
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsZohar Elkayam
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWRpasalapudi
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performanceMauro Pagano
 
Understanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersUnderstanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersCarlos Sierra
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsCarlos Sierra
 
SQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cTanel Poder
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsEnkitec
 
Oracle Database SQL Tuning Concept
Oracle Database SQL Tuning ConceptOracle Database SQL Tuning Concept
Oracle Database SQL Tuning ConceptChien Chung Shen
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTanel Poder
 
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...Carlos Sierra
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptChien Chung Shen
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQLKyle Hailey
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuningGuy Harrison
 

Mais procurados (20)

Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performance
 
Understanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersUnderstanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginners
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
SQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12c
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Oracle Database SQL Tuning Concept
Oracle Database SQL Tuning ConceptOracle Database SQL Tuning Concept
Oracle Database SQL Tuning Concept
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
 
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning Concept
 
SQLd360
SQLd360SQLd360
SQLd360
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQL
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 

Destaque

Oracle LOB Internals and Performance Tuning
Oracle LOB Internals and Performance TuningOracle LOB Internals and Performance Tuning
Oracle LOB Internals and Performance TuningTanel Poder
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1Tanel Poder
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder
 
Low Level CPU Performance Profiling Examples
Low Level CPU Performance Profiling ExamplesLow Level CPU Performance Profiling Examples
Low Level CPU Performance Profiling ExamplesTanel Poder
 
Oracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known FeaturesOracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known FeaturesTanel Poder
 
Oracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionTanel Poder
 
GNW01: In-Memory Processing for Databases
GNW01: In-Memory Processing for DatabasesGNW01: In-Memory Processing for Databases
GNW01: In-Memory Processing for DatabasesTanel Poder
 
Database & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdf
Database & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdfDatabase & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdf
Database & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdfInSync2011
 
Modern Linux Performance Tools for Application Troubleshooting
Modern Linux Performance Tools for Application TroubleshootingModern Linux Performance Tools for Application Troubleshooting
Modern Linux Performance Tools for Application TroubleshootingTanel Poder
 
SQL in the Hybrid World
SQL in the Hybrid WorldSQL in the Hybrid World
SQL in the Hybrid WorldTanel Poder
 
Connecting Hadoop and Oracle
Connecting Hadoop and OracleConnecting Hadoop and Oracle
Connecting Hadoop and OracleTanel Poder
 
Trouble shoot with linux syslog
Trouble shoot with linux syslogTrouble shoot with linux syslog
Trouble shoot with linux syslogashok191
 
Linux Shell Scripting Craftsmanship
Linux Shell Scripting CraftsmanshipLinux Shell Scripting Craftsmanship
Linux Shell Scripting Craftsmanshipbokonen
 
UNIX - Class5 - Advance Shell Scripting-P2
UNIX - Class5 - Advance Shell Scripting-P2UNIX - Class5 - Advance Shell Scripting-P2
UNIX - Class5 - Advance Shell Scripting-P2Nihar Ranjan Paital
 
UNIX - Class4 - Advance Shell Scripting-P1
UNIX - Class4 - Advance Shell Scripting-P1UNIX - Class4 - Advance Shell Scripting-P1
UNIX - Class4 - Advance Shell Scripting-P1Nihar Ranjan Paital
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritpingchockit88
 
Module 13 - Troubleshooting
Module 13 - TroubleshootingModule 13 - Troubleshooting
Module 13 - TroubleshootingT. J. Saotome
 

Destaque (20)

Oracle LOB Internals and Performance Tuning
Oracle LOB Internals and Performance TuningOracle LOB Internals and Performance Tuning
Oracle LOB Internals and Performance Tuning
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata Migrations
 
Low Level CPU Performance Profiling Examples
Low Level CPU Performance Profiling ExamplesLow Level CPU Performance Profiling Examples
Low Level CPU Performance Profiling Examples
 
Oracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known FeaturesOracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known Features
 
Oracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in Action
 
GNW01: In-Memory Processing for Databases
GNW01: In-Memory Processing for DatabasesGNW01: In-Memory Processing for Databases
GNW01: In-Memory Processing for Databases
 
Database & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdf
Database & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdfDatabase & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdf
Database & Technology 1 | Andrew Holdsworth | Orace Database Performance.pdf
 
Modern Linux Performance Tools for Application Troubleshooting
Modern Linux Performance Tools for Application TroubleshootingModern Linux Performance Tools for Application Troubleshooting
Modern Linux Performance Tools for Application Troubleshooting
 
SQL in the Hybrid World
SQL in the Hybrid WorldSQL in the Hybrid World
SQL in the Hybrid World
 
Connecting Hadoop and Oracle
Connecting Hadoop and OracleConnecting Hadoop and Oracle
Connecting Hadoop and Oracle
 
Trouble shoot with linux syslog
Trouble shoot with linux syslogTrouble shoot with linux syslog
Trouble shoot with linux syslog
 
Linux Shell Scripting Craftsmanship
Linux Shell Scripting CraftsmanshipLinux Shell Scripting Craftsmanship
Linux Shell Scripting Craftsmanship
 
UNIX - Class5 - Advance Shell Scripting-P2
UNIX - Class5 - Advance Shell Scripting-P2UNIX - Class5 - Advance Shell Scripting-P2
UNIX - Class5 - Advance Shell Scripting-P2
 
Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02
 
UNIX - Class1 - Basic Shell
UNIX - Class1 - Basic ShellUNIX - Class1 - Basic Shell
UNIX - Class1 - Basic Shell
 
UNIX - Class4 - Advance Shell Scripting-P1
UNIX - Class4 - Advance Shell Scripting-P1UNIX - Class4 - Advance Shell Scripting-P1
UNIX - Class4 - Advance Shell Scripting-P1
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
Module 13 - Troubleshooting
Module 13 - TroubleshootingModule 13 - Troubleshooting
Module 13 - Troubleshooting
 

Semelhante a Oracle Latch and Mutex Contention Troubleshooting

Sangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL JediSangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL JediConnor McDonald
 
AOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itAOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itZubair Nabi
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful developmentConnor McDonald
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Ontico
 
LCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLinaro
 
Devoxx France 2018 : Mes Applications en Production sur Kubernetes
Devoxx France 2018 : Mes Applications en Production sur KubernetesDevoxx France 2018 : Mes Applications en Production sur Kubernetes
Devoxx France 2018 : Mes Applications en Production sur KubernetesMichaël Morello
 
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...Jean-Philippe BEMPEL
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)Sneeker Yeh
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaShiao-An Yuan
 
Mastering java in containers - MadridJUG
Mastering java in containers - MadridJUGMastering java in containers - MadridJUG
Mastering java in containers - MadridJUGJorge Morales
 
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devicessrkedmi
 
VMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld
 
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxyBo-Yi Wu
 
Writing Metasploit Plugins
Writing Metasploit PluginsWriting Metasploit Plugins
Writing Metasploit Pluginsamiable_indian
 
Container Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, NetflixContainer Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, NetflixDocker, Inc.
 
Performance Tuning EC2 Instances
Performance Tuning EC2 InstancesPerformance Tuning EC2 Instances
Performance Tuning EC2 InstancesBrendan Gregg
 

Semelhante a Oracle Latch and Mutex Contention Troubleshooting (20)

Sangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL JediSangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL Jedi
 
AOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itAOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on it
 
opt-mem-trx
opt-mem-trxopt-mem-trx
opt-mem-trx
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful development
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
 
LCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC session
 
Devoxx France 2018 : Mes Applications en Production sur Kubernetes
Devoxx France 2018 : Mes Applications en Production sur KubernetesDevoxx France 2018 : Mes Applications en Production sur Kubernetes
Devoxx France 2018 : Mes Applications en Production sur Kubernetes
 
spinlock.pdf
spinlock.pdfspinlock.pdf
spinlock.pdf
 
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Latches v4
Latches v4Latches v4
Latches v4
 
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Mastering java in containers - MadridJUG
Mastering java in containers - MadridJUGMastering java in containers - MadridJUG
Mastering java in containers - MadridJUG
 
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
 
VMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep Dive
 
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
 
Writing Metasploit Plugins
Writing Metasploit PluginsWriting Metasploit Plugins
Writing Metasploit Plugins
 
Container Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, NetflixContainer Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, Netflix
 
Performance Tuning EC2 Instances
Performance Tuning EC2 InstancesPerformance Tuning EC2 Instances
Performance Tuning EC2 Instances
 

Último

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Oracle Latch and Mutex Contention Troubleshooting

  • 1. Latch and Mutex Contention Troubleshooting in Oracle Tanel Põder http://blog.tanelpoder.com
  • 2. If you like this session... ...then you're probably an Oracle geek like me ;) And you will like my tech-blog: http://blog.tanelpoder.com All my scripts freely downloadable http://blog.tanelpoder.com/seminar/seminar-files/ Look for TPT scripts Oh... and I do seminars with much more stuff like this ;-) And I also fix these kinds of problems as a consultant http://blog.tanelpoder.com/seminar/ tanel@tanelpoder.com Tanel Põder http://www.tanelpoder.com 2
  • 3. Intro to latching - 1 What is a latch? Oracle's low-level mechanism for serializing concurrent access to very shortly accessed memory structures such as cache buffer headers etc... Blah blah blah! Yeah, but what is a latch? Latch is just a simple memory structure Usually around 100-200B in size (dependent on version,platform) Is wrapped into a latch state object structure (since v8.0 I think) Can reside in fixed SGA (parent latches) or shared pool Is set using hardware-atomic compare-and-swap (CAS) instructions • LOCK CMPXCHG on intel Latches are taken and released without any OS interaction • Actually the OS doesn't even have a clue that Oracle latches exist! Can be shared (since Oracle 8.0) • Used for some AQ ops • For example, used for cache buffers chains latch gets if examining a buffer chain Tanel Põder http://www.tanelpoder.com 3
  • 4. The real intro to latching Latch is a lock period. Tanel Põder http://www.tanelpoder.com 4
  • 5. Latch contention What is latch contention? I want to get a latch... but someone is already holding it! To troubleshoot, find out: 1) Who and why tries to get the latch (waiter) 2) Who and why are holding the latch (blocker) In other words - find who and why is blocking us! Just like with regular enqueue locks... Remember, latches are locks! Tanel Põder http://www.tanelpoder.com 5
  • 6. Latch contention troubleshooting V$SESSION_WAIT / V$ACTIVE_SESSION_HISTORY PARAMETER1 = latch address for any latch wait event sw, WaitProf to see latch addresses of latch wait events Addresses map to v$latch_parent/v$latch_children.ADDR column SQL Trace you need to convert the P1/address number to hex: WAIT #3: nam='latch free' ela= 3749 address=15709454624 number=202 tries=1 obj#=-1 tim=5650189627 SQL> select to_char(15709454624, 'XXXXXXXXXXXXXXXX') addr_hex from dual; ADDR_HEX ----------------- 3A85B4120 SQL> @la 3A85B4120 ADDR LATCH# CHLD NAME GETS ---------------- ---------- ------ --------------- ---------- 00000003A85B4120 202 2 kks stats 494562 Tanel Põder http://www.tanelpoder.com 6
  • 7. Identifying latch holders V$LATCHHOLDER Shows top-level latch holders from process state objects • See the Session ID of latch holder!!! Any latch held by a process state object is shown there Works in 99.9% of cases - enough for practical troubleshooting Additional latches held (while the top-level one is held) are not reported by v$latchholder :-( In the 0.01% of cases a fallback to old latch contention troubleshooting method could be used • Alternatively its possible to traverse state object trees via direct SGA attach SQL> desc v$latchholder Name Null? Type ------------------------------- -------- ------------ 1 PID NUMBER 2 SID NUMBER 3 LADDR RAW(8) 4 NAME VARCHAR2(64) 5 GETS NUMBER Tanel Põder http://www.tanelpoder.com 7
  • 8. Latch contention troubleshooting approach 1. Identify the session(s) experiencing problems Remember, databases don't have problems, only users, through database sessions 2. Quantify for which latch that session is waiting for the most ...and whether the wait time is significant enough 3. Identify the child latch involved in contention Is the contention concentrated on a particular child latch or is it spread across many? 4. Identify where in kernel code (why) the latch is held from V$LATCHHOLDER LatchProfX / X$KSUPRLAT / X$KSUPR if problem with some sessions Tanel Põder http://www.tanelpoder.com 8
  • 9. Latch contention troubleshooting with LatchProfX Sample V$LATCHHOLDER stats with LatchProfX, fast 10-100k samples per second! @latchprofx <columns> <sid> <latches> <#samples> @latchprofx sid,name,func,hmode % % 1000000 SQL> @latchprofx sid,name,func,hmode &sid % 100000 -- LatchProfX 1.07 by Tanel Poder ( http://www.tanelpoder.com ) SID NAME FUNC HMODE Held ---------- ----------------------------------- ---------------------------------------- ------------ ---------- 139 shared pool kghalo exclusive 3174 139 shared pool kghalp exclusive 1294 139 shared pool kghupr1 exclusive 704 139 shared pool simulator kglsim_unpin_simhp exclusive 581 139 kks stats kksAllocChildStat exclusive 489 139 shared pool simulator kglsim_upd_newhp exclusive 240 139 row cache objects kqrpre: find obj exclusive 158 139 enqueues ksqdel exclusive 116 139 enqueues ksqgel: create enqueue exclusive 91 139 shared pool kgh_heap_sizes exclusive 90 139 row cache objects kqreqd: reget exclusive 58 139 enqueue hash chains ksqgtl3 exclusive 57 139 shared pool simulator kglsim_scan_lru: scan exclusive 53 139 shared pool kghfre exclusive 49 139 row cache objects kqreqd exclusive 41 139 enqueue hash chains ksqrcl exclusive 36 139 shared pool simulator kglsim_chg_simhp_free exclusive 22 139 shared pool kghasp exclusive 18 139 MinActiveScn Latch ktucloGetGlobalMinScn shared 14 Tanel Põder http://www.tanelpoder.com 9
  • 10. KGX mutexes KGX = Kernel Generic muteX module Kernel functions managing mutexes start with kgx Introduced in Oracle 10.2 Physically like a latch (a piece of memory) • only more lightweight • and smaller Can be embedded inside other structures (lib cache object handle) Can have flexible spin/yield/wait strategy defined by "client" Do not account SPINGETS,YIELDS, only WAITS • GETS are accounted internally, but not externalized in any view KGX mutexes are not OS mutexes!!! Tanel Põder http://www.tanelpoder.com 10
  • 11. Mutexes for Library Cache Used for protecting V$SQLSTATS buckets oradebug dump cursor_stats 1 Used for pinning library cache cursors and parent examination If _kks_use_mutex_pin=true (default from 10.2.0.2) oradebug dump librarycache level 10 In 11g+ mutexes are used instead of most library cache latches Instead of up to 67 library cache latches there's 131072 mutexes! Each library cache mutex protects one library cache hash bucket Known mutex types in 11g: Cursor Parent Cursor Pin Cursor Stat Library Cache hash table ... Tanel Põder http://www.tanelpoder.com 11
  • 12. Mutex troubleshooting V$SESSION_WAIT The mutex sleeps are well instrumented Shows wait events such: in wait interface. P1,P2,P3 values show • cursor: mutex S what is the hash value of library cache • cursor: mutex X objects under contention, the session • library cache: mutex S holding the mutex etc. v$event_name and v$session_wait "text" • library cache: mutex X columns document the meaning of P1,P2,P3 V$MUTEX_SLEEP Shows the wait time, and the number of sleeps for each combination of mutex type and location. Somewhat useless. V$MUTEX_SLEEP_HISTORY Shows last individual occurrences of mutex sleeps Based on a circular buffer, has most detail @mutexprof script Systemstate dumps http://el-caro.blogspot.com/2007/10/identifying-mutex-holder.html Tanel Põder http://www.tanelpoder.com 12
  • 13. Mutex waits and their meaning - 1 cursor: mutex S We try to get a mutex on Parent cursor or V$SQLSTAT bucket in shared mode. The mutex is "in flux" (someone is in progress of taking it in shared mode) so we have to wait until the holder finishes its shared get. Used when: • Examining parent cursor, Querying V$SQLSTATS bucket cursor: mutex X We try to get a mutex on Parent cursor or V$SQLSTAT bucket in exclusive mode. Someone is already holding the mutex in incompatible mode ...Either there's someone already holding the mutex in X mode ...Or there may be multiple holders in S mode Used when: • Loading new child cursor under parent, Modifying V$SQLSTATS bucket, Updating bind capture data Tanel Põder http://www.tanelpoder.com 13
  • 14. Mutex waits and their meaning - 2 cursor: pin S We try to pin the cursor in shared mode (for execution for example) Mutex for child cursor pinning is "in flux", someone is in process of pinning that same cursor already. We have to wait until the other session completes their pin request cursor: pin X We try to pin a cursor in exclusive mode, but someone already has pinned it in a non-compatible mode Either one session has pinned it in X mode or multiple sessions in S mode cursor: pin S wait on X We try to pin a cursor in shared mode, but someone already has pinned it in X mode Other session is currently loading that child cursor (parsing) Tanel Põder http://www.tanelpoder.com 14
  • 15. Mutex waits and their meaning - 3 In 11g, most library cache latches have been replaced by mutexes directly on library cache hash buckets 131072 KGL hash buckets Each is protected by a separate mutex Less room for false contention http://blog.tanelpoder.com/2008/08/03/library-cache-latches-gone-in-oracle-11g/ library cache: mutex S Trying to get a mutex on library cache hash bucket in S mode The mutex is already held in incompatible mode or is "in flux" library cache: mutex X Trying to get a mutex on library cache hash bucket in X mode The mutex is already held in incompatible mode or is "in flux" Tanel Põder http://www.tanelpoder.com 15
  • 16. Mutex wait event parameters - 1 SQL> @sed mutex <-- this script queries v$event_name EVENT_NAME PARAMETER1 PARAMETER2 PARAMETER3 ------------------------- --------------- --------------- ------------ cursor: mutex S idn value where|sleeps cursor: mutex X idn value where|sleeps cursor: pin S idn value where|sleeps cursor: pin S wait on X idn value where|sleeps cursor: pin X idn value where|sleeps library cache: mutex S idn value where library cache: mutex X idn value where As with any wait event, the parameters (P1,P2,P3) provide additional detail, context info about the wait: Parameter1 (idn) can be used for finding the cursor related to mutex Parameter 2 (value) can be used for finding the session holding the mutex in exclusive mode • For all shared mode holders a systemstate dump would be needed Tanel Põder http://www.tanelpoder.com 16
  • 17. Mutex wait event parameters - 2 PARAMETER1 - idn: cursor:* wait events • idn = hash value of the library cache object under protection library cache: mutex* wait events 1) library cache hash bucket number (if idn <= 131072) 2) idn = hash value of the library cache object under protection (if idn > 131072) Find SQL by hash_value: SELECT sql_text FROM v$sql WHERE hash_value = &idn; Find SQL by library cache hash bucket (idn <= 131072): SELECT sql_text FROM v$sql WHERE MOD(hash_value, 131072) = &idn; Find SQL from AWR by SQL_ID (hash_value is the lower half of SQLID): SELECT sql_text FROM dba_hist_sqlstat WHERE tpt.sqlid_to_sqlhash( sql_id ) = &idn; You'll find the TPT package in setup directory in TPT_public.zip Tanel Põder http://www.tanelpoder.com 17
  • 18. Mutex wait event parameters - 3 PARAMETER2 - value: low bytes of word (2 or 4 bytes) - number of mutex shared references high bytes of word (2 or 4 bytes) - SID of exclusive holder SQL> select session_id, event, blocking_session, 2 to_char(p2, '0XXXXXXX') value_hex 3 from v$active_session_history 4 where event like 'library cache: mutex%'; SESSION_ID EVENT BLOCKING_SESSION VALUE_HEX ---------- --------------------------- ---------------- --------- 157 library cache: mutex X 00830000 PARAMETER 3 - where: where = maps to x$mutex_sleep.location_id Useful for understanding from which kernel function the mutex get operation was done. Used for advanced diagnostics. Tanel Põder http://www.tanelpoder.com 18
  • 19. Questions? Tanel Põder http://www.tanelpoder.com 19
  • 20. Thank you !!! Further questions are welcome: tanel@tanelpoder.com Slides, scripts and my blog: http://blog.tanelpoder.com If you liked this session, you will also like my Advanced Oracle Troubleshooting seminar! I do both public and private corporate seminars http://blog.tanelpoder.com/seminar/ Tanel Põder http://www.tanelpoder.com 20