View
427
Download
6
Category
Tags:
Preview:
Citation preview
1
Julian Dyke
Independent Consultant
© 2005 Julian Dyke
SGAInternals
Web Version
juliandyke.com
2 © 2005 Julian Dykejuliandyke.com
Agenda Introduction SGA
Granules Fixed SGA Buffer Cache Shared Pool
Permanent Areas Heaps Subheaps Library Cache Reserved Area
Log Buffer Conclusion
3 © 2005 Julian Dykejuliandyke.com
Introduction Examples based on
32 bit architecture Red Hat 2.1 AS Oracle 9.2.0.4 Single (non-RAC) instance
Examples affected by Oracle version Operating system Single instance / RAC Architecture (32/64) Parameters
4 © 2005 Julian Dykejuliandyke.com
Word Length Word length can be
32 bit - 4 byte pointers 64 bit - 8 byte pointers
Also affects size of some integer variables e.g. int word alignment
When moving from 32 bit to 64 bit Oracle recommends doubling SHARED_POOL_SIZE SHARED_POOL_RESERVED_SIZE LARGE_POOL_SIZE
5 © 2005 Julian Dykejuliandyke.com
Double Linked Lists - Insertion Frequently used in SGA structures Each element includes pointers to next and previous elements Requires 8 bytes (32 bit systems) or 16 bytes (64 bit systems)
55443080 55845C54 52175AC0
HeadTail
5000F430
5000F430
5544308055443080
5000F430
55845C5455845C54 52175AC052175AC0
STOP
6 © 2005 Julian Dykejuliandyke.com
Double Linked Lists - Deletion Double linked lists are more efficient for
insertion deletion
55443080 55845C54
HeadTail
5000F430 52175AC0
5000F430
5544308055443080
5000F430
55845C54
55845C54 52175AC0
52175AC0
STOP
7 © 2005 Julian Dykejuliandyke.com
Memory Areas An Oracle process includes
the following memory areas
Executable PGA/Session Heap Shared Libraries SGA Stack
08048000
0AAA28C0
40000000
50000000
584A4000
Executable
PGASession Heap
SharedLibraries
SGA
Stack
STOP
8 © 2005 Julian Dykejuliandyke.com
Shared Memory Shared memory can be dumped to trace file using
ORADEBUG SETMYPIDORADEBUG IPC
$ sqlplus /nolog
SQL> CONNECT SYS/<password> AS SYSDBAConnected
SQL> ORADEBUG SETMYPIDStatement processed
SQL> ORADEBUG IPCInformation written to trace file
SQL> ORADEBUG TRACEFILE_NAME/var/opt/oracle/admin/LX092001/udump/lx092001_ora_9824.trc
9 © 2005 Julian Dykejuliandyke.com
Area #0 `Fixed Size' containing Subareas 0-0 Total size 000000000006e5cc Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 0 0 163840 0x00000050000000 0x00000050000000 Subarea size Segment size 000000000006f000 0000000008800000 Area #1 `Variable Size' containing Subareas 1-1 Total size 0000000008000000 Minimum Subarea size 00400000 Area Subarea Shmid Stable Addr Actual Addr 1 1 163840 0x0000005006f000 0x0000005006f000 Subarea size Segment size 0000000008391000 0000000008800000 Area #2 `Redo Buffers' containing Subareas 2-2 Total size 00000000000a3000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 2 2 163840 0x00000058400000 0x00000058400000 Subarea size Segment size 00000000000a3000 0000000008800000 Area #3 `skgm overhead' containing Subareas 3-3 Total size 0000000000001000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 3 3 163840 0x000000584a3000 0x000000584a3000 Subarea size Segment size 0000000000001000 0000000008800000
ORADEBUG IPC - Example Area #0 `Fixed Size' containing Subareas 0-0 Total size 000000000006e5cc Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 0 0 163840 0x00000050000000 0x00000050000000 Subarea size Segment size 000000000006f000 0000000008800000 Area #1 `Variable Size' containing Subareas 1-1 Total size 0000000008000000 Minimum Subarea size 00400000 Area Subarea Shmid Stable Addr Actual Addr 1 1 163840 0x0000005006f000 0x0000005006f000 Subarea size Segment size 0000000008391000 0000000008800000 Area #2 `Redo Buffers' containing Subareas 2-2 Total size 00000000000a3000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 2 2 163840 0x00000058400000 0x00000058400000 Subarea size Segment size 00000000000a3000 0000000008800000 Area #3 `skgm overhead' containing Subareas 3-3 Total size 0000000000001000 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 3 3 163840 0x000000584a3000 0x000000584a3000 Subarea size Segment size 0000000000001000 0000000008800000
OS Specific
Fixed Area
Variable Area
Redo Buffers
STOP
10
© 2005 Julian Dykejuliandyke.com
V$SGA Describes sizes of main components in SGA Used by SHOW SGA command in SQL*Plus
Name Value
Fixed Size 452044
Variable Size 83886080
Database Buffers 50331648
Redo Buffers 667648
SELECT name, value FROM v$sga;
Based from X$KSMSD X$KSMSD derived from ksmstv_ (ksmst) in Fixed SGA
11 © 2005 Julian Dykejuliandyke.com
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 cache Oracle 8.0 and above 2K, 4K, 8K, 16K and 32K cache Oracle 9.0.1 and above
12
© 2005 Julian Dykejuliandyke.com
Granules Introduced in Oracle 9.0.1
SGA divided into granules
In Oracle 9.2 granule size dependent on SGA_MAX_SIZE 4 mb SGA_MAX_SIZE <= 128 mb 16 mb SGA_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
13
© 2005 Julian Dykejuliandyke.com
Granules Pool parameters rounded up to nearest granule
Each pool occupies one or more granules
Different buffer caches held in separate granules
First "granule" contains Fixed SGA Granule directory Heap headers
Last "granule" contains Guard pages Redo buffer Operating system specific overhead Remaining space unused
14
© 2005 Julian Dykejuliandyke.com
GranulesSGA_MAX_SIZE = 128M
DB_CACHE_SIZE = 48M
JAVA_POOL_SIZE = 20M
LARGE_POOL_SIZE = 12M
SHARED_POOL_SIZE = 20M
128M
4M
4M
Note – shared pool size automatically increased from 20M to 32M
Buffer Pool 48M
Free 16M
Fixed SGA 4M
Large Pool 12M
Shared Pool 32M
Java Pool 20M
Redo Buffer 4M
STOP
15
© 2005 Julian Dykejuliandyke.com
Granule Operations The following pools can be dynamically resized
Pool Parameter Version
Shared Pool SHARED_POOL_SIZE 9.0.1 and above
Default DB_CACHE_SIZE 9.0.1 and above
2K DB_2K_CACHE_SIZE 9.0.1 and above
4K DB_4K_CACHE_SIZE 9.0.1 and above
8K DB_8K_CACHE_SIZE 9.0.1 and above
16K DB_16K_CACHE_SIZE 9.0.1 and above
32K DB_32K_CACHE_SIZE 9.0.1 and above
Keep DB_KEEP_CACHE_SIZE 9.0.1 and above
Recycle DB_RECYCLE_CACHE_SIZE 9.0.1 and above
Large Pool LARGE_POOL_SIZE 9.2.0 and above
Java Pool JAVA_POOL_SIZE 10.1 and above
Streams pool cannot be dynamically resized in Oracle 10.1
16
© 2005 Julian Dykejuliandyke.com
Granule Views The following views support dynamic memory management
Introduced in Oracle 9.2 V$SGA_DYNAMIC_COMPONENTS V$SGA_DYNAMIC_FREE_MEMORY V$SGA_CURRENT_RESIZE_OPS V$SGA_RESIZE_OPS
Not always reliable
Introduced in Oracle 10.1 V$SGAINFO
17
© 2005 Julian Dykejuliandyke.com
X$KSMGEIntroduced in Oracle 9.2Describes individual granules
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
GRANNUM NUMBER
GRANTYPE NUMBER
GRANSTATE VARCHAR2(16)
GRANFLAGS NUMBER
LOCALITY NUMBER
BASEADDR RAW(4)
GRANSIZE NUMBER
GRANNEXT NUMBER
GRANPREV NUMBER
INVALID (Free)ALLOCATED
Granule Address
Granule Size
Next granule ID
Previous granule ID
Granule ID
0 Free2 Shared Pool3 Large Pool4 Java Pool5 Buffer Pool
18
© 2005 Julian Dykejuliandyke.com
Granule Dumps Granules can be dumped using
ALTER SESSION SET EVENTS‘immediate trace name granulelist level <level>’
where <level> is
Heap Level
Null Granule 255
Home Granule 511
Shared Pool 767
Large Pool 1023
Java Pool 1279
Buffer Cache 1535
19
© 2005 Julian Dykejuliandyke.com
Fixed SGA Area containing all fixed variables Contains pointers to all other structures in SGA Variable name, type, address and size
determined when Oracle executable is linked Located at start of first granule of SGA
Fixed SGA
Granule Directory
Heap Headers
5001D9E8
5001DF50
50000000
STOP
20
© 2005 Julian Dykejuliandyke.com
X$KSMFSV Externalises name, type, address and size of all variables in
fixed SGA
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSMFSNAM VARCHAR2(64)
KSMFSTYP VARCHAR2(64)
KSMFSADR RAW(4)
KSMFSSIZ NUMBER
Name
Type
Address
Size
SGA can be dumped using
ORADEBUG FIXEDSGA
21
© 2005 Julian Dykejuliandyke.com
Global Area Dumps Global areas can be dumped using
ALTER SESSION SET EVENTS‘immediate trace name global_area level <level>’
where <level> is
Heap Level
PGA 1
SGA 2
PGA + SGA 3
UGA 4
PGA + UGA 5
SGA + UGA 6
PGA + SGA + UGA 7
More detail is included at levels 0x08 0x10 0x18 (OR)
22
© 2005 Julian Dykejuliandyke.com
X$KSMMEM Externalises contents of all locations in the SGA
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSMMMVAL RAW(4)Value
Address
Does not work on Windows platforms
23
© 2005 Julian Dykejuliandyke.com
Buffer Cache
Buffer Cache includes 12 x 4M granules
Each granule contains 500 buffers
Buffer Cache contains 6000 buffers
51400000
51800000
51C00000
52000000
52400000
52800000
52C00000
53000000
53400000
53800000
53C00000
54000000
DB_CACHE_SIZE = 48M DB_BLOCK_SIZE = 8192
Block Size
Buffers Per Granule
4mb 16mb
2048 1875 7503
4096 979 3916
8192 500 2002
16384 253 1012
32768 127 509STOP
24
© 2005 Julian Dykejuliandyke.com
Buffer Headers Each buffer has a buffer header In 9.2.0.4 buffer headers are 188 bytes Buffer headers are stored in same granule as buffers Buffer headers include
Replacement list Hash list Pointer to buffer
Buffer Headers
Granule
Buffers
STOP
25
© 2005 Julian Dykejuliandyke.com
X$BH Externalises buffer headers
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
HLADDR RAW(4)
BLSIZ NUMBER
NXT_HASH RAW(4)
PRV_HASH RAW(4)
NXT_REPL RAW(4)
PRV_REPL RAW(4)
TS# NUMBER
FILE# NUMBER
DBARFIL NUMBER
DBABLK NUMBER
OBJ NUMBER
BA RAW(4)
CR_SCN_BAS NUMBER
Hash List Address
Block Size
Hash List
Replacement List
Tablespace#
Absolute File Number
Relative File Number
Block Number
Object ID
Buffer Address
26
© 2005 Julian Dykejuliandyke.com
Shared Pool56400000
56800000
56C00000
57000000
57400000
57800000
57C00000
58000000
Shared Pool includes
Permanent Area
Segmented Arrays
Library Cache
Row Cache
Reserved Area
Shared Pool occupies
8 x 4M granules = 32M
SHARED_POOL_SIZE = 20M
STOP
27
© 2005 Julian Dykejuliandyke.com
V$SGASTAT Describes sizes of individual components in SGA
Pool Name Value
fixed sga 452044
buffer cache 50331648
log buffer 656384
shared pool enqueues 51680
shared pool sessions 91656
shared pool library cache 1480240
shared pool dictionary cache 1614976
shared pool free memory 19746760
large pool free memory 12582912
java pool free memory 20971520
SELECT pool, name, value FROM v$sgastat;
28
© 2005 Julian Dykejuliandyke.com
Permanent Areas
SELECT ksmchptr, ksmchsizFROM x$ksmspWHERE ksmchcls = 'perm';
Address Size
5641F000 3967868
5681F000 2718736
56AB6C10 905116
56C1F00 4063188
5701F000 4067328
56400000
56800000
56C00000
57000000
57400000
57800000
57C00000
58000000
Allocated at instance startup Contain structures such as
processes sessions segmented arrays
STOP
29
© 2005 Julian Dykejuliandyke.com
Sessions Array of sessions stored in shared pool permanent area Allocated at instance startup Number of elements specified by SESSIONS parameter In Oracle 9.2 each element is 2412 bytes Session array externalised by
X$KSUSE General information Used by V$SESSION
X$KSUSESTA Statistics Used by V$SESSTAT
X$KSUSECST Current Waits Used by V$SESSION_WAIT
30
© 2005 Julian Dykejuliandyke.com
Sessions
X$KSUSEV$SESSION
X$KSUSECSTV$SESSION_WAIT
X$KSUSESTAV$SESSTAT
Array ofPointers
struct ksusg
ksusga_
STOP
31
© 2005 Julian Dykejuliandyke.com
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
32
© 2005 Julian Dykejuliandyke.com
Segmented Arrays
SegmentedArrays
Call
Enqueues
EnqueueResources
SegmentedArray
HeaderSegmented
Array
SegmentedArray
Header
SegmentedArray
STOP
33
© 2005 Julian Dykejuliandyke.com
X$KSMDD Externalises segmented array headers
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
NAME VARCHAR2(30)
ELEMENTS_CHUNK NUMBER
ITEMS_PT NUMBER
INITENTRIES NUMBER
NUMENTRIES NUMBER
CURENTRIES NUMBER
NUMCHUNKS NUMBER
ELEMSIZE NUMBER
FLAGS NUMBER
HEAP RAW(4)
SECONDARY RAW(4)
Name of array
Address of parent heap
Number of chunks
34
© 2005 Julian Dykejuliandyke.com
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 2HeapHeader
Free List Chunks
STOP
35
© 2005 Julian Dykejuliandyke.com
Chunks Chunks contain
header body
Size of chunk header dependent on chunk type 16 bytes <= size <= 32 bytes
Chunks chained through extent
Chunks can be permanent recreatable freeable free
Extent
ExtentHeader
ChunkHeader
ChunkBody
STOP
36
© 2005 Julian Dykejuliandyke.com
X$KSMSP Externalises chunks in the shared pool
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSMCHIDX NUMBER
KSMCHDUR NUMBER
KSMCHCOM VARCHAR2(16)
KSMCHPTR RAW(4)
KSMCHSIZ NUMBER
KSMCHCLS VARCHAR2(8)
KSMCHTYP NUMBER
KSMCHPAR RAW(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
37
© 2005 Julian Dykejuliandyke.com
Heap Dumps Heaps can be dumped using
ALTER SESSION SET EVENTS‘immediate trace name heapdump level <level>’;
where <level> is
Heap Summary Detail
PGA 1 1025
SGA 2 2050
UGA 4 4100
CGA – Current Call 8 8200
CGA – User Call 16 16400
LGA – Large Pool 32 32800
38
© 2005 Julian Dykejuliandyke.com
Free List Heap free lists contain 255 buckets
Each bucket contains double linked list to free chunks
Bucket sizes increase in increments of 4 bytes - 16, 20, 24, 28, 32 ... 808, 812 increments of 64 bytes - 876, 940, 1004 ... 3948, 4012 then 4108, 8204, 16396, 32780, 65548
Reduces fragmentation
39
© 2005 Julian Dykejuliandyke.com
Free List Example
16
Heap Header
52 byte chunks
24 byte chunks20
24
28
32
36
40
44
48
52
56
60
64
Buckets
36 byte chunks
40
© 2005 Julian Dykejuliandyke.com
Subheaps Heaps can contain subheaps Objects can have up to 10 subheaps
SQL statements include subheaps 0 and 6
Subheaps consist of one or more extents Subheaps have heap headers
Subheap header format similar to heap header format Only one freelist containing all free space
SubheapHeader
FreeList
Extent 0 Extent 1 Extent 2
Chunk
41
© 2005 Julian Dykejuliandyke.com
Subheap Dumps In Oracle 9.0.1 and below to dump a subheap, first obtain the
address of the subheap and convert to decimal
0x56b95c0c = 1454988300
For a summary dump use
For a detailed dump add 1 to the address e.g.
ALTER SESSION SET EVENTS ‘immediate trace name heapdump_addr level 1, addr 0x56b95c0c’;
ALTER SESSION SET EVENTS ‘immediate trace name heapdump_addr level 2, addr 0x56b95c0c’;
ALTER SESSION SET EVENTS ‘immediate trace name heapdump_addr level 1454988300’;
ALTER SESSION SET EVENTS ‘immediate trace name heapdump_addr level 1454988301’;
In Oracle 9.2 and above to dump the subheap summary use
For a detailed dump use
42
© 2005 Julian Dykejuliandyke.com
Subheap Dumps Example - dump the SGA using
Chunk 56b94dc8 sz= 304 recreate "KGL handles " latch=0x56efd918Chunk 56b94ef8 sz= 560 freeable "library cache " ds=0x56b95c0cChunk 56b95128 sz= 540 recreate "KQR PO " latch=(nil)Chunk 56b95344 sz= 540 recreate "KQR PO " latch=0x56d719f4Chunk 56b95560 sz=1116 freeable "KGLS heap " ds=0x56b96d1cChunk 56b959bc sz= 20 free " "Chunk 56b959d0 sz= 560 recreate "library cache " latch=(nil) ds 56b95c0c sz=1120 ct= 2
56b94ef8 sz= 560Chunk 56b95c00 sz= 96 freeable "library cache "
Chunk 56b94dc8 sz= 304 recreate "KGL handles " latch=0x56efd918Chunk 56b94ef8 sz= 560 freeable "library cache " ds=0x56b95c0cChunk 56b95128 sz= 540 recreate "KQR PO " latch=(nil)Chunk 56b95344 sz= 540 recreate "KQR PO " latch=0x56d719f4Chunk 56b95560 sz=1116 freeable "KGLS heap " ds=0x56b96d1cChunk 56b959bc sz= 20 free " "Chunk 56b959d0 sz= 560 recreate "library cache " latch=(nil) ds 56b95c0c sz=1120 ct= 2
56b94ef8 sz= 560Chunk 56b95c00 sz= 96 freeable "library cache "
ALTER SESSION SET EVENTS ‘immediate trace name heapdump level 2’;
Dump subheap using
ALTER SESSION SET EVENTS ‘immediate trace name heapdump_addr level 1, addr 0x56b95c0c’;
43
© 2005 Julian Dykejuliandyke.com
Subheap DumpsHEAP DUMP heap name="library cache" desc=0x576193c4 extent sz=0x224 alt=32767 het=16 rec=9 flg=2 opc=2 parent=0x5000002c owner=0x5761826c nex=(nil) xsz=0x224EXTENT 0 addr=0x57615130 Chunk 57615138 sz= 312 perm "perm " alo=260 Chunk 57615270 sz= 76 freeable "kgltbtab " Chunk 576152bc sz= 76 freeable "kgltbtab " Chunk 57615308 sz= 76 freeable "kgltbtab "EXTENT 1 addr=0x57616a88 Chunk 57616a90 sz= 512 perm "perm " alo=512 Chunk 57616c90 sz= 28 free " "EXTENT 2 addr=0x57618254 Chunk 5761825c sz= 172 perm "perm " alo=172 Chunk 57618308 sz= 36 free " "Total heap size = 1288
FREE LISTS: Bucket 0 size=0 Chunk 57616c90 sz= 28 free " " Chunk 57618308 sz= 36 free " "Total free space = 64UNPINNED RECREATABLE CHUNKS (lru first):PERMANENT CHUNKS: Chunk 57615138 sz= 312 perm "perm " alo=260 Chunk 57616a90 sz= 512 perm "perm " alo=512 Chunk 5761825c sz= 172 perm "perm " alo=172Permanent space = 996
Extent 0
Extent 1
Extent 2
Free List
44
© 2005 Julian Dykejuliandyke.com
X$KSMHP Externalises chunks in a subheap
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSMCHDS RAW(4)
KSMCHCOM VARCHAR2(16)
KSMCHPTR RAW(4)
KSMCHSIZ NUMBER
KSMCHCLS VARCHAR2(8)
KSMCHTYP NUMBER
KSMCHPAR RAW(4)
KSMCHOWN RAW(4) Address of parent heap
Address of data segment
Description of chunk type
Address of chunk
Size including header
Class●Perm●Free
45
© 2005 Julian Dykejuliandyke.com
X$KSMHP
SQL> SELECT COUNT(*) FROM x$ksmhp;
0 rows
SQL> SELECT COUNT(*) FROM x$ksmhpWHERE ksmchds = HEXTORAW ('5755E798');
COUNT(*)-------- 1
SQL> SELECT kglobhd6 FROM x$kglobWHERE kglnaobj = 'SELECT SUM(c1) FROM t1'AND kglhdadr != kglhdpar;
KGLOBHD6--------5755E798
SQL> SELECT COUNT(*) FROM x$ksmhp;
COUNT(*) -------- 0
STOP
46
© 2005 Julian Dykejuliandyke.com
Library Cache Database objects
Tables Views Packages Functions
Shared cursors SQL statements Anonymous PL/SQL block Stored PL/SQL procedures and functions Java stored procedures Methods
47
© 2005 Julian Dykejuliandyke.com
Library Cache For example
SELECT SUM(c2)FROM t1WHERE c3 = 42AND c4 < 2004;
0 SELECT STATEMENT1 0 SORT (AGGREGATE)2 1 TABLE ACCESS (BY INDEX ROWID) OF 'T1'3 2 INDEX (RANGE SCAN) OF 'I2'
CREATE TABLE t1(
c1 NUMBER,c2 NUMBER,c3 NUMBER,c4 NUMBER
);
CREATE INDEX i1 ON t1 (c1);
CREATE INDEX i2 ON t1 (c3);
STOP
48
© 2005 Julian Dykejuliandyke.com
Library Cache
struct kgsms
ksmgsg_Heap
LibraryCache
KGLHD KGLHD KGLHD KGLHD
Anonymous List
KGLHD
KGLHD
KGLHD
KGLHD
512 x 1 wordpointers
256 x DLL headers
Library Cache Object Handle
512 x 256 = 131072 buckets
STOP
49
© 2005 Julian Dykejuliandyke.com
Library Cache Object - Parent
16 x 1 wordpointers
KGLHD
ParentObject
KGLNA
SELECT SUM (c2) FROM t1WHERE c3 = 42 AND c4 < 2004
ParentName
ChildHandle
KGLHD
Child 1
Child 2
Heap 0
KGLOB
X$KGLOB
ParentHandle
KGLHD
STOP
50
© 2005 Julian Dykejuliandyke.com
Library Cache Object - Child
KGLHD
ChildHandle
ChildObject
SELECTStatement
Heap 6
KGLOB
SubheapHeader
SubheapHeader
Heap 0
SubqueryHeader
Statisticsetc
X$KGLOB
STOP
51
© 2005 Julian Dykejuliandyke.com
Library Cache - Statement
SubqueryHeader
OperationExplain
PlanSORT
(AGGREGATE)
ExplainPlan
ExplainPlan
Operation TABLE ACCESS (BY INDEX ROWID)
Operation INDEX(RANGE SCAN)
STOP
52
© 2005 Julian Dykejuliandyke.com
Sort (Aggregate)
SORT (AGGREGATE)Output Columns
Column DefinitionObj =1234
Col=2
Column AliasAlias=C2
Expression
Function ExpressionOp=SUM
Column Expression
Expression
Variable
STOP
53
© 2005 Julian Dykejuliandyke.com
Table Access (By Index Rowid)
Column DefinitionObj =1234
Col=2
Column DefinitionObj =1234
Col=4
Column AliasAlias=C4
Expression
Function ExpressionOp=LT
Column Expression Constant Expression
ConstantValue=2004
ExpressionExpression
Variable
Variable
TABLE ACCESS (BY INDEX ROWID)Output
ColumnsPredicatec4 < 2004
Condition
Column DefinitionObj =1234
Col=ROWID
Table AliasAlias=T1
Column Expression
Expression
Variable
ROWIDExpression
STOP
54
© 2005 Julian Dykejuliandyke.com
Index (Range Scan)
Column DefinitionObj =1234
Col=ROWID
Column DefinitionObj =1234
Col=3
Column AliasAlias=C3
Expression Array
Expression
Function ExpressionOp=EQ
Column Expression Constant Expression
ConstantValue=42
ExpressionExpression
Variable
INDEX (RANGE SCAN)Output
ColumnsPredicate
c3 = 42
Variable
STOP
55
© 2005 Julian Dykejuliandyke.com
Shared Pool Reserved Area Area of memory reserved for large contiguous requests for
memory Reduces fragmentation in shared pool Only used if no space available in shared pool Summarised in V$SHARED_POOL_RESERVED
SHARED_POOL_RESERVED_SIZE specifies size of shared pool in bytes defaults to 5% of SHARED_POOL_SIZE
_SHARED_POOL_RESERVED_PCT specifies percentage of shared pool to reserve defaults to 5%
_SHARED_POOL_RESERVED_MIN_ALLOC specifies minimum chunk size e.g. 4400
56
© 2005 Julian Dykejuliandyke.com
X$KSMSPR Externalises address, size and class of all chunks in the
shared pool
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSMCHCOM VARCHAR2(16)
KSMCHPTR RAW(4)
KSMCHSIZ NUMBER
KSMCHCLS VARCHAR2(8)
KSMCHTYP NUMBER
KSMCHPAR RAW(4)
Comment● free memory● reserved_stopper
Address
Size in bytes
Class●R-free●R-freeable
57
© 2005 Julian Dykejuliandyke.com
Shared Pool Reserved AreaSELECT ksmchcom,ksmchptr,ksmchsiz,ksmchcls
FROM x$ksmsprORDER BY ksmchptr;
KSMCHCOM KSMCHPTR KSMCHSIZ KSMCHCLS
reserved_stopper 56400024 20 R-freeable
free memory 56400038 126900 R-free
reserved_stopper 5641EFEC 20 R-freeable
reserved_stopper 56800024 20 R-freeable
free memory 56800038 126900 R-free
reserved_stopper 5681EFEC 20 R-freeable
reserved_stopper 56C00024 20 R-freeable
free memory 56C00038 126900 R-free
reserved_stopper 56C1EFEC 20 R-freeable
reserved_stopper 57000024 20 R-freeable
KSMCHCOM KSMCHPTR KSMCHSIZ KSMCHCLS
reserved_stopper 56400024 20 R-freeable
free memory 56400038 126900 R-free
reserved_stopper 5641EFEC 20 R-freeable
reserved_stopper 56800024 20 R-freeable
free memory 56800038 126900 R-free
reserved_stopper 5681EFEC 20 R-freeable
reserved_stopper 56C00024 20 R-freeable
free memory 56C00038 126900 R-free
reserved_stopper 56C1EFEC 20 R-freeable
reserved_stopper 57000024 20 R-freeable
56400000
56800000
56C00000
57000000
57400000
57800000
57C00000
58000000
STOP
58
© 2005 Julian Dykejuliandyke.com
Log Buffer
2 x 4K guard pages (DEADFACE)
1288 x 512 byte blocks for redo
Each 512 byte includes 16 byte header
Usable redo = 1288 x 496 = 638848 bytes
LOG_BUFFER = 524288
Guard Page
Guard Page
Header - 16 bytes
Body - 496 bytes
58400000
584A2000
STOP
59
© 2005 Julian Dykejuliandyke.com
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
Recommended