19.11.2009 DOAG 2009 Page  DOAG 2009 X$Tables and SGA-Scanner Dipl.-Inform. Frank Beutelschiess
19.11.2009 DOAG 2009 Page  Contents <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>C...
19.11.2009 DOAG 2009 Page  Chapter 1 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>...
19.11.2009 DOAG 2009 Page  Who am I? <ul><li>Graduate of computer science out of a passion for the field </li></ul><ul><li...
19.11.2009 DOAG 2009 Page  What does BzYxS.com do? <ul><li>Training & Consulting </li></ul><ul><ul><li>Among other things,...
19.11.2009 DOAG 2009 Page  Chapter 2 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>...
19.11.2009 DOAG 2009 Page  SGA – What is it? <ul><li>abbreviation for  „Shared Global Area“ </li></ul><ul><li>shared memor...
SGA 19.11.2009 DOAG 2009 Page  SGA - Architecture Redo Buffer Large Pool Dedicated Server Process Shared Server Process CK...
19.11.2009 DOAG 2009 Page  SGA - Areas <ul><li>Buffer Pool </li></ul><ul><ul><li>Default/Keep/Recycle, n-Size (n = 2,4,8,1...
19.11.2009 DOAG 2009 Page  SGA – Fixed Area <ul><li>Part of the SGA contains general information about the state of the da...
19.11.2009 DOAG 2009 Page  SGA - Dedicated/Shared Server <ul><li>Dedicated/Shared </li></ul><ul><li>UGA (User Global Area)...
19.11.2009 DOAG 2009 Page  SGA – Fixed Structures <ul><li>Fixed during the start of an instance  </li></ul><ul><li>(V$SGA ...
19.11.2009 DOAG 2009 Page  SGA – Dynamic Structures <ul><li>Dynamic, created at runtime as a heap.  (V$SGA_DYNAMIC_COMPONE...
19.11.2009 DOAG 2009 Page  SGA - Parameters The type of parameter (fixed or dynamic), for example, is shown in the Enterpr...
19.11.2009 DOAG 2009 Page  SGA – Allocation of Memory <ul><li>SGA_MAX_SIZE defines the maximum size of the SGA. </li></ul>...
19.11.2009 DOAG 2009 Page  SGA – Granule Order Fixed Area Unused Buffer Cache Large Pool Java Pool Shared Pool Shared Pool...
19.11.2009 DOAG 2009 Page  Chapter 3 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>...
19.11.2009 DOAG 2009 Page  X$Tables - Information (1/2) <ul><li>All examples are based upon Oracle 9.2 .0.5.0 </li></ul><u...
19.11.2009 DOAG 2009 Page  X$Tables - Information (2/2) <ul><li>X$Tables are not officially documented from Oracle. </li><...
19.11.2009 DOAG 2009 Page  X$KSMGE (1/3) <ul><li>Kernel/Service/Memory/Granule </li></ul><ul><li>GranType 4 = ‘JavaPool‘ <...
19.11.2009 DOAG 2009 Page  X$KSMGE (2/3) <ul><li>select 'X$KSMGE', </li></ul><ul><li>decode(grantype,0,'Free',2,'SharedPoo...
19.11.2009 DOAG 2009 Page  X$KSMGE (3/3) <ul><li>Database Buffers   24.00 MB </li></ul><ul><li>Variable Size 104.00 MB </l...
19.11.2009 DOAG 2009 Page  X$Tables – What are they? <ul><li>The window to the SGA. </li></ul><ul><li>Corresponds to the m...
19.11.2009 DOAG 2009 Page  X$KSMMEM (1/4) <ul><li>Each byte of the SGA is mapped external </li></ul>
19.11.2009 DOAG 2009 Page  X$KSMMEM (2/4) <ul><li>Dump of the first bytes in a 32 Bit SGA </li></ul><ul><li>Each KSMMMVAL ...
19.11.2009 DOAG 2009 Page  X$KSMMEM (3/4) <ul><li>Dump of the first bytes in a 32 Bit SGA </li></ul><ul><li>Each KSMMMVAL ...
19.11.2009 DOAG 2009 Page  X$KSMMEM (4/4) <ul><li>Dump of the first bytes in a 32 Bit SGA </li></ul><ul><li>Each KSMMMVAL ...
19.11.2009 DOAG 2009 Page  X$-Tables - Why? <ul><li>Just for fun. </li></ul><ul><li>Access to data which is otherwise not ...
19.11.2009 DOAG 2009 Page  X$KSPPI & X$KSPPSV <ul><li>Access to all Parameters (incl. hidden) </li></ul><ul><li>X$KSPPI Ke...
19.11.2009 DOAG 2009 Page  X$KSPPI & X$KSPPSV select x.inst_id,y.ksppinm, decode(y.ksppity,1,'Boolean',2,'String',3,'Integ...
19.11.2009 DOAG 2009 Page  X$Tables - Access <ul><li>Rights to the X$Tables cannot simply be granted. </li></ul><ul><li>Wr...
19.11.2009 DOAG 2009 Page  X$Tables - Terms Metalink Doc ID:  Note:22241.1  Subject:  List of X$ Tables and how the names ...
19.11.2009 DOAG 2009 Page  X$Tables – Start of Analysis <ul><li>X$KSMMEM - memory access </li></ul><ul><li>X$KQFTA - all X...
19.11.2009 DOAG 2009 Page  X$Tables – Offset Calculation <ul><li>select c.kqfconam field_name, </li></ul><ul><li>c.kqfcoof...
19.11.2009 DOAG 2009 Page  X$Tables - Structure <ul><li>Each X$Table consists of </li></ul><ul><ul><li>physically availabl...
19.11.2009 DOAG 2009 Page  X$Tables – Contention (1/2) <ul><li>X$KGLOB (KernelGenericLibraryObject) </li></ul><ul><li>Full...
19.11.2009 DOAG 2009 Page  X$Tables – Contention (2/2) <ul><li>X$Tables are protected from latches as low level data struc...
19.11.2009 DOAG 2009 Page  Chapter 4 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>...
19.11.2009 DOAG 2009 Page  V$ Views <ul><li>In general, in accordance with their function, based on X$Tables. </li></ul><u...
19.11.2009 DOAG 2009 Page  V$Views - Definition <ul><li>X$KQFVI - name of V$ & GV$ views </li></ul><ul><li>X$KQFVT - corre...
19.11.2009 DOAG 2009 Page  Chapter 5 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>...
19.11.2009 DOAG 2009 Page  SGA-Scanner – What? <ul><li>Direct readout of the SGA on memory level by bypassing the database...
19.11.2009 DOAG 2009 Page  SGA-Scanner - Configuration
19.11.2009 DOAG 2009 Page  SGA-Scanner - Challenge <ul><li>32 Bit / 64 Bit according to 4 / 8 Byte arithmatic / pointers <...
19.11.2009 DOAG 2009 Page  SGA-Scanner - Windows <ul><li>1 process, many tasks </li></ul><ul><li>1 database </li></ul>
19.11.2009 DOAG 2009 Page  SGA-Scanner - Implementation <Psapi>.EnumProcesses(*pProcessIds,…) <Kernel32>.OpenProcess(0x410...
19.11.2009 DOAG 2009 Page  SGA-Scanner - Why? <ul><li>Access to a no longer accessible/hard to reach database. </li></ul><...
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (1/9) - List of all sessions (same as V$SESSION)
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (2/9) - Session 10 (SID 10) is newly added.
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (3/9) - Session 11 (SID 12) is newly added.
19.11.2009 DOAG 2009 Page  <ul><li>Preparation of both sessions, autocommit is deactivated! </li></ul>SGA-Scanner – V$SESS...
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (5/9) - Access to the table locked by the other session.
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (6/9) - Session 11 (SID 12) waits due to an enqueue.
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (7/9) - Lock is removed through a manual commit.
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (8/9) - Enqueue is broken.
19.11.2009 DOAG 2009 Page  SGA-Scanner – V$SESSION (9/9)
19.11.2009 DOAG 2009 Page  Thank you for your attention!
Upcoming SlideShare
Loading in …5
×

X$Tables And Sga Scanner, DOAG2009

1,556 views

Published on

Introduction to Oracle SGA structures, X$Tables and SGA-Scanners.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,556
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

X$Tables And Sga Scanner, DOAG2009

  1. 1. 19.11.2009 DOAG 2009 Page DOAG 2009 X$Tables and SGA-Scanner Dipl.-Inform. Frank Beutelschiess
  2. 2. 19.11.2009 DOAG 2009 Page Contents <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>Chapter 3 – X$Tables </li></ul><ul><li>Chapter 4 – V$Views </li></ul><ul><li>Chapter 5 – SGA-Scanner </li></ul>
  3. 3. 19.11.2009 DOAG 2009 Page Chapter 1 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>Chapter 3 – X$Tables </li></ul><ul><li>Chapter 4 – V$Views </li></ul><ul><li>Chapter 5 – SGA-Scanner </li></ul>
  4. 4. 19.11.2009 DOAG 2009 Page Who am I? <ul><li>Graduate of computer science out of a passion for the field </li></ul><ul><li>Active freelancer for 17 years </li></ul><ul><li>10 years in the area of Siebel and OracleDB </li></ul><ul><li>BzYxS.com for the past 2 years </li></ul>
  5. 5. 19.11.2009 DOAG 2009 Page What does BzYxS.com do? <ul><li>Training & Consulting </li></ul><ul><ul><li>Among other things, for Oracle University </li></ul></ul><ul><li>Siebel division </li></ul><ul><ul><li>Configuration reviews </li></ul></ul><ul><ul><li>Component tuning </li></ul></ul><ul><li>Oracle Databank environment </li></ul><ul><ul><li>Tuning, preferred under use of tracefile analysis with QueryAdvisor </li></ul></ul>
  6. 6. 19.11.2009 DOAG 2009 Page Chapter 2 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>Chapter 3 – X$Tables </li></ul><ul><li>Chapter 4 – V$Views </li></ul><ul><li>Chapter 5 – SGA-Scanner </li></ul>
  7. 7. 19.11.2009 DOAG 2009 Page SGA – What is it? <ul><li>abbreviation for „Shared Global Area“ </li></ul><ul><li>shared memory between all processes (Unix) or threads (Windows) </li></ul><ul><li>allocated during the start of an instance in state NoMount </li></ul><ul><li>allocated partially (Unix) or completely (Windows) according to release and OS </li></ul><ul><li>Instance = Processes (Threads) + SGA </li></ul>
  8. 8. SGA 19.11.2009 DOAG 2009 Page SGA - Architecture Redo Buffer Large Pool Dedicated Server Process Shared Server Process CKPT Data RedoLog Archive Control ARCn LGWR SMON PMON BufferCache Streams Pool Java Pool Shared Pool PGA PGA Dispatcher User User User User Dedicated Server Shared Server DBWn Instance Database Fixed Area
  9. 9. 19.11.2009 DOAG 2009 Page SGA - Areas <ul><li>Buffer Pool </li></ul><ul><ul><li>Default/Keep/Recycle, n-Size (n = 2,4,8,16,32KB) </li></ul></ul><ul><li>Shared Pool </li></ul><ul><ul><li>Library Cache </li></ul></ul><ul><ul><ul><li>Shared SQL-areas & Private SQL-areas (only on shared servers) </li></ul></ul></ul><ul><ul><ul><li>PL/SQL procedures </li></ul></ul></ul><ul><ul><ul><li>Library Cache Handles </li></ul></ul></ul><ul><ul><li>Dictionary Cache </li></ul></ul><ul><ul><li>Control structures (Latches & Enques) </li></ul></ul><ul><li>Redo Buffer </li></ul><ul><li>Large Pool </li></ul><ul><li>Java & Streams Pool </li></ul>
  10. 10. 19.11.2009 DOAG 2009 Page SGA – Fixed Area <ul><li>Part of the SGA contains general information about the state of the database and the instance, which the background processes need to access. No user data is stored here. </li></ul><ul><li>http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/memory.htm </li></ul><ul><li>Oracle also maintains a &quot;fixed&quot; area in the SGA that contains a number of atomic variables, pointers, and other miscellaneous structures that reference areas of the SGA. http://www.dba-oracle.com/oracle_tips_sga_regions.htm </li></ul>
  11. 11. 19.11.2009 DOAG 2009 Page SGA - Dedicated/Shared Server <ul><li>Dedicated/Shared </li></ul><ul><li>UGA (User Global Area) PGA/SGA </li></ul><ul><li>Request/Response Queues PGA/SGA </li></ul><ul><li>Runtime area Select PGA </li></ul><ul><li>Runtime area DMLs/DDLs PGA </li></ul>
  12. 12. 19.11.2009 DOAG 2009 Page SGA – Fixed Structures <ul><li>Fixed during the start of an instance </li></ul><ul><li>(V$SGA named = ‘Fixed Size‘)) </li></ul><ul><ul><li>Session Array </li></ul></ul><ul><ul><li>Process Array </li></ul></ul><ul><li>Memory requirements are calculated at the start of the instance and immediately allocated completely. </li></ul><ul><li>Changes are only available after a restart. </li></ul>
  13. 13. 19.11.2009 DOAG 2009 Page SGA – Dynamic Structures <ul><li>Dynamic, created at runtime as a heap. (V$SGA_DYNAMIC_COMPONENTS) </li></ul><ul><ul><li>Buffer Cache </li></ul></ul><ul><ul><li>Shared Pool (Library Cache, Dictionary Cache) </li></ul></ul><ul><ul><li>Large Pool </li></ul></ul>
  14. 14. 19.11.2009 DOAG 2009 Page SGA - Parameters The type of parameter (fixed or dynamic), for example, is shown in the Enterprise Manager.
  15. 15. 19.11.2009 DOAG 2009 Page SGA – Allocation of Memory <ul><li>SGA_MAX_SIZE defines the maximum size of the SGA. </li></ul><ul><li>The maximum possible size depends upon the release and OS. </li></ul><ul><li>Allocation occurs immediately or in part in the form of individual blocks, which are called granules. </li></ul><ul><li>The size of a granule depends upon the size of the SGA, release and OS, with 4 or 8, or 16MB, accordingly. </li></ul>
  16. 16. 19.11.2009 DOAG 2009 Page SGA – Granule Order Fixed Area Unused Buffer Cache Large Pool Java Pool Shared Pool Shared Pool Redo Buffer Increasing memory address Shared Pool Shared Pool Java Pool Streams Pool Shared Pool Shared Pool Large Pool Buffer Cache Buffer Cache Buffer Cache Buffer Cache Buffer Cache Buffer Cache Buffer Cache Buffer Cache Unused
  17. 17. 19.11.2009 DOAG 2009 Page Chapter 3 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>Chapter 3 – X$Tables </li></ul><ul><li>Chapter 4 – V$Views </li></ul><ul><li>Chapter 5 – SGA-Scanner </li></ul>
  18. 18. 19.11.2009 DOAG 2009 Page X$Tables - Information (1/2) <ul><li>All examples are based upon Oracle 9.2 .0.5.0 </li></ul><ul><li>All examples are based upon a 32 Bit Windows XP installation. </li></ul><ul><li>Why this historical configuration? </li></ul><ul><li>Basic concepts of the structure of a SGA, such as, for example, granules were first introduced in 9i. </li></ul>
  19. 19. 19.11.2009 DOAG 2009 Page X$Tables - Information (2/2) <ul><li>X$Tables are not officially documented from Oracle. </li></ul><ul><li>X$Tables can change at any time, from release to release, both in their existence and their structure. </li></ul><ul><li>Everything that is presented here in the following pages is based only upon well-founded presumptions. </li></ul><ul><li>Therefore, please use it with sense and care! </li></ul>
  20. 20. 19.11.2009 DOAG 2009 Page X$KSMGE (1/3) <ul><li>Kernel/Service/Memory/Granule </li></ul><ul><li>GranType 4 = ‘JavaPool‘ </li></ul><ul><li>GranType 5 = ‘BufferPool‘ </li></ul>
  21. 21. 19.11.2009 DOAG 2009 Page X$KSMGE (2/3) <ul><li>select 'X$KSMGE', </li></ul><ul><li>decode(grantype,0,'Free',2,'SharedPool',3,'LargePool',4,'JavaPool', </li></ul><ul><li>5,'BufferPool',grantype) as Component,count(*),count(*)*4 </li></ul><ul><li>from X$KSMGE group by GRANTYPE </li></ul><ul><li>union all </li></ul><ul><li>select 'X$KSMSD',KSMSDNAM,0,KSMSDVAL/(1024*1024) </li></ul><ul><li>from X$KSMSD </li></ul><ul><li>order by 1,2 </li></ul>Information: X$KSMSD (Kernel/Service/Memory/SizeDefinition) ~ V$SGA
  22. 22. 19.11.2009 DOAG 2009 Page X$KSMGE (3/3) <ul><li>Database Buffers 24.00 MB </li></ul><ul><li>Variable Size 104.00 MB </li></ul><ul><ul><li>Shared Pool 64.00 MB </li></ul></ul><ul><ul><li>Java Pool 32.00 MB </li></ul></ul><ul><ul><li>Large Pool 8.00 MB </li></ul></ul><ul><li>Fixed Size 0.43 MB </li></ul><ul><li>Redo Buffers 0.64 MB </li></ul><ul><li>------------------------------------------------ </li></ul><ul><li>Total 129.07 MB </li></ul>
  23. 23. 19.11.2009 DOAG 2009 Page X$Tables – What are they? <ul><li>The window to the SGA. </li></ul><ul><li>Corresponds to the mentioned Fixed Area. </li></ul><ul><li>X$Tables correspond to data structures implemented in C. </li></ul><ul><li>These structures are realized in the form of simple, atomic variables, pointers, arrays, linked lists,… </li></ul>
  24. 24. 19.11.2009 DOAG 2009 Page X$KSMMEM (1/4) <ul><li>Each byte of the SGA is mapped external </li></ul>
  25. 25. 19.11.2009 DOAG 2009 Page X$KSMMEM (2/4) <ul><li>Dump of the first bytes in a 32 Bit SGA </li></ul><ul><li>Each KSMMMVAL contains 4 Bytes </li></ul>Please note: with Unix, it can exist without a limitation in the Where-part.!
  26. 26. 19.11.2009 DOAG 2009 Page X$KSMMEM (3/4) <ul><li>Dump of the first bytes in a 32 Bit SGA </li></ul><ul><li>Each KSMMMVAL contains 4 Bytes </li></ul>
  27. 27. 19.11.2009 DOAG 2009 Page X$KSMMEM (4/4) <ul><li>Dump of the first bytes in a 32 Bit SGA </li></ul><ul><li>Each KSMMMVAL contains 4 Bytes </li></ul>
  28. 28. 19.11.2009 DOAG 2009 Page X$-Tables - Why? <ul><li>Just for fun. </li></ul><ul><li>Access to data which is otherwise not accessible, only a part of the information is accessible using the V$Views. </li></ul>
  29. 29. 19.11.2009 DOAG 2009 Page X$KSPPI & X$KSPPSV <ul><li>Access to all Parameters (incl. hidden) </li></ul><ul><li>X$KSPPI Kernel/Service/Parameter/ParameterInfo </li></ul><ul><li>X$KSPPSV Kernel/Service/Parameter/SystemValues </li></ul><ul><li>select * from X$KSPPI P,X$KSPPSV V </li></ul><ul><li>where P.INDX = V.INDX and P.INST_ID = V.INST_ID </li></ul>
  30. 30. 19.11.2009 DOAG 2009 Page X$KSPPI & X$KSPPSV select x.inst_id,y.ksppinm, decode(y.ksppity,1,'Boolean',2,'String',3,'Integer', 4,'ParameterFile',5,'Reserved',6,'BigInteger',y.ksppity), x.ksppstvl,x.ksppstdf, decode(bitand(y.ksppiflg/256,1),1,'TRUE','FALSE'), decode(bitand(y.ksppiflg/65536,3), 1,'IMMEDIATE',2,'DEFERRED',3,'IMMEDIATE','FALSE'), decode(bitand(x.ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE'), decode(bitand(x.ksppstvf,2),2,'TRUE','FALSE'), y.ksppdesc from X$KSPPI y, X$KSPPSV x where x.indx = y.indx and x.inst_id = y.inst_id order by 1,2
  31. 31. 19.11.2009 DOAG 2009 Page X$Tables - Access <ul><li>Rights to the X$Tables cannot simply be granted. </li></ul><ul><li>Write-access would compromise the stability of the instance! </li></ul>
  32. 32. 19.11.2009 DOAG 2009 Page X$Tables - Terms Metalink Doc ID:  Note:22241.1 Subject: List of X$ Tables and how the names are derived
  33. 33. 19.11.2009 DOAG 2009 Page X$Tables – Start of Analysis <ul><li>X$KSMMEM - memory access </li></ul><ul><li>X$KQFTA - all X$Tables </li></ul><ul><li>X$KQFDT - derivative tables </li></ul><ul><li>X$KQFCO - column definitions </li></ul>
  34. 34. 19.11.2009 DOAG 2009 Page X$Tables – Offset Calculation <ul><li>select c.kqfconam field_name, </li></ul><ul><li>c.kqfcooff offset, </li></ul><ul><li>c.kqfcosiz sz </li></ul><ul><li>from </li></ul><ul><li>x$kqfco c, </li></ul><ul><li>x$kqfta t </li></ul><ul><li>where </li></ul><ul><li>t.indx = c.kqfcotab and </li></ul><ul><li>t.kqftanam='X$KSUSECST' </li></ul><ul><li>order by </li></ul><ul><li>offset </li></ul><ul><li>X$KSUSECST = Kernel/Service/User/SessionStatusForEvents </li></ul><ul><li>For example, use in V$SESSION </li></ul>
  35. 35. 19.11.2009 DOAG 2009 Page X$Tables - Structure <ul><li>Each X$Table consists of </li></ul><ul><ul><li>physically available columns </li></ul></ul><ul><ul><li>virtual columns </li></ul></ul><ul><li>Virtual columns always available are </li></ul><ul><ul><li>ADDR = physical data address </li></ul></ul><ul><ul><li>INDX = Index inside the table </li></ul></ul><ul><li>Often joins use the INDX column </li></ul><ul><li>The order of the columns is not identical with the order inside the data structures! </li></ul>
  36. 36. 19.11.2009 DOAG 2009 Page X$Tables – Contention (1/2) <ul><li>X$KGLOB (KernelGenericLibraryObject) </li></ul><ul><li>FullTableScans indicate that all latches have been traversed in the LibraryCache. </li></ul>
  37. 37. 19.11.2009 DOAG 2009 Page X$Tables – Contention (2/2) <ul><li>X$Tables are protected from latches as low level data structures. </li></ul><ul><li>FullTableScans will cause latch contention! </li></ul><ul><li>The X$KGLOB is especially compromised (see Metalink). </li></ul><ul><li>Access to indices should be forced, no statistics should be generated according to the volatility of some X$Tables! </li></ul>
  38. 38. 19.11.2009 DOAG 2009 Page Chapter 4 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>Chapter 3 – X$Tables </li></ul><ul><li>Chapter 4 – V$Views </li></ul><ul><li>Chapter 5 – SGA-Scanner </li></ul>
  39. 39. 19.11.2009 DOAG 2009 Page V$ Views <ul><li>In general, in accordance with their function, based on X$Tables. </li></ul><ul><li>Are documented and also largely stable across all versions. </li></ul><ul><li>V$Views are mapped from GV$Views limited by the instance. </li></ul><ul><li>Access limitations to X$Tables are eliminated through a two-step mapping of the GV_$Views onto the underlying GV$Views. </li></ul>
  40. 40. 19.11.2009 DOAG 2009 Page V$Views - Definition <ul><li>X$KQFVI - name of V$ & GV$ views </li></ul><ul><li>X$KQFVT - corresponding definitions </li></ul><ul><li>V$FIXED_VIEW_DEFINITION </li></ul><ul><li>Script for mapping in CATALOG.SQL </li></ul><ul><li>create or replace view gv_$bh as select * from gv$bh; </li></ul><ul><li>create or replace public synonym gv$bh for gv_$bh; </li></ul><ul><li>grant select on gv_$bh to public; </li></ul>
  41. 41. 19.11.2009 DOAG 2009 Page Chapter 5 <ul><li>Chapter 1 – Introduction </li></ul><ul><li>Chapter 2 – SGA </li></ul><ul><li>Chapter 3 – X$Tables </li></ul><ul><li>Chapter 4 – V$Views </li></ul><ul><li>Chapter 5 – SGA-Scanner </li></ul>
  42. 42. 19.11.2009 DOAG 2009 Page SGA-Scanner – What? <ul><li>Direct readout of the SGA on memory level by bypassing the database instance. </li></ul><ul><li>Self-contained program on the respective database server. </li></ul><ul><li>SGA addresses etc. are determined using queries at the frontend of the database. </li></ul>
  43. 43. 19.11.2009 DOAG 2009 Page SGA-Scanner - Configuration
  44. 44. 19.11.2009 DOAG 2009 Page SGA-Scanner - Challenge <ul><li>32 Bit / 64 Bit according to 4 / 8 Byte arithmatic / pointers </li></ul><ul><li>Address alignment (e.g., a word always begins at an even address) </li></ul><ul><li>Big (PowerPC) & Little Endian (X86) </li></ul><ul><ul><li>Register: =0A0B0C0D=> </li></ul></ul><ul><ul><li>BigEndian: =0A0B0C0D=> </li></ul></ul><ul><ul><li>LittleEndian: =0D0C0B0A=> </li></ul></ul><ul><li>Granules & nonlinear memory area </li></ul>
  45. 45. 19.11.2009 DOAG 2009 Page SGA-Scanner - Windows <ul><li>1 process, many tasks </li></ul><ul><li>1 database </li></ul>
  46. 46. 19.11.2009 DOAG 2009 Page SGA-Scanner - Implementation <Psapi>.EnumProcesses(*pProcessIds,…) <Kernel32>.OpenProcess(0x410,…,dwProcessId) <Psapi>.GetModuleBaseName(hProcess,…,lpBaseName,…) <Kernel32>.CloseHandle(hObject) <Kernel32>.ReadProcessMemory(hProcess, lpBaseAddress,lpBuffer,…) Oracle.exe? Liste fertig? <Kernel32>.CloseHandle(hObject) Yes Yes No No Start End
  47. 47. 19.11.2009 DOAG 2009 Page SGA-Scanner - Why? <ul><li>Access to a no longer accessible/hard to reach database. </li></ul><ul><li>No burden on the instance through contentions by shared memory (pure CPU load). </li></ul><ul><li>High sampling speed (from 1000x/second as opposed to a maximum of 50x of V$Views). </li></ul>
  48. 48. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (1/9) - List of all sessions (same as V$SESSION)
  49. 49. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (2/9) - Session 10 (SID 10) is newly added.
  50. 50. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (3/9) - Session 11 (SID 12) is newly added.
  51. 51. 19.11.2009 DOAG 2009 Page <ul><li>Preparation of both sessions, autocommit is deactivated! </li></ul>SGA-Scanner – V$SESSION (4/9)
  52. 52. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (5/9) - Access to the table locked by the other session.
  53. 53. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (6/9) - Session 11 (SID 12) waits due to an enqueue.
  54. 54. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (7/9) - Lock is removed through a manual commit.
  55. 55. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (8/9) - Enqueue is broken.
  56. 56. 19.11.2009 DOAG 2009 Page SGA-Scanner – V$SESSION (9/9)
  57. 57. 19.11.2009 DOAG 2009 Page Thank you for your attention!

×