Shared Pool Waits. #.2 Copyright 2006 Kyle Hailey Shared Pool Waits 1.Latch: Library Cache 2.Latch: Shared Pool Latch 3.Library Cache Pin 4.Library Cache.

Slides:



Advertisements
Similar presentations
Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
Advertisements

Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
CS492B Analysis of Concurrent Programs Lock Basics Jaehyuk Huh Computer Science, KAIST.
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.
Royal London Group A group of specialist businesses where the bottom line is always financial sense Oracle Statistics – with a little bit extra on top.
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.
Copyright © 200\8 Quest Software High Performance PL/SQL Guy Harrison Chief Architect, Database Solutions.
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
The Self-managing Database: Automatic Performance Diagnosis Graham Wood Kyle Hailey Oracle Corporation Session id:
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
1 - Oracle Server Architecture Overview
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
CS533 Concepts of Operating Systems Class 2 Thread vs Event-Based Programming.
Computer Organization and Architecture
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.
Real-Time Concepts for Embedded Systems Author: Qing Li with Caroline Yao ISBN: CMPBooks.
Shared Pool Waits. #.2 Copyright 2006 Kyle Hailey Shared Pool Waits  Library Cache Latch  Shared Pool Latch  Library Cache Pin  Library Cache Lock.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Part II : Waits Events Kyle Hailey
Exam2 Review Bernard Chen Spring Deadlock Example semaphores A and B, initialized to 1 P0 P1 wait (A); wait(B) wait (B); wait(A)
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
Buffer Cache Waits. In This Section 1.latch: cache buffers chains 2.latch: cache buffers lru chain 3.Free Buffer Wait 4.Buffer Busy Wait 5.Write Complete.
Oracle Locking Michael Messina Principal Database Analyst Indiana University.
Buffer Cache Waits. #.2 In This Section 1.latch: cache buffers chains 2.latch: cache buffers lru chain 3.latch: cache buffer handles 4.Free Buffer Wait.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
ECE200 – Computer Organization Chapter 9 – Multiprocessors.
1 06/05/08 Statspack Kyle Hailey
Outline Introduction to Oracle Memory Structures SGA, PGA, SCA The Specifics of the System Global Area (SGA) Structures Overview of Program Global Areas.
Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
#.6 Sampling Kyle Hailey
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Dynamic SQL. 2 home back first prev next last What Will I Learn? Recall the stages through which all SQL statements pass Describe the reasons for using.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
Processes and Virtual Memory
Shared Pool Waits Kyle Hailey
#.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.
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
Oracle9i Performance Tuning Chapter 4 Tuning the Shared Pool Memory.
Lock Tuning. Overview Data definition language (DDL) statements are considered harmful DDL is the language used to access and manipulate catalog or metadata.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Cursor Sharing Bug: Bug : cursor_sharing=force causes ORA-7445 and core dumps related bugs – : production instance crashed with.
8 Copyright © 2006, Oracle. All rights reserved. Tuning the Shared Pool.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Process concept.
Module 11: File Structure
CS703 – Advanced Operating Systems
Paging COMP 755.
Process Description and Control
Part II : Waits Events and the Geeks who love them
Chapter 8: Main Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Kyle Hailey Enqueue Waits : Locks Kyle Hailey
SQL Statement Processing
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Memory Management Tasks
Oracle Memory Internals
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
CS333 Intro to Operating Systems
CSE 542: Operating Systems
Inside the Database Engine
Presentation transcript:

Shared Pool Waits

#.2 Copyright 2006 Kyle Hailey Shared Pool Waits 1.Latch: Library Cache 2.Latch: Shared Pool Latch 3.Library Cache Pin 4.Library Cache Lock 5.Library Cache Load Lock 6.Row Cache Lock

#.3 Copyright 2006 Kyle Hailey Library Cache Lib Cache

#.4 Copyright 2006 Kyle Hailey Hash Table handle Shared Pool Structure SQL statements are hashed On their text. The resulting Hash is used to find the appropriate bucket, which is searched for the Compiled SQL. If it’s not there, then we parse it.

#.5 Copyright 2006 Kyle Hailey Shared Pool Latch  Contention can arise when too many sessions are hard parsing and looking for space in the shared pool.  The shared pool latch protects the structure containing memory chunks  Protects Space Allocation in the Shared Pool  Shared Pool latch make sure two users don’t get same chunk of memory

#.6 Copyright 2006 Kyle Hailey   Get library cache latch   Get shared pool latch   Search right bucket   Find best fit   If lists get long, search gets long Shared Pool Latch _kghdsidx_count number of shared pool latches Not supported to change, but increasing it can increase ORA-4031s if shared pool Is not increased as well

#.7 Copyright 2006 Kyle Hailey Shared Pool Free Space Shared Pool Latch covers changes in the lists of free memory chunks Shared Pool Latch

#.8 Copyright 2006 Kyle Hailey Bucket sizes 0 < 80 bytes 1 < < < < < < < < < bigger Shared Pool Latch Shared Pool pre Memory Chunk Buckets

#.9 Copyright 2006 Kyle Hailey Shared Pool Free Space Before 8.1.6, oversizing the shared pool could be a problem, after should be fine Shared Pool Latch

#.10 Copyright 2006 Kyle Hailey Shared Pool Memory Chunk Buckets and up 0 16 bytes 1 20 bytes … ( only have one chunk size in bucket ) bytes to 872 …. ( only have 16 possible chunk sizes per bucket ) bigger Shared Pool Latch

#.11 Copyright 2006 Kyle Hailey library cache pin and locks  Locks control access, protects handle  Pins guarantee coherency, protects heaps  To Access to a cursor  Lock handle  Locking is the way of locating  Pin  Pinning loads any necessary heaps  Guaranteed to stay in memory until pin is released handle pin lock Heap 1 Child cursor 1 Heap 6 Heap 0

#.12 Copyright 2006 Kyle Hailey library cache lock and pins   Contention when Sessions try to   load/compile same SQL   Compile package others are running   Locks and Pins are usually in share mode unless modifications are being made

#.13 Copyright 2006 Kyle Hailey Lib Cache Locks and Pins  Object dependency  Library cache lock in Null  Cursor execution  Library lock in null  Pin in Share  Cursor compilation  Lock exclusive  Pin exclusive

#.14 Copyright 2006 Kyle Hailey library cache lock handle pin lock   P1 = address of object   P2 = address of lock   P3 = mode | namespace   See   x$kgllk   dba_kgllock

#.15 Copyright 2006 Kyle Hailey library cache pin  P1 = address of object  P2 = address of lock  P3 = Mode | Namespace  See  dba_kgllock  x$kglpn handle pin lock

#.16 Copyright 2006 Kyle Hailey Library cache lock & pin select w.sid, kglob.KGLNAOBJ from x$kglob kglob, v$session_wait w where kglob.KGLHDADR= w.P1RAW and event like '%library%'; select w.sid, kglob.KGLNAOBJ from x$kglob kglob, v$session_wait w where kglob.KGLHDADR= w.P1RAW and event like '%library%';

#.17 Copyright 2006 Kyle Hailey dba_kgllock For library cache pins and lock waits  Session_wait.p1raw = x$kglpn.kgllkhdl  dba_kgllock.id1  x$kgllk.kgllkhdl

#.18 Copyright 2006 Kyle Hailey Lib Cache Lock : blockers and waiters select waiter.sid waiter, waiter.event wevent, to_char(blocker_event.sid)||','||to_char(blocker_session.serial#) blocker, substr(decode(blocker_event.wait_time, 0, blocker_event.event, 'ON CPU'),1,30) bevent from x$kglpn p, gv$session blocker_session, gv$session_wait waiter, gv$session_wait blocker_event where p.kglpnuse=blocker_session.saddr and p.kglpnhdl=waiter.p1raw and (waiter.event in ( 'library cache pin', 'library cache lock', 'library cache load lock') and blocker_event.sid=blocker_session.sid and waiter.sid != blocker_event.sid order by waiter.p1raw,waiter.sid; select waiter.sid waiter, waiter.event wevent, to_char(blocker_event.sid)||','||to_char(blocker_session.serial#) blocker, substr(decode(blocker_event.wait_time, 0, blocker_event.event, 'ON CPU'),1,30) bevent from x$kglpn p, gv$session blocker_session, gv$session_wait waiter, gv$session_wait blocker_event where p.kglpnuse=blocker_session.saddr and p.kglpnhdl=waiter.p1raw and (waiter.event in ( 'library cache pin', 'library cache lock', 'library cache load lock') and blocker_event.sid=blocker_session.sid and waiter.sid != blocker_event.sid order by waiter.p1raw,waiter.sid; WAITER WLOCKP1 WEVENT BLOCKER BEVENT B76AB620 library cache pin 135,15534 PL/SQL lock timer WAITER WLOCKP1 WEVENT BLOCKER BEVENT B76AB620 library cache pin 135,15534 PL/SQL lock timer

#.19 Copyright 2006 Kyle Hailey Solutions  Have only one Session compile the same cursor at a time  Avoid compiling while executing  Waits – find “competing” Sessions

#.20 Copyright 2006 Kyle Hailey library cache load lock Waiting For a Reload by another Session  P1 = object address  P2 = lock address  P3 = 100*mask+namespace

#.21 Copyright 2006 Kyle Hailey Library Cache Latches  Protects changes in Library Cache  Library Locks are not atomic  Thus need library cache latch  Broken out into  library cache pin allocation  library cache lock allocation  library cache lock  library cache  library cache pin  library cache load lock

#.22 Copyright 2006 Kyle Hailey Hash Table handle pin lock Library Cache handle Find and Lock Pin (and Load)

#.23 Copyright 2006 Kyle Hailey Child cursor 3 Hash Table handle Cursor (0) pin lock Heap 1 Child cursor 1 Child cursor 2 Heap 6 pin lock Heap 0 pin lock waiters holders Handle Cursor(0) flags Library Cache Structures Library Cache Latch

#.24 Copyright 2006 Kyle Hailey Library Cache Latch Contention  Excessive Hard Parsing  Not Sharing SQL – use of Literal Values  Shared Pool too small  Too many invalidations  Excessive Soft Parsing

#.25 Copyright 2006 Kyle Hailey Sharing SQL & Literals select plan_hash_value, plan_hash_value,count(plan_hash_value)fromv$sql group by plan_hash_value, order by count(plan_hash_value) select plan_hash_value, plan_hash_value,count(plan_hash_value)fromv$sql group by plan_hash_value, order by count(plan_hash_value) PLAN_HASH_VALUE CNT PLAN_HASH_VALUE CNT

#.26 Copyright 2006 Kyle Hailey Sharing SQL & Literals SQL_TEXT SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SQL_TEXT SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= SELECT * FROM dual WHERE dummy= select sql_text from v$sql where plan_hash_value = and rownum < 10; select sql_text from v$sql where plan_hash_value = and rownum < 10; PLAN_HASH_VALUE CNT PLAN_HASH_VALUE CNT

#.27 Copyright 2006 Kyle Hailey Cursor Sharing  Bind Variables  Select * from dual where dummy = :var;  Cursor_Sharing  Cursor_sharing = Force Oracle replaces variables with bind variables  Defaults to Exact

#.28 Copyright 2006 Kyle Hailey Shared Pool too Small  Reloads means Cursor heaps were kicked out implying shared_pool too small SQL> select namespace, reloads from v$librarycache; from v$librarycache; NAMESPACE RELOADS SQL AREA 367 TABLE/PROCEDURE 592 SQL> select namespace, reloads from v$librarycache; from v$librarycache; NAMESPACE RELOADS SQL AREA 367 TABLE/PROCEDURE 592

#.29 Copyright 2006 Kyle Hailey Invalidations  Changes in dependent objects invalidate cursor FOR i IN LOOP l_cursor:=dbms_sql.open_cursor; dbms_sql.parse(l_cursor, 'SELECT * FROM toto',dbms_sql.native); execute immediate 'analyze table toto compute statistics'; dbms_sql.close_cursor(l_cursor); END LOOP; SQL> select namespace, invalidations invalidations from v$librarycache; from v$librarycache; NAMESPACE INVALIDATIONS SQL AREA 6065 SQL> select namespace, invalidations invalidations from v$librarycache; from v$librarycache; NAMESPACE INVALIDATIONS SQL AREA 6065 FOR i IN LOOP l_cursor:=dbms_sql.open_cursor; dbms_sql.parse(l_cursor, 'SELECT * FROM toto',dbms_sql.native); execute immediate 'analyze table toto compute statistics'; dbms_sql.close_cursor(l_cursor); END LOOP;

#.30 Copyright 2006 Kyle Hailey Re-Executing a Cursor 1.Libray Cache latch 2.Locks 3.Pins pin lock Execute 1Execute 2Execute 3Execute 4Execute 5 Cursor Memory lock = Latch Soft Parsing

#.31 Copyright 2006 Kyle Hailey Session Cached Cursors Execute 1Execute 2Execute 3Execute 4Execute 5 Cursor Memory lock = Latch pin Session_cached_cursor: If Opening/Closing keeps locked in Memory

#.32 Copyright 2006 Kyle Hailey Session Cached Cursors FOR i IN LOOP FOR i IN LOOP l_cursor:=dbms_sql.open_cursor; l_cursor:=dbms_sql.open_cursor; dbms_sql.parse(l_cursor,'SELECT * FROM dual’,dbms_sql.native); dbms_sql.parse(l_cursor,'SELECT * FROM dual’,dbms_sql.native); dbms_sql.close_cursor(l_cursor); dbms_sql.close_cursor(l_cursor); END LOOP; END LOOP; FOR i IN LOOP FOR i IN LOOP l_cursor:=dbms_sql.open_cursor; l_cursor:=dbms_sql.open_cursor; dbms_sql.parse(l_cursor,'SELECT * FROM dual’,dbms_sql.native); dbms_sql.parse(l_cursor,'SELECT * FROM dual’,dbms_sql.native); dbms_sql.close_cursor(l_cursor); dbms_sql.close_cursor(l_cursor); END LOOP; END LOOP; Session_cached_cursors=0 Latch Gets library cache lock 120,028 library cache 180,074 library cache pin 60,048 Session_cached_cursors=20 library cache lock 4 library cache 60,061 library cache pin 60,048

#.33 Copyright 2006 Kyle Hailey Cursor Space for Time Execute 1Execute 2Execute 3Execute 4Execute 5 Cursor Memory Cursor_space_for_time=true : if open and re-executing – keeps cursor pinned (Cursor already locked because cursor is kept open) = Latch pin lock OpenCursor CloseCursor

#.34 Copyright 2006 Kyle Hailey Cursor Space For Time FOR i IN LOOP rc:=dbms_sql.execute(l_cursor); rc:=dbms_sql.execute(l_cursor); IF DBMS_SQL.FETCH_ROWS (l_cursor) < 0 THEN IF DBMS_SQL.FETCH_ROWS (l_cursor) < 0 THEN DBMS_SQL.COLUMN_VALUE (l_cursor, 1, cnt); DBMS_SQL.COLUMN_VALUE (l_cursor, 1, cnt); end if; end if; End loop; FOR i IN LOOP rc:=dbms_sql.execute(l_cursor); rc:=dbms_sql.execute(l_cursor); IF DBMS_SQL.FETCH_ROWS (l_cursor) < 0 THEN IF DBMS_SQL.FETCH_ROWS (l_cursor) < 0 THEN DBMS_SQL.COLUMN_VALUE (l_cursor, 1, cnt); DBMS_SQL.COLUMN_VALUE (l_cursor, 1, cnt); end if; end if; End loop; Cursor_space_for_time=false Latch Gets library cache lock 35 library cache 60,096 library cache pin 60,044 Cursor_space_for_time=true library cache lock 30 library cache 85 library cache pin 42

#.35 Copyright 2006 Kyle Hailey Efficient Lock and Pinning  Reduce use of latches  Improve throughput  Improve Concurrency ***

#.36 Copyright 2006 Kyle Hailey Cursor Sharing handle pin lock Child cursor 2 Child cursor 3 select * from ( select sql_id, count(*) cnt from V$SQL_SHARED_CURSOR group by sql_id ) where cnt > 5 order by cnt; Heap 1 Heap 6 Heap 0 Heap 1 Heap 6 Heap 0 Child cursor 4 Heap 1 Heap 6 Heap 0 handle Cursor (0) Handle Cursor(0) flags

#.37 Copyright 2006 Kyle Hailey V$SQL_SHARED_CURSOR  10gR2, 53 reasons why cursors aren’t shared  If using “cursor_sharing=similar” might not work – bugs  Examples  OPTIMIZER_MODE_MISMATCH, see V$SQL_OPTIMIZER_ENV  STATS_ROW_MISMATCH, could be sql trace  AUTH_CHECK_MISMATCH TRANSLATION_MISMATCH – different object in SQL stmt  BIND_MISMATCH – bind variable different sizes  LANGUAGE_MISMATCH – NLS Language

#.38 Copyright 2006 Kyle HaileyV$SQL_SHARED_CURSOR UNBOUND_CURSOR SQL_TYPE_MISMATCH OPTIMIZER_MISMATCH OUTLINE_MISMATCH STATS_ROW_MISMATCH LITERAL_MISMATCH SEC_DEPTH_MISMATCH EXPLAIN_PLAN_CURSOR BUFFERED_DML_MISMATCH PDML_ENV_MISMATCH INST_DRTLD_MISMATCH SLAVE_QC_MISMATCH TYPECHECK_MISMATCH AUTH_CHECK_MISMATCH BIND_MISMATCH DESCRIBE_MISMATCH LANGUAGE_MISMATCH TRANSLATION_MISMATCH ROW_LEVEL_SEC_MISMATCH INSUFF_PRIVS INSUFF_PRIVS_REM REMOTE_TRANS_MISMATCH LOGMINER_SESSION_MISMATCH INCOMP_LTRL_MISMATCH OVERLAP_TIME_MISMATCH SQL_REDIRECT_MISMATCH MV_QUERY_GEN_MISMATCH USER_BIND_PEEK_MISMATCH TYPCHK_DEP_MISMATCH NO_TRIGGER_MISMATCH FLASHBACK_CURSOR ANYDATA_TRANSFORMATION INCOMPLETE_CURSOR TOP_LEVEL_RPI_CURSOR DIFFERENT_LONG_LENGTH LOGICAL_STANDBY_APPLY DIFF_CALL_DURN BIND_UACS_DIFF PLSQL_CMP_SWITCHS_DIFF CURSOR_PARTS_MISMATCH STB_OBJECT_MISMATCH ROW_SHIP_MISMATCH PQ_SLAVE_MISMATCH TOP_LEVEL_DDL_MISMATCH MULTI_PX_MISMATCH BIND_PEEKED_PQ_MISMATCH MV_REWRITE_MISMATCH ROLL_INVALID_MISMATCH OPTIMIZER_MODE_MISMATCH PX_MISMATCH MV_STALEOBJ_MISMATCH FLASHBACK_TABLE_MISMATCH LITREP_COMP_MISMATCH

#.39 Copyright 2006 Kyle Hailey 10g : Mutex  Mutex  Mutual exclusion object  Similar to a latch, prevents  Deallocation while someone is using it  Read/write while someone else is modifying  Different from latch  Every object can have it’s own mutex  A mutex can cover multiple objects  Usually dynamically allocated along with structure they protect  Can be stored in the structure, thus destroying structure deletes the mutex

#.40 Copyright 2006 Kyle Hailey Mutexes  10gR2 new library cache latch mechanism  Replace latches  Takes less memory  From Tanel Pode, On 32bit linux installation a  mutex was 28 bytes in size,  regular latch structure was 110 bytes.  Takes less instructions to  mutex get is about instructions  latch get is instructions  Less contention than latches, because there can be more mutexes  Mutexes stored in each child cursor  Turn off with _kks_use_mutex_pin=false unsupported

#.41 Copyright 2006 Kyle Hailey Mutex Views and Stats  Views  V$mutex_sleep  V$mutex_sleep_history  Waits  Cursor:mutex X  Cursor:mutex S  Cursor:pin X  Cursor:pin S  Cursor:pin S wait on X  Bug on typically with DBMS_STATS  Metalink Note: , Note: , bug

#.42 Copyright 2006 Kyle Hailey 10.2g “cursor: pin S”  cursor: pin S  re-executions of the same cursors  _kks_use_mutex_pin=true  Instead of latching for execute pin we use a shared mutex  If can’t get the mutex spin  Turning off should increase  Library cache pin events

#.43 Copyright 2006 Kyle Hailey row cache lock : args  P1 = cache#  P2 = Lock Mode Held  P3 = Lock Mode Requested select parameter as “name” from v$rowcache where cache# = P1; select parameter as “name” from v$rowcache where cache# = P1;

#.44 Copyright 2006 Kyle Hailey Row Cache Lock - Statspack Top 5 Timed Events Avg %Total ~~~~~~~~~~~~~~~~~~ wait Call Event Waits Time (s) (ms) Time row cache lock 11, CPU time log file parallel write 1, log file sequential read control file parallel write Top 5 Timed Events Avg %Total ~~~~~~~~~~~~~~~~~~ wait Call Event Waits Time (s) (ms) Time row cache lock 11, CPU time log file parallel write 1, log file sequential read control file parallel write

#.45 Copyright 2006 Kyle Hailey Row Cache Lock – Statspack Dictionary Cache Stats DB/Inst: linux3 Snaps: >"Pct Misses" should be very low (<2% in most cases) ->"Final Usage" is the number of cache entries being Get Pct Scan Pct Mod Final Cache Requests Miss Reqs Miss Reqs Usage dc_awr_control dc_object_ids dc_objects dc_profiles dc_sequences 12, ,002 4 dc_tablespaces dc_usernames dc_users Dictionary Cache Stats DB/Inst: linux3 Snaps: >"Pct Misses" should be very low (<2% in most cases) ->"Final Usage" is the number of cache entries being Get Pct Scan Pct Mod Final Cache Requests Miss Reqs Miss Reqs Usage dc_awr_control dc_object_ids dc_objects dc_profiles dc_sequences 12, ,002 4 dc_tablespaces dc_usernames dc_users

#.46 Row Cache Lock - ASHselect ash.session_id sid, ash.session_id sid, ash.blocking_session bsid, ash.blocking_session bsid, nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, o.object_type otype, o.object_type otype, CURRENT_FILE# filen, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, CURRENT_BLOCK# blockn, ash.SQL_ID, ash.SQL_ID, nvl(rc.name,to_char(ash.p3)) row_cache nvl(rc.name,to_char(ash.p3)) row_cache from v$active_session_history ash, ( select cache#, parameter name from v$rowcache ) rc, ( select cache#, parameter name from v$rowcache ) rc, all_objects o all_objects o where event='row cache lock' and rc.cache#(+)=ash.p1 and rc.cache#(+)=ash.p1 and o.object_id (+)= ash.CURRENT_OBJ# and o.object_id (+)= ash.CURRENT_OBJ# and ash.session_state='WAITING' and ash.session_state='WAITING' and ash.sample_time > sysdate - &minutes/(60*24) and ash.sample_time > sysdate - &minutes/(60*24) Order by sample_time SID BSID OBJ OTYPE FILEN BLOCKN SQL_ID ROW_CACHE y8w0sfqb61m dc_sequences dc_sequences dc_sequences dc_sequences dc_sequences dc_sequences

#.47 Copyright 2006 Kyle Hailey Row Cache Lock  Select seq.next_val  Sequence cache set to 1  Default sequence cache is 20 Enter value for 1: 41y8w0sfqb61m SQL_FULLTEXT SELECT TOTO_SEQ.NEXTVAL FROM DUAL

#.48 Copyright 2006 Kyle Hailey Shared Pool Waits  Parsing issues  Shared Pool Latch  Library Cache Pin  Compilation problems  Library Cache Lock  Library Cache Load Lock  Row Cache Lock  Depends on the cache

#.49 Copyright 2006 Kyle Hailey Summary  Shared Pool Latch  Shard pool too small or too much hard parsing  Loading Same Cursor  Library Cache Pin  Library Cache Lock  Library Cache Load Lock  Row Cache Lock  Depends on the cache

#.50 Copyright 2006 Kyle Hailey Library Cache Latch Solutions  Share Cursors  Use bind variables  User cursor_sharing=force  Avoid invalidations and reloads  Size shared_pool large enough  Avoid changing dependent objects  Soft Parsing  Session_cached_cursors =20 : keep across open/close  Cursor_space_for_time=true : keep pinned across executes  hold_cursor=true : used in precompilers