Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 © 2006 Julian Dyke Inside RAC Julian Dyke Independent Consultant Web Version juliandyke.com.

Similar presentations


Presentation on theme: "1 © 2006 Julian Dyke Inside RAC Julian Dyke Independent Consultant Web Version juliandyke.com."— Presentation transcript:

1 1 © 2006 Julian Dyke Inside RAC Julian Dyke Independent Consultant Web Version juliandyke.com

2 © 2006 Julian Dyke juliandyke.com 2 Agenda  Introduction to RAC  Memory Structures  The Buffer Cache  Global Cache Services  The Library Cache  Global Enqueue Services

3 © 2006 Julian Dyke juliandyke.com 3 Introduction to RAC

4 © 2006 Julian Dyke juliandyke.com 4 What is RAC?  Multiple instances running on separate servers (nodes)  Single database on shared storage accessible to all nodes  Instances exchange information over an interconnect network Node 1 Instance 1 Node 2 Instance 2 Interconnect Shared Storage Local Disk

5 © 2006 Julian Dyke juliandyke.com 5 Architecture Instance 1 Node 1 Instance 2 Node 2 Shared Storage Storage Network Private Network (Interconnect) Public Network

6 © 2006 Julian Dyke juliandyke.com 6 Some Definitions  Resource  Object to which access must be controlled at instance level  Enqueue  Memory structure that serializes access to a resource  Global Resources  Object to which access must be controlled at cluster level  Global Enqueue  Locks and enqueues which need to be consistent between all instances

7 © 2006 Julian Dyke juliandyke.com 7 Some Definitions...  Global Resource Directory (GRD)  Records current state and owner of each resource  Contains convert and write queues  Distributed across all instances in cluster  Maintained by GCS and GES  Global Cache Services (GCS)  Implements cache coherency for database  Coordinates access to database blocks for instances  Global Enqueue Services (GES)  Controls access to other resources (locks) including library cache and dictionary cache  Performs deadlock detection

8 © 2006 Julian Dyke juliandyke.com 8 Instance 2Instance 1 Background Processes DIAGLMONLCKLMDLMSLGWRSMONPMONCKPTARCHDIAGLMONLCKLMDLMSCKPTARCHLGWRPMONDBWRSMONDBWR Redo Logs Datafiles Controlfiles Redo Logs SGAUGASGAUGA

9 © 2006 Julian Dyke juliandyke.com 9 Background Processes  LMSn  Global Cache Service Process  Manage requests for data access across cluster  Up to 20 in Oracle 10.1  LMS0-LMS9 LMSa-LMSj  Up to 36 in Oracle 10.2  LMS0-LMS9 LMSa-LMSz  In Oracle 10.1 and above, number of GCS server processes can be configured using gcs_server_processes parameter  Default value is 1 (single CPU system)

10 © 2006 Julian Dyke juliandyke.com 10 Background Processes  LCK0  Instance Enqueue Process  Manages  instance resource requests  cross-instance call operations  Assists LMS processes  Formerly known as lock process  In 9.0.1 and below, number of lock processes may be configurable using _gc_lck_procs parameter

11 © 2006 Julian Dyke juliandyke.com 11 Background Processes  LMD0  Global Enqueue Service Daemon  Manages requests for global enqueues  Updates status of enqueues when granted to / revoked from an instance  One LMD0 process per instance  In 8.1.7 and below number of lock daemons may be configurable using _lm_dlmd_processes parameter

12 © 2006 Julian Dyke juliandyke.com 12 Background Processes  LMON  Global Enqueue Service Monitor  One LMON process per instance  Monitors cluster to maintain global enqueues and resources  Manages  instance and process expirations  recovery processing for cluster enqueues

13 © 2006 Julian Dyke juliandyke.com 13 Background Processes  DIAG - Diagnosibility Process  Collects diagnostic data in the event of a failure  Creates subdirectories in BACKGROUND_DUMP_DEST directory  In Oracle 9.0.1 and above can be disabled using _diag_daemon parameter  Do not try this on a production system

14 © 2006 Julian Dyke juliandyke.com 14 Fixed Tables  Memory structures externalized in X$ tables  Instance specific  Underlying structures for dynamic performance views  Can contain  Structures accessed directly from executable  X$KSLLD => V$LATCHNAME  X$KSUSD => V$STATNAME  Structures accessed directly from SGA  X$KSUSE => V$SESSION  X$KSUPR => V$PROCESS  Executable and/or SGA structures joined in PGA  X$KQLFXPL => V$SQL_PLAN  X$KGLOB => V$SQL, V$SQL_AREA

15 © 2006 Julian Dyke juliandyke.com 15 Dynamic Performance Views  In a RAC environment each V$ view has an equivalent GV$ view  GV$ view includes INST_ID column. For example  V$SGA NAMEVARCHAR2(20) VALUENUMBER  GV$SGA INST_IDNUMBER NAMEVARCHAR2(20) VALUENUMBER  In Oracle 9.2 and below PARALLEL_MIN_SERVERS must be >= number of hosts to use GV$ views  In Oracle 10.1 and above PZnn background processes are used to return data on remote hosts e.g. PZ99

16 © 2006 Julian Dyke juliandyke.com 16 CATCLUST.SQL  Some additional views/synonyms are created for RAC databases using $ORACLE_HOME/rdbms/admin/catclust.sql Synonym NameView Name V$GES_CONVERT_LOCALV$DLM_CONVERT_LOCAL V$GES_CONVERT_REMOTEV$DLM_CONVERT_REMOTE V$GES_LATCHV$DLM_LATCH V$GES_RESOURCEV$DLM_RESS V$GES_STATISTICSV$DLM_MISC V$GES_TRAFFIC_CONTROLLERV$DLM_TRAFFIC_CONTROLLER GV$GES_CONVERT_LOCALGV$DLM_CONVERT_LOCAL GV$GES_CONVERT_REMOTEGV$DLM_CONVERT_REMOTE GV$GES_LATCHGV$DLM_LATCH GV$GES_RESOURCEGV$DLM_RESS GV$GES_STATISTICSGV$DLM_MISC GV$GES_TRAFFIC_CONTROLLERGV$DLM_TRAFFIC_CONTROLLER

17 © 2006 Julian Dyke juliandyke.com 17 ORADEBUG  ORADEBUG includes LKDEBUG  Must be run by user with SYSDBA privilege SQL> ORADEBUG LKDEBUG HELP Usage:lkdebug [options] -l [r|p] Enqueue Object -r Resource Object -b GCS shadow Object -p client pid -P Process Object -O Oracle Format resname -a all pointer -A all contexts -a [ ] all pointers by an optional type -a convlock all converting enqueue (pointers) -A convlock all converting enqueue contexts -a convres all res ptr with converting enqueues -A convres all res contexts with converting enqueues

18 © 2006 Julian Dyke juliandyke.com 18 ORADEBUG  Continued... -a name list all resource names -a hashcount list all resource hash bucket counts -t Traffic controller info -s summary of all enqueue types -k GES SGA summary info -m pkey request for remastering this object at current instance -m dpkey request for dissolving remastering of this object at current instance

19 © 2006 Julian Dyke juliandyke.com 19 Memory Structures

20 © 2006 Julian Dyke juliandyke.com 20 Memory Areas  An Oracle process includes the following memory areas  Executable  SGA  Shared Libraries  PGA/Session Heap  Stack 40000000 20000000 Executable PGA Session Heap Shared Libraries SGA Stack STOP FFFFFFFF 00000000

21 © 2006 Julian Dyke juliandyke.com 21 Shared Memory  Shared memory areas can be dumped to trace file using ORADEBUG SETMYPID ORADEBUG IPC $ sqlplus /nolog SQL> CONNECT SYS/ AS SYSDBA Connected SQL> ORADEBUG SETMYPID Statement processed SQL> ORADEBUG IPC Information written to trace file

22 © 2006 Julian Dyke juliandyke.com 22 Area #0 `Fixed Size' containing Subareas 0-0 Total size 0000000000129968 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 0 0 65537 0x00000020000000 0x00000020000000 Subarea size Segment size 000000000012a000 0000000010800000 Area #1 `Variable Size' containing Subareas 2-2 Total size 0000000010000000 Minimum Subarea size 00400000 Area Subarea Shmid Stable Addr Actual Addr 1 2 65537 0x00000020400000 0x00000020400000 Subarea size Segment size 0000000010000000 0000000010800000 Area #2 `Redo Buffers' containing Subareas 1-1 Total size 00000000002d6000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Add 2 1 65537 0x0000002012a000 0x0000002012a000 Subarea size Segment size 00000000002d6000 0000000010800000 Area #3 `skgm overhead' containing Subareas 3-3 Total size 0000000000001000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 3 3 65537 0x00000030400000 0x00000030400000 Subarea size Segment size 0000000000001000 0000000010800000 ORADEBUG IPC - Example STOP Area #0 `Fixed Size' containing Subareas 0-0 Total size 0000000000129968 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 0 0 65537 0x00000020000000 0x00000020000000 Subarea size Segment size 000000000012a000 0000000010800000 Area #1 `Variable Size' containing Subareas 2-2 Total size 0000000010000000 Minimum Subarea size 00400000 Area Subarea Shmid Stable Addr Actual Addr 1 2 65537 0x00000020400000 0x00000020400000 Subarea size Segment size 0000000010000000 0000000010800000 Area #2 `Redo Buffers' containing Subareas 1-1 Total size 00000000002d6000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Add 2 1 65537 0x0000002012a000 0x0000002012a000 Subarea size Segment size 00000000002d6000 0000000010800000 Area #3 `skgm overhead' containing Subareas 3-3 Total size 0000000000001000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 3 3 65537 0x00000030400000 0x00000030400000 Subarea size Segment size 0000000000001000 0000000010800000 Fixed Area Variable Area Redo Buffers OS Specific

23 © 2006 Julian Dyke juliandyke.com 23 Shared Global Area  Contains  Fixed SGA  Buffer Pool  Shared Pool Oracle 7.0 and above  Large Pool Oracle 8.0 and above  Java Pool Oracle 8.1.5 and above  Streams Pool Oracle 10.1 and above  Redo buffers  Buffer Pool includes  Default cache  Keep and Recycle cacheOracle 8.0 and above  2K, 4K, 8K, 16K and 32K cacheOracle 9.0.1 and above

24 © 2006 Julian Dyke juliandyke.com 24 V$SGAINFO  Summarizes SGA pools NAMEVARCHAR2(32) BYTESNUMBER RESIZEABLEVARCHAR2(3) SELECT * FROM v$sgainfo; NAME BYTES RESIZEABLE -------------------------------- ---------- ---------- Fixed SGA Size 1218920 No Redo Buffers 2973696 No Buffer Cache Size 176160768 Yes Shared Pool Size 83886080 Yes Large Pool Size 4194304 Yes Java Pool Size 4194304 Yes Streams Pool Size 0 Yes Granule Size 4194304 No Maximum SGA Size 272629760 No Startup overhead in Shared Pool 46137344 No Free SGA Memory Available 0

25 © 2006 Julian Dyke juliandyke.com 25 Granules  Introduced in Oracle 9.0.1  SGA divided into granules  In Oracle 9.2 Unix granule size dependent on SGA_MAX_SIZE  4 mb SGA_MAX_SIZE <= 128 mb  16 mbSGA_MAX_SIZE > 128 mb  If SGA_MAX_SIZE not set explicitly then defaults to sum of individual pool parameters  SGA_MAX_SIZE cannot be dynamically modified

26 © 2006 Julian Dyke juliandyke.com 26 Granules  In Oracle 10.1 and above  SGA_MAX_SIZE dependent on SGA_TARGET  Granule size dependent on SGA_MAX_SIZE  4 mb SGA_MAX_SIZE <= 256 mb??  16 mbSGA_MAX_SIZE > 256 mb ??  Granule size can be controlled using _ksmg_granule_size unsupported parameter

27 © 2006 Julian Dyke juliandyke.com 27 X$KSMGE  Introduced in Oracle 9.2  Describes individual granules ADDRRAW(4) INDXNUMBER INST_IDNUMBER GRANNUMNUMBER GRANTYPENUMBER GRANSTATEVARCHAR2(16) GRANFLAGSNUMBER LOCALITYNUMBER KSMAREANUMNUMBER BASEADDRRAW(4) GRANSIZENUMBER GRANNEXTNUMBER GRANPREVNUMBER INVALID (Free) ALLOCATED Granule Address Granule Size Next granule ID Previous granule ID Granule ID 0Free 1Shared Pool 2Large Pool 3Java Pool 6Buffer Pool

28 © 2006 Julian Dyke juliandyke.com 28 Granules SGA_TARGET = 260M SGA_MAX_SIZE = 260M GRANULE SIZE = 4M 256M 4M Buffer Pool 172M Fixed SGA + Redo Buffers 4M Large Pool 4M Shared Pool 76M Java Pool 4M STOP This is an example of an SGA mapped using X$KSMGE

29 © 2006 Julian Dyke juliandyke.com 29 V$SGASTAT  Enhanced in Oracle 10.1 and above Shared Pool682 Large Pool6 Java Pool4 Streams Pool4  In Oracle 10.2 describes around 700 memory areas POOLVARCHAR2(12) NAMEVARCHAR2(26) BYTESNUMBER

30 © 2006 Julian Dyke juliandyke.com 30 V$SGASTAT  RAC-specific areas include gcs affinity gcs close obj gcs commit sga state gcs I/O statistics struct gcs mastership buckets gcs opaque in gcs res hash bucket gcs res latch table gcs resource freelist arr gcs resource freelist dyn gcs resources gcs scan queue array gcs shadow locks dyn seg gcs shadow locks freelist gcs shadows ges big msg buffers ges deadlock xid freelist ges deadlock xid hash tab ges enqueue cur. usage pe ges enqueue max. usage pe ges enqueue multiple free ges enqueues ges ipc instance maps ges lmd process descripto ges lms process descripto ges process array ges process hash table ges recovery domain table ges regular msg buffers ges reserved msg buffers ges res mastership bucket ges resource ges resource hash seq tab ges resource hash table ges resource pools ges scan queue array ges shared global area KCL buffer header KCL instance cache transf KCL lock contexts KCL lock state KCL name table KCL partition table KCL region array KJXM msg statistics table

31 © 2006 Julian Dyke juliandyke.com 31 V$SGASTAT  Significant RAC areas in Oracle 10.2 NameSize(bytes)Location gcs resources2298008Segmented Array gcs shadows1632280Segmented Array ges resource1257188Heap ges enqueues1625344Segmented Array ges big msg buffers3979396Unknown  In Oracle 9.2 all five structures were stored in segmented arrays

32 © 2006 Julian Dyke juliandyke.com 32 Permanent Areas SELECT ksmchptr, ksmchsiz FROM x$ksmsp WHERE ksmchcls = 'perm'; AddressSize 2D0340003981312 2D4340003549424 2D8340003963236 2DC340003980584 2DFFFD28 728 2E0340003919532  Allocated at instance startup  Contain structures such as  processes  sessions  segmented arrays STOP 2AC00000 2B800000 2BC00000 2C000000 2C400000 2C800000 2CC00000 2D000000 2D800000 2DC00000 2E000000 2E400000 2E800000 2EF00000 2F000000 2F400000 2F800000 2FC00000 30000000 2D400000 Permanent Area Heap

33 © 2006 Julian Dyke juliandyke.com 33 X$KSMSP  Externalises chunks in the shared pool ADDRRAW(4) INDXNUMBER INST_IDNUMBER KSMCHIDXNUMBER KSMCHDURNUMBER KSMCHCOMVARCHAR2(16) KSMCHPTRRAW(4) KSMCHSIZNUMBER KSMCHCLSVARCHAR2(8) KSMCHTYPNUMBER KSMCHPARRAW(4) Description of chunk type Address of chunk Size including header Class ●Perm ●Recreate ●Freeable ●Free ●R-Free ●R-Freeable Address of parent Type (recreate only) ●0x18 - KGL Handle ●0x24 - Fixed Allocation ●0x74 - KQR PO ●0x80 - KQR SO ●0xFFF - Extended header

34 © 2006 Julian Dyke juliandyke.com 34 X$KSMSP  Some RAC components are stored in the shared pool heap SELECT ksmchcom, SUM(ksmchsiz), COUNT(*) FROM x$ksmsp GROUP BY ksmchcom; gcs_mastership46201 gcs_res_hash_bu163961 gcs_res_latch_t76921 ges_res_masters30841 ges_resource619276164

35 © 2006 Julian Dyke juliandyke.com 35 Segmented Arrays  Used to store arrays of objects  Array too large to fit in granule  Array may grow dynamically  Objects using segmented arrays include  enqueues (locks)  enqueue resources (resources)  transactions  transaction branches  Segmented arrays managed recursively by segmented array  Segmented arrays externalised in X$KSMDD

36 © 2006 Julian Dyke juliandyke.com 36 Segmented Arrays Call Enqueues Enqueue Resources Segmented Array Header Segmented Array Segmented Array Header Segmented Array STOP

37 © 2006 Julian Dyke juliandyke.com 37 X$KSMDD  Externalises segmented array headers ADDRRAW(4) INDXNUMBER INST_IDNUMBER NAMEVARCHAR2(30) ELEMENTS_CHUNKNUMBER ITEMS_PTNUMBER INITENTRIESNUMBER NUMENTRIESNUMBER CURENTRIESNUMBER NUMCHUNKSNUMBER ELEMSIZENUMBER FLAGSNUMBER HEAPRAW(4) SECONDARYRAW(4) Name of array Address of parent heap Number of chunks

38 © 2006 Julian Dyke juliandyke.com 38 Segmented Arrays  In Oracle 10.2 there are three RAC-specific segmented arrays:  GCS Resources  GCS Shadows  GES Enqueues  In previous releases there were five segmented arrays:  GCS Resources  GCS Shadows  GES Resources  GES Shadows  GES Messages

39 © 2006 Julian Dyke juliandyke.com 39 Heaps  A heap consists of one or more extents  Each heap extent occupies a single granule  Each extent contains one or more chunks  Each heap has a header containing  list of used chunks  list of free chunks Extent 0 Extent 1 Extent 2 Heap Header Free List Chunks STOP

40 © 2006 Julian Dyke juliandyke.com 40 X$KSMHP  Externalises chunks in the heap ADDRRAW(4) INDXNUMBER INST_IDNUMBER KSMCHDSRAW(4) KSMCHCOMVARCHAR2(16) KSMCHPTRRAW(4) KSMCHSIZNUMBER KSMCHCLSVARCHAR2(8) KSMCHTYPNUMBER KSMCHPARRAW(4) KSMCHOWNRAW(4)  Can only be accessed using KSMCHDS e.g. SELECT * FROM x$ksmhp WHERE ksmchds = HEXTORAW ('2CA54040');

41 © 2006 Julian Dyke juliandyke.com 41 The Buffer Cache

42 © 2006 Julian Dyke juliandyke.com 42 Buffer Headers  Each buffer has a buffer header  Buffer headers are stored in same granule as buffers  Buffer headers include  Replacement list  Hash list  Pointer to buffer  In RAC only pointer to Lock Element Buffer Headers Granule Buffers STOP

43 © 2006 Julian Dyke juliandyke.com 43 X$BH ADDRRAW(4) INDXNUMBER INST_IDNUMBER HLADDRRAW(4) BLSIZNUMBER NXT_HASHRAW(4) PRV_HASHRAW(4) NXT_REPLRAW(4) PRV_REPLRAW(4) FLAGNUMBER RFLAGNUMBER SFLAGNUMBER LRU_FLAGNUMBER TS#NUMBER FILE#NUMBER DBARFILNUMBER DBABLKNUMBER CLASSNUMBER STATENUMBER MODE_HELDNUMBER CHANGESNUMBER CSTATENUMBER LE_ADDRRAW(4) DIRTY_QUEUENUMBER SET_DSRAW(4) OBJNUMBER BARAW(4) CR_SCN_BASNUMBER CR_SCN_WRPNUMBER CR_XID_USNNUMBER CR_XID_SLTNUMBER CR_XID_SQNNUMBER CR_UBA_FILNUMBER CR_UBA_BLKNUMBER CR_UBA_SEQNUMBER CR_UBA_RECNUMBER CR_SFLNUMBER CR_CLS_BASNUMBER CR_CLS_WRPNUMBER LRBA_SEQNUMBER LRBA_BNONUMBER HSCN_BASNUMBER HSCN_WRPNUMBER HSUB_SCNNUMBER US_NXTRAW(4) US_PRVRAW(4) WA_NXTRAW(4) WA_PRVRAW(4) TCHNUMBER TIMNUMBER

44 © 2006 Julian Dyke juliandyke.com 44 Head of Cold End Head of Hot End Single-Block Reads 92 0 34 3 72 4 52 1 71 2 66 0 49 0 42 1 45 2 52 1 71 2 66 0 42 1 11 1 52 1 71 2 11 1 42 1 2 71 0 92 0 34 3 72 4 45 2 11 1 52 1 42 2 33 1 45 2 11 1 42 2 33 1 34 4 92 0 34 4 72 4 45 2 11 1 42 0 33 1 71 0 87 1 1 72 4 33 1 45 2 Read Block 42 Get first available buffer from cold end Update buffer contentsInsert buffer at head of cold end Read Block 11 Get first available buffer from cold end Update buffer contentsInsert buffer at head of cold end Read Block 42 Update touch count for block 42 Read Block 33 Move block 71 to head of hot end Set touch count on block 71 to zero Get first available buffer from cold end Update buffer contentsInsert buffer at head of cold end Read Block 34 Update touch count for block 34 Read Block 87 Move block 42 to head of hot end Set touch count on block 42 to zero Get first available buffer from cold end Update buffer contentsInsert buffer at head of cold end STOP Block Number Touch Count

45 © 2006 Julian Dyke juliandyke.com 45 Multi-Block Reads Head of Cold End Head of Hot End Read Block 1 Get first four available buffers from cold end Read next four blocks into buffers 1234 Insert buffers at head of cold end 12 1 3214321 Move block 1 to cold end 121 Read Block 2 Move block 2 to cold end 2132134 Read Block 3 Move block 3 to cold end Read Block 4 Move block 4 to cold end Read Block 5 Get next four available buffers from cold end Read next four blocks into buffers Insert buffers at head of cold end Move block 5 to cold end 4321555676765878556565675678 Read Block 6 Move block 6 to cold end Read Block 7 Move block 7 to cold end Read Block 8 Move block 8 to cold end STOP DB_FILE_MULTIBLOCK_READ_COUNT = 4

46 © 2006 Julian Dyke juliandyke.com 46 Global Cache Services

47 © 2006 Julian Dyke juliandyke.com 47 Read with No Transfer Instance 1 Instance 2 Instance 4 1318 Request shared resource Instance 3 Resource Master Instance 2 requests current read on block Request granted SN Read request Block returned 1318 1 2 3 4 STOP

48 © 2006 Julian Dyke juliandyke.com 48 Read to Write Transfer Instance 1 Instance 2 Instance 4 1318 Request exclusive resource Instance 3 Resource Master Instance 1 requests exclusive read on block Transfer block to Instance 1 for exclusive access SN Block and resource status Resource status 1318 1 2 3 4 N N X 1320 STOP

49 © 2006 Julian Dyke juliandyke.com 49 Write to Write Transfer Instance 1 Instance 2 Instance 4 1318 Request block in exclusive mode Instance 3 Resource Master Instance 4 requests exclusive read on block Transfer block to Instance 4 in exclusive mode SN Block and resource status Resource status 1318 1 2 3 4 NNX 1320 N N X 1323 STOP Note that Instance 1 will create a past image (PI) of the dirty block

50 © 2006 Julian Dyke juliandyke.com 50 Past Images  When an instance passes a dirty block to another instance it  Flushes redo buffer to redo log  Retains past image (PI) of block in buffer cache  PI is retained until another instance writes block to disk  Used to reduce recovery times  Recorded in V$BH.STATUS as PI  Based on X$BH.STATE (value 8 in Oracle 10.2)

51 © 2006 Julian Dyke juliandyke.com 51 Past Images 1328 1329 UPDATE t1 SET c1 = 1324; COMMIT; UPDATE t1 SET c1 = 1329; COMMIT; 1323 Instance 1 1323 1324 1325 1326 1327 Buffer Cache 13241323 132513241326132513271326 1328 1327 Redo Log 1 Instance 2 Buffer Cache 13291328 UPDATE t1 SET c1 = 1325; COMMIT; UPDATE t1 SET c1 = 1326; COMMIT; UPDATE t1 SET c1 = 1327; COMMIT; UPDATE t1 SET c1 = 1328; COMMIT; 1328 1323 Redo Log 2 1323 1328 1329 Assume table t1 contains a single row in block 42 Instance 1 updates column to 1324 Block 42 is read from disk Undo/Redo written to Redo Log 1 Block 42 is updated in buffer cache Instance 1 updates column to 1325 Undo/Redo written to Redo Log 1 Block 42 is updated in buffer cache Instance 1 updates column to 1326 Undo/Redo written to Redo Log 1 Block 42 is updated in buffer cache Instance 1 updates column to 1327 Undo/Redo written to Redo Log 1 Block 42 is updated in buffer cache Instance 1 updates column to 1328 Undo/Redo written to Redo Log 1 Block 42 is updated in buffer cache Instance 2 updates column to 1329 GCS transfers block from Instance 1 to Instance 2 Instance 1 makes block 42 a Past Image block Undo/redo written to Redo Log 2 Block 42 is updated in buffer cache Instance 2 Crashes Contents of buffer cache are lost DBWR has not written changes to block 42 back to disk yet Instance 1 must perform recovery for Instance 2 Block 42 needs recovery Instance 1 uses Past Image Undo/redo is applied from Redo Log 2 Block 42 is subsequently written back to disk by DBWR STOP

52 © 2006 Julian Dyke juliandyke.com 52 Write to Read Transfer Instance 1 Instance 2 Instance 4 1318 Request block in shared mode Instance 3 Resource Master Instance 2 requests current read on block SN Block and resource status Resource status 1318 1 3 4 NNX 1320 N N X 1323 Transfer block to Instance 1 in shared mode 2 S S STOP Note that in recent versions _fairness_threshold is used to avoid unnecessary lock conversions

53 © 2006 Julian Dyke juliandyke.com 53 Fairness Threshold  Intended to prevent unnecessary lock downgrades when other instances only require read-only copies  For write to read transfers  Writing instance retains X lock  Reading instance retains null lock  If _fairness_threshold reached then  Writing instance downgrades X lock to S lock  Reading instance receives S lock  _fairness_threshold default value is 4

54 © 2006 Julian Dyke juliandyke.com 54 Fairness Threshold Assume instance 1 holds exclusive lock on block Instance 2 Instance 2 requests consistent read Instance 1 sets counter to 1 Instance 1 sends block to Instance 2 1323 Instance 1 X Instance 2 receives block with Null lock 1323 01 234N Instance 2 requests consistent read Instance 1 sets counter to 2 Instance 1 sends block to Instance 2 Instance 2 receives block with Null lock 1323 Instance 2 requests consistent read Instance 1 sets counter to 3 Instance 1 sends block to instance 2 Instance 2 receives block with Null lock Instance 2 requests consistent read Instance 1 sets counter to 4 Instance 1 downgrades lock from X to S S Instance 1 sends block to Instance 2 Instance 2 receives block with Shared lock S _fairness_threshold = 4 STOP

55 © 2006 Julian Dyke juliandyke.com 55 Lock Elements  Contain embedded GCS Client structures (KJBL) Lock Element GCS Client Buffer Header Lock Element GCS Client Buffer Header Lock Element GCS Client

56 © 2006 Julian Dyke juliandyke.com 56 V$LOCK_ELEMENT  Based on X$LE LOCK_ELEMENT_ADDRRAW(4) INDXNUMBER CLASSNUMBER LOCK_ELEMENT_NAMENUMBER MODE_HELDNUMBER BLOCK_COUNTNUMBER RELEASINGNUMBER ACQUIRINGNUMBER INVALIDNUMBER FLAGSNUMBER

57 © 2006 Julian Dyke juliandyke.com 57 X$LE ADDRRAW(4) INDXNUMBER INST_IDNUMBER LE_ADDRRAW(4) NAMENUMBER LE_CLASSNUMBER LE_RLSNUMBER LE_ACQNUMBER LE_FLAGSNUMBER LE_MODENUMBER LE_WRITENUMBER LE_LOCALNUMBER LE_RECOVERYNUMBER LE_BLKSNUMBER LE_TIMENUMBER LE_KJBLRAW(4) Buffer Header Lock Element GCS Client STOP

58 © 2006 Julian Dyke juliandyke.com 58 Global Cache Services KJBR KJBLBH LE KJBL LE KJBL GCS Client GCS Shadow

59 © 2006 Julian Dyke juliandyke.com 59 GCS Parameters  GCS Resources  Number of GCS resource structures determined by  _gcs_resources parameter  Stored in segmented array  Externalized in X$KJBR  Number of free GCS resource structures in X$KJBRFX  GCS Enqueues (Shadows/Clients)  Number of GCS enqueue structures determined by  _gcs_shadow_locks parameter  Stored in segmented array  Externalized in X$KJBL  Number of free GCS enqueue structures in X$KJBLFX

60 © 2006 Julian Dyke juliandyke.com 60 X$KJBR  Externalizes GCS Resources ADDRRAW(4) INDXNUMBER INST_IDNUMBER KJBRRESPRAW(4) KJBRGRANTVARCHAR2(9) KJBRNCVLVARCHAR2(9) KJBRROLENUMBER KJBRNAMEVARCHAR2(30) KJBRMASTERNUMBER KJBRGRANTQRAW(4) KJBRCVTQRAW(4) KJBRWRITERRAW(4)

61 © 2006 Julian Dyke juliandyke.com 61 X$KJBL  Externalizes GCS Enqueues ADDRRAW(4) INDXNUMBER INST_IDNUMBER KJBLLOCKPRAW(4) KJBLGRANTVARCHAR2(9) KJBLREQUESTVARCHAR2(9) KJBLROLENUMBER KJBLRESPRAW(4) KJBLNAMEVARCHAR2(30) KJBLNAME2VARCHAR2(30) KJBLQUEUENUMBER KJBLLOCKSTVARCHAR2(64) KJBLWRITINGNUMBER KJBLREQWRITENUMBER KJBLMASTERNUMBER KJBLBLOCKEDNUMBER KJBLBLOCKERNUMBER

62 © 2006 Julian Dyke juliandyke.com 62 Global Cache Dumps  To dump the contents of the global cache use: ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME GC_ELEMENTS LEVEL 1'; GLOBAL CACHE ELEMENT DUMP (address: 0x21fecd18): id1: 0x3591 id2: 0x10000 obj: 181 block: (1/13713) lock: SL rls: 0x0000 acq: 0x0000 latch: 0 flags: 0x41 fair: 0 recovery: 0 fpin: 'kdswh05: kdsgrp' bscn: 0x0.18a9c bctx: (nil) write: 0 scan: 0x0 xflg: 0 xid: 0x0.0.0 GCS CLIENT 0x21fecd60,1 sq[(nil),(nil)] resp[(nil),0x3591.10000] pkey 181 grant 1 cvt 0 mdrole 0x21 st 0x20 GRANTQ rl LOCAL master 1 owner 0 sid 0 remote[(nil),0] hist 0x7c history 0x3c.0x1.0x0.0x0.0x0.0x0. cflag 0x0 sender 2 flags 0x0 replay# 0 disk: 0x0000.00000000 write request: 0x0000.00000000 pi scn: 0x0000.00000000 msgseq 0x1 updseq 0x0 reqids[1,0,0] infop 0x0 pkey 181 hv 107 [stat 0x0, 1->1, wm 32767, RMno 0, reminc 6, dom 0] kjga st 0x4, step 0.0.0, cinc 8, rmno 10, flags 0x0 lb 0, hb 0, myb 178, drmb 178, apifrz 0

63 © 2006 Julian Dyke juliandyke.com 63 Global Cache Dumps  Continued GLOBAL CACHE ELEMENT DUMP (address: 0x237f4358): id1: 0x6a39 id2: 0x10000 obj: 74 block: (1/27193) lock: SL rls: 0x0000 acq: 0x0000 latch: 0 flags: 0x41 fair: 0 recovery: 0 fpin: 'kdswh05: kdsgrp' bscn: 0x0.26992 bctx: (nil) write: 0 scan: 0x0 xflg: 0 xid: 0x0.0.0 GCS SHADOW 0x237f43a0,1 sq[0x2ee64e8c,0x2eff3858] resp[0x2ee64e74,0x6a39.10000] pkey 74 grant 1 cvt 0 mdrole 0x21 st 0x40 GRANTQ rl LOCAL master 0 owner 0 sid 0 remote[(nil),0] hist 0x12a5..... GCS RESOURCE 0x2ee64e74 hashq [0x2ee61894,0x2ff57390] name[0x6a39.10000] pkey 74 grant 0x2eff3858 cvt (nil) send (nil),0 write (nil),0@65535 flag 0x0 mdrole 0x1 mode 1 scan 0 role LOCAL..... GCS SHADOW 0x2eff3858,1 sq[0x237f43a0,0x2ee64e8c] resp[0x2ee64e74,0x6a39.10000] pkey 74 grant 1 cvt 0 mdrole 0x21 st 0x40 GRANTQ rl LOCAL master 0 owner 1 sid 0 remote[0x23fea160,1] hist 0x65f..... GCS SHADOW 0x237f43a0,1 sq[0x2ee64e8c,0x2eff3858] resp[0x2ee64e74,0x6a39.10000] pkey 74 grant 1 cvt 0 mdrole 0x21 st 0x40 GRANTQ rl LOCAL master 0 owner 0 sid 0 remote[(nil),0] hist 0x12a5.....

64 © 2006 Julian Dyke juliandyke.com 64 Block Mastering  Each block is mastered on one instance  Block DBA is reported by X$KJBR.KJBRNAME  Names for have the format:  [ ][ ],[BL]  Ordering by X$KJBR.KJBRNAME is difficult because the resource names do not collate e.g.  [0x900][0x70000],[BL]  [0x90][0x70000],[BL]  Current master reported by X$KJBR.KJBRMASTER

65 © 2006 Julian Dyke juliandyke.com 65 Block Mastering  In Oracle 10.2 block mastering is determined by  _lm_contiguous_res_count  Specifies number of contiguous blocks that will hash to the same HV bucket  Defaults to 128  For example StartEnd 0x0800x0FF 0x1800x1FF 0x2800x2FF 0x3800x3FF 0x4800x4FF 0x5800x5FF etc StartEnd 0x0000x07F 0x1000x17F 0x2000x27F 0x3000x37F 0x4000x47F 0x5000x57F etc Instance 0 Instance 1

66 © 2006 Julian Dyke juliandyke.com 66 Block Mastering  In Oracle 9.2 (and probably 10.1) block mastering determined by hash function  Algorithm applied to groups of 1289 contiguous blocks  In two node cluster  instance 0 has 645 blocks  instance 1 has 644 blocks  In three node cluster  instance 0 has 430 blocks  instance 2 has 215 blocks  instance 1 has 430 blocks  instance 2 has 214 blocks  Beware of small hot tables and indexes....

67 © 2006 Julian Dyke juliandyke.com 67 Dynamic Remastering  In Oracle 9.2  documentation describes dynamic remastering  not implemented in code  In Oracle 10.1  work at data file level  very high threshold so difficult to test  does occur on some customer sites  may cause LMON process to crash in 10.1.0.4  bug 3659289 - patch available  fixed in 10.1.0.5/10.2.0.1  In Oracle 10.2  works at object level  thresholds are relatively low

68 © 2006 Julian Dyke juliandyke.com 68 Dynamic Remastering  Example SELECT data_object_id FROM dba_objects WHERE owner = 'US01'AND object_name = 'T1'; OBJECT_ID --------- 52084 ORADEBUG LKDEBUG -m pkey 52084  To remaster object at current instance use:  All blocks now mastered by the current instance  To redistribute masters to all available instances use: ORADEBUG LKDEBUG -m dpkey 52084  Blocks mastered by both (all) instances again

69 © 2006 Julian Dyke juliandyke.com 69 V$GCSPFMASTER_INFO  Object re mastering is recorded in V$GCSPFMASTER_INFO FILE_IDNUMBER OBJECT_IDNUMBER CURRENT_MASTERNUMBER PREVIOUS_MASTERNUMBER REMASTER_CNTNUMBER

70 © 2006 Julian Dyke juliandyke.com 70 Dynamic Remastering  Object remastering recorded in V$GCSPFMASTER_INFO  Instances are internally numbered 0, 1 etc  Initially contains no rows  After remastering object 52084 to instance 0 SELECT object_id, current_master, previous_master FROM v$gcspfmaster_info;  After remastering object 52084 to instance 1 Object IDCurrent MasterPrevious Master 52084032767 Object IDCurrent MasterPrevious Master 5208410

71 © 2006 Julian Dyke juliandyke.com 71 Dynamic Remastering  Information about Dynamic Remastering operations is also recorded in the following fixed views  X$KJDRMREQ  Dynamic Remastering Requests  X$KJDRMAFNSTATS  File Remastering Statistics  X$KJDRMHVSTATS  Hash Value Statistics

72 © 2006 Julian Dyke juliandyke.com 72 The Library Cache

73 © 2006 Julian Dyke juliandyke.com 73 Library Cache Object - Parent 16 x 1 word pointers KGLHD Parent Object KGLNA SELECT SUM (c2) FROM t1 WHERE c3 = 42 AND c4 < 2004 Parent Name Child Handle KGLHD Child 1 Child 2 Heap 0 KGLOB X$KGLOB Parent Handle KGLHD STOP

74 © 2006 Julian Dyke juliandyke.com 74 Library Cache Object - Child KGLHD Child Handle Child Object SELECT Statement Heap 6 KGLOB Subheap Header Heap 0 Subquery Header Statistics, Optimizer Environment, BindVariables X$KGLOB STOP

75 © 2006 Julian Dyke juliandyke.com 75 Library Cache  In general  Locks are required for parsing  Externalized in X$KGLLK  Pins are required for execution  Externalized in X$KGLPN  Each KGLHD structure has a set of double linked lists including;  Locks  Pins

76 © 2006 Julian Dyke juliandyke.com 76 X$KGLPN X$KGLLK Library Cache Object - Locks & Pins Child Handle Child Object KGLOB X$KGLOB STOP Lock PinLockPin KGLHD

77 © 2006 Julian Dyke juliandyke.com 77 Namespaces  In Oracle 10.2 there are 64 library cache namespaces  Externalized by KGLHDNSP in X$KGLOB CRSRLOBREIPRMGRJVSDRELSMVOBINXNSCPD TABLDIRCPOBXDBSSTFGRELDSTBOJSLV BODYQUEUEVNTPPLNTRANSIFSDHTSOMODL TRGROBJGSUMMPCLSRELCXDBCJSGAUnused INDXPROPDIMMSUBSRULEUSAGJSETUnused CLSTJVSCCTSLOCSSTRMMVOBTBLTABLEUnused KGLTJVREOUTLRMOBREVCJSQICLSTUnused PIPEROBJRULSRSMDSTAPCDCINDXUnused

78 © 2006 Julian Dyke juliandyke.com 78 Namespaces  Library cache statistics can be dumped using: ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME LIBRARY_CACHE LEVEL 1';  For example: LIBRARY CACHE STATISTICS: namespace gets hit ratio pins hit ratio reloads invalids -------------- --------- --------- --------- --------- ---------- ---------- CRSR 2403 0.086 33698 0.933 435 0 TABL 4368 0.578 10032 0.657 961 0 BODY 127 0.717 211 0.801 4 0 TRGR 4 0.000 45 0.911 0 0 INDX 81 0.272 83 0.036 21 0 CLST 101 0.921 264 0.958 3 0 KGLT 0 0.000 0 0.000 0 0 PIPE 0 0.000 0 0.000 0 0 LOB 0 0.000 0 0.000 0 0 DIR 0 0.000 0 0.000 0 0 QUEU 156 0.904 5886 0.997 0 0....

79 © 2006 Julian Dyke juliandyke.com 79 V$LIBRARYCACHE  Subset of rows from X$KGLST  Contains 11 rows in Oracle 10.2 NAMESPACEVARCHAR2(15) GETSNUMBER GETHITSNUMBER GETHITRATIONUMBER PINSNUMBER PINHITSNUMBER PINHITRATIONUMBER RELOADSNUMBER INVALIDATIONSNUMBER DLM_LOCK_REQUESTSNUMBER DLM_PIN_REQUESTSNUMBER DLM_PIN_RELEASESNUMBER DLM_INVALIDATION_REQUESTSNUMBER DLM_INVALIDATIONSNUMBER RAC Specific Statistics

80 © 2006 Julian Dyke juliandyke.com 80 SELECT inst_id, DECODE (indx, 0,'SQL AREA', 1,'TABLE/PROCEDURE', 2,'BODY', 3,'TRIGGER', 4,'INDEX', 5,'CLUSTER', 6,'OBJECT', 7,'PIPE', 13,'JAVA SOURCE', 14,'JAVA RESOURCE', 32,'JAVA DATA',' ?' ), kglstget,kglstght, DECODE (kglstget,0,1,kglstght/kglstget), kglstpin,kglstpht, DECODE (kglstpin,0,1,kglstpht/kglstpin), kglstrld,kglstinv, kglstlrq,kglstprq,kglstprl,kglstirq,kglstmiv FROM x$kglst WHERE indx<8 OR indx=13 OR indx=14 OR indx=32 V$LIBRARYCACHE  Based on X$KGLST Names are generated in dynamic performance view Only selected rows from X$KGLST

81 © 2006 Julian Dyke juliandyke.com 81 X$KGLST  Contains one row for each namespace (59 rows in 10.2) ADDRRAW(4) INDXNUMBER INST_IDNUMBER KGLSTCMSNUMBER KGLSTCHTNUMBER KGLSTGETNUMBER KGLSTGHTNUMBER KGLSTPINNUMBER KGLSTPHTNUMBER KGLSTRLDNUMBER KGLSTINVNUMBER KGLSTLRQNUMBER KGLSTPRQNUMBER KGLSTPRLNUMBER KGLSTIRQNUMBER KGLSTMIVNUMBER RAC Specific Statistics

82 © 2006 Julian Dyke juliandyke.com 82 Global Enqueue Services

83 © 2006 Julian Dyke juliandyke.com 83 V$LOCK_TYPE  Introduced in Oracle 10.1  Lists all lock types  Wildcards for  Library Cache Locks and Pins  Row Cache Locks TYPEVARCHAR2(64) NAMEVARCHAR2(64) ID1_TAGVARCHAR2(64) ID2_TAGVARCHAR2(64) IS_USERVARCHAR2(3) DESCRIPTIONVARCHAR2(4000)

84 © 2006 Julian Dyke juliandyke.com 84 Library Cache Objects  Library Cache Objects can be dumped using: ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME LIBRARY_CACHE LEVEL 4'; BUCKET 127469: LIBRARY OBJECT HANDLE: handle=2bb8dfbc mutex=0x2bb8e070(0) name=US01.T1 hash=b2f454b86387761e02fc7e686e37f1ed timestamp=01-14-2006 22:04:06 namespace=TABL flags=KGHP/TIM/MED/[40000000] kkkk-dddd-llll=0000-0701-0701 lock=0 pin=0 latch#=1 hpc=0002 hlc=0002 lwt=0x2bb8e018[0x2bb8e018,0x2bb8e018] ltm=0x2bb8e020[0x2bb8e020,0x2bb8e020] pwt=0x2bb8dffc[0x2bb8dffc,0x2bb8dffc] ptm=0x2bb8e004[0x2bb8e004,0x2bb8e004] ref=0x2bb8e038[0x2bb8e038,0x2bb8e038] lnd=0x2bb8e044[0x2bb7a7ac,0x2bb8e410] LOCK INSTANCE LOCK: id=LBb2f454b86387761e PIN INSTANCE LOCK: id=NBb2f454b86387761e mode=S release=F flags=[00 INVALIDATION INSTANCE LOCK: id=IV0000c9890e170507 mode=S LIBRARY OBJECT: object=2caede30 type=TABL flags=EXS/LOC[0005] pflags=[0000] status=VALD load=0 BUCKET 127469 total object count=1  For example:

85 © 2006 Julian Dyke juliandyke.com 85 Library Cache Instance Locks  Instance Locks created for  Library Cache Locks  Library Cache Pins  Lock name based on object hash value (KGLNAHSH)  For example: BUCKET 127469: LIBRARY OBJECT HANDLE: handle=2bb8dfbc mutex=0x2bb8e070(0) name=US01.T1 hash=b2f454b86387761e02fc7e686e37f1ed timestamp=01-14-2006 22:04:06 namespace=TABL flags=KGHP/TIM/MED/[40000000] kkkk-dddd-llll=0000-0701-0701 lock=0 pin=0 latch#=1 hpc=0002 hlc=0002 lwt=0x2bb8e018[0x2bb8e018,0x2bb8e018] ltm=0x2bb8e020[0x2bb8e020,0x2bb8e020] pwt=0x2bb8dffc[0x2bb8dffc,0x2bb8dffc] ptm=0x2bb8e004[0x2bb8e004,0x2bb8e004] ref=0x2bb8e038[0x2bb8e038,0x2bb8e038] lnd=0x2bb8e044[0x2bb7a7ac,0x2bb8e410] LOCK INSTANCE LOCK: id=LBb2f454b86387761e PIN INSTANCE LOCK: id=NBb2f454b86387761e mode=S release=F flags=[00 INVALIDATION INSTANCE LOCK: id=IV0000c9890e170507 mode=S LIBRARY OBJECT: object=2caede30 type=TABL flags=EXS/LOC[0005] pflags=[0000] status=VALD load=0 BUCKET 127469 total object count=1

86 © 2006 Julian Dyke juliandyke.com 86 Library Cache Instance Locks  For example in library cache dump  Library cache pin instance lock is  id=NBb2f454b86387761e  In X$KJIRFT this KJIRFTRN column  [0xb2f454b8][0x6387761e],[NB]

87 © 2006 Julian Dyke juliandyke.com 87 Namespaces->Instance Locks  Slide 1 of 3 NamespaceLockPin JVSCLNNN JVRELONO ROBJLPNP REIPLQNQ CPOBLRNR EVNTLSNS SUMMLTNT DIMMLUNU CTSLVNV OUTLLWNW RULSLXNX RMGRLYNY XDBSLZNZ NamespaceLockPin CRSRLANA TABLLBNB BODYLCNC TRGRLDND INDXLENE CLSTLFNF KGLTLGNG PIPELHNH LOBLINI DIRLJNJ QUEULKNK OBJGLLNL PROPLMNM

88 © 2006 Julian Dyke juliandyke.com 88 Namespaces->Instance Locks  Slide 2 of 3 NamespaceLockPin STAPENGN RELSEOGO RELDEPGP IFSDEQGQ XDBCERGR USAGESGS MVOBTBLETGT JSQIEUGU CDCEVGV MVOBINXEWGW STBOEXGX HTSOEYGY JSGAEZGZ NamespaceLockPin PPLNEAGA PCLSEBGB SUBSECGC LOCSEDGD RMOBEEGE RSMDEFGF JVSDEGGG STFGEHGH TRANSEIGI RELCEJGJ RULEEKGK STRMELGL REVCEMGM

89 © 2006 Julian Dyke juliandyke.com 89 Namespaces->Instance Locks  Slide 3 of 3 NamespaceLockPin JSETVAYA TABLEVBYB CLSTVCYC INDXVDYD NSCPDVEYE JSLVVFYF MODLVGYG UnusedVHYH UnusedVIYI UnusedVJYJ UnusedVKYK UnusedVLYL UnusedVMYM

90 © 2006 Julian Dyke juliandyke.com 90 V$ROWCACHE CACHE#NUMBER TYPEVARCHAR2(11) SUBORDINATE#NUMBER PARAMETERVARCHAR2(32) COUNTNUMBER USAGENUMBER FIXEDNUMBER GETSNUMBER GETMISSESNUMBER SCANSNUMBER SCANMISSESNUMBER SCANCOMPLETESNUMBER MODIFICATIONSNUMBER FLUSHESNUMBER DLM_REQUESTSNUMBER DLM_CONFLICTSNUMBER DLM_RELEASESNUMBER RAC Specific Statistics

91 © 2006 Julian Dyke juliandyke.com 91 V$ROWCACHE  Based on X$KQRST  Contains 42 rows in Oracle 10.2  34 Parent Cache  8 Subordinate Caches

92 © 2006 Julian Dyke juliandyke.com 92 Row Caches->Instance Locks  Slide 1 of 2 Cache#NamespaceLock 0dc_tablespacesQA 1dc_free_extentsQB 2dc_segmentsQC 3dc_rollback_segmentsQD 4dc_used_extentsQE 5dc_tablespace_quotasQF 6dc_filesQG 7dc_usersQH 8dc_objectsQI 9dc_qmc_cache_entriesQJ 10dc_usernamesQK 11dc_object_idsQL 12dc_constraintsQM Cache#NamespaceLock 13dc_sequencesQN 14dc_profilesQO 15dc_database_linksQP 16dc_histogram_defsQQ 17dc_global_oidsQR 18dc_outlinesQS 19dc_table_scnsQT 20rule_infoQU 21rule_or_pieceQV 22dc_awr_controlQW 23dc_qmc_ldap_cache...QX 24outstanding_alertsQY 25dc_hintsetsQZ

93 © 2006 Julian Dyke juliandyke.com 93 Row Caches->Instance Locks  Slide 2 of 2 Cache#NamespaceLock 26global_database_name?? 27qmtmrcin_cache_entries?? 28qmtmrctn_cache_entries?? 29qmtmrcip_cache_entries?? 30qmtmrctp_cache_entries?? 31qmtmrciq_cache_entries?? 32qmtmrctq_cache_entries?? 33kqlsubheap_object??  Cache# = KQRSTCID

94 © 2006 Julian Dyke juliandyke.com 94 Row Caches  Row cache statistics can be dumped using: ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME ROW_CACHE LEVEL 1';  For example: ROW CACHE STATISTICS: cache size gets misses hit ratio DLM req -------------------------- ------- ------- ------ --------- ------- dc_tablespaces 496 8909 7 0.999 7 dc_free_extents 388 0 0 0.000 0 dc_segments 444 4191 569 0.880 709 dc_rollback_segments 452 4210 31 0.993 74 dc_used_extents 400 0 0 0.000 0 dc_tablespace_quotas 396 0 0 0.000 0 dc_files 412 0 6 0.000 6 dc_users 520 9042 23 0.997 23 dc_users 260 0 0 0.000 0 dc_user_grants 108 24 17 0.585 0 dc_app_role 100 0 0 0.000 0....

95 © 2006 Julian Dyke juliandyke.com 95 BUCKET 48205: row cache parent object: address=0x2bb8dcd8 cid=8(dc_objects) hash=313bbc4c typ=9 transaction=(nil) flags=00000002 own=0x2bb8dd44[0x2bb8dd44,0x2bb8dd44] wat=0x2bb8dd4c[0x2bb8dd4c,0x2bb8dd4c] mode=S status=VALID/-/-/-/-/-/-/-/- request=N release=FALSE flags=0 instance lock id=QI f611ffad e31d1de3 set=0, complete=FALSE data= 00000037 31540002 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000...... 00000000 00000000 00000000 0000c989 00000001 0000c989 016a7802 0705170e 0e016a78 78070517 170e016a 00010705 00000000 00000000 00000000 00000000 00000000 00000006 BUCKET 48205 total object count=1 Row Caches  Row cache statistics can be dumped using: ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME ROW_CACHE LEVEL 8';  For example: T1 Instance Lock QI F611FFAD E31D1DE3 Cache ID 8 dc_objects

96 © 2006 Julian Dyke juliandyke.com 96 GES Resource Global Enqueue Services KJIRFTKJILKFT GES Enqueue KJILKFT HoldersConvertersWaiters

97 © 2006 Julian Dyke juliandyke.com 97 Resource Names  Contain  1 x two byte name  2 x 32 bit integer tag fields  Used with  Resources  Enqueues  Locks  Global Enqueue Services  Global Cache Services  Block are resources with resource name BL

98 © 2006 Julian Dyke juliandyke.com 98 Resource Names  Externalized inconsistently throughout Oracle in  V$/GV$ dynamic performance views  X$ fixed tables  Dumps and trace files  Stored consistently in internal C structures including  KJBR  KJIRFT  Other structures reference the resource names in these structures including  KJBL  KJILFKT

99 © 2006 Julian Dyke juliandyke.com 99 GES Parameters  GES Resources  Number of GES resource structures probably determined by  _lm_ress parameter  Stored in heap  Externalized in X$KJIRFT  GES Enqueues  Number of GES enqueue structures probably determined by  _lm_locks parameter  Stored in segmented array  Externalized in X$KJILKFT

100 © 2006 Julian Dyke juliandyke.com 100 X$KJIRFT  Externals global enqueue resources  Does NOT include global cache resources ADDRRAW(4) INDXNUMBER INST_IDNUMBER KJIRFTRPRAW(4) KJIRFTRNVARCHAR2(30) KJIRFTCQNUMBER KJIRFTGQNUMBER KJIRFTPRNUMBER KJIRFTRDNVARCHAR2(25) KJIRFTMNNUMBER KJIRFTNCLVARCHAR2(9) KJIRFTVSVARCHAR2(32) KJIRFTVBVARCHAR2(64)

101 © 2006 Julian Dyke juliandyke.com 101 X$KJILKFT ADDRRAW(4) INDXNUMBER INST_IDNUMBER KJILKFTLKPRAW(4) KJILKFTGLVARCHAR2(9) KJILKFTRLVARCHAR2(9) KJILKFTRPRAW(4) KJILKFTRN1VARCHAR2(30) KJILKFTRN2VARCHAR2(30) KJILKFTPIDNUMBER KJILKFTXID0NUMBER KJILKFTXID1NUMBER KJILKFTGIDNUMBER KJILKFTOODDNUMBER KJILKFTOOPTNUMBER KJILKFTOOPONUMBER KJILKFTOONXIDNUMBER KJILKFTCOGVNUMBER KJILKFTCOPVNUMBER KJILKFTCONVNUMBER KJILKFTCODVNUMBER KJILKFTCONQNUMBER KJILKFTCOEPNUMBER KJILKFTCONDDWNUMBER KJILKFTCONDDBNUMBER KJILKFTWQNUMBER KJILKFTLSVARCHAR2(64) KJILKFTASTE0NUMBER KJILKFTONNUMBER KJILKFTBLKEDNUMBER KJILKFTBLKERNUMBER

102 © 2006 Julian Dyke juliandyke.com 102 V$GES_RESOURCE  Contains rows from both KJIRFT and KJBR  Synonym for V$DLM_RESS RESPRAW(4) RESOURCE_NAMEVARCHAR2(30) ON_CONVERT_QNUMBER ON_GRANT_QNUMBER PERSISTENT_RESNUMBER MASTER_NODENUMBER NEXT_CVT_LEVELVARCHAR2(9) VALUE_BLK_STATEVARCHAR2(32) VALUE_BLKVARCHAR2(64)

103 © 2006 Julian Dyke juliandyke.com 103 V$GES_RESOURCE  Contains rows from both KJIRFT and KJBR  Synonym for V$DLM_RESS SELECT inst_id, kjirftrp, kjirftrn, kjirftcq, kjirftgq, kjirftpr, kjirftmn, kjirftncl, kjirftvs, kjirftvb FROM x$kjirft UNION ALL SELECT inst_id, kjbrresp, kjbrname, DECODE (kjbrcvtq, '00', 0, 1), DECODE (kjbrgrantq, '00', 0, 1), 1, kjbrmaster, kjbrncvl, 'KJUSERVS_NOVALUE', '0x0' FROM x$kjbr

104 © 2006 Julian Dyke juliandyke.com 104 V$GES_ENQUEUE  Contains rows from both KJILKFT and KJBL HANDLERAW(4) GRANT_LEVELVARCHAR2(9) REQUEST_LEVELVARCHAR2(9) RESOURCE_NAME1VARCHAR2(30) RESOURCE_NAME2VARCHAR2(30) PIDNUMBER TRANSACTION_ID0NUMBER TRANSACTION_ID1NUMBER GROUP_IDNUMBER OPEN_OPT_DEADLOCKNUMBER OPEN_OPT_PERSISTENTNUMBER OPEN_OPT_PROCESS_OWNEDNUMBER OPEN_OPT_NO_XIDNUMBER CONVERT_OPT_GETVALUENUMBER CONVERT_OPT_PUTVALUENUMBER CONVERT_OPT_NOVALUENUMBER CONVERT_OPT_DUBVALUENUMBER CONVERT_OPT_NOQUEUENUMBER CONVERT_OPT_EXPRESSNUMBER CONVERT_OPT_NODEADLOCKWAITNUMBER CONVERT_OPT_NODEADLOCKBLOCKNUMBER WHICH_QUEUENUMBER STATEVARCHAR2(64) AST_EVENT0NUMBER OWNER_NODENUMBER BLOCKEDNUMBER BLOCKERNUMBER

105 © 2006 Julian Dyke juliandyke.com 105 V$GES_ENQUEUE  Contains rows from both KJILKFT and KJBL SELECT inst_id, kjilkftlkp, kjilkftgl, kjilkftrl, kjilkftrn1, kjilkftrn2, kjilkftpid, kjilkftxid0, kjilkftxid1, kjilkftgid, kjilkftoodd, kjilkftoopt, kjilkftoopo, kjilkftoonxid, kjilkftcogv, kjilkftcopv, kjilkftconv, kjilkftcodv, kjilkftconq, kjilkftcoep, kjilkftconddw, kjilkftconddb, kjilkftwq, kjilkftls, kjilkftaste0, kjilkfton, kjilkftblked, kjilkftblker FROM x$kjilkft UNION ALL SELECT inst_id, kjbllockp, kjblgrant, kjblrequest, kjblname, kjblname2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, kjblqueue, kjbllockst, 0, kjblowner, kjblblocked, kjblblocker FROM x$kjbl

106 © 2006 Julian Dyke juliandyke.com 106 Thank you for your interest For more information and to provide feedback please contact me My e-mail address is: info@juliandyke.com My website address is: www.juliandyke.com


Download ppt "1 © 2006 Julian Dyke Inside RAC Julian Dyke Independent Consultant Web Version juliandyke.com."

Similar presentations


Ads by Google