Taking HeapDumps: Heapdumps可以在当前会话通过使用命令alter system set events或者通过oradebug events命令.Heapdumps将会被写成一个trace文件到进程dump的目录下面(udump),它所包含的信息跟相应的表X$相同.
事件的语法是IMMEDIATE TRACE NAME HEAPDUMP LEVEL n. LEVEL的值可以是如下:1,2,4,8,32.这些值分别对应DUMP出来的信息是PGA,SGA,UGA,CGA,LARGE POOL.
Subheap dump事件的语法是IMMEDIATE TRACE NAME HEAPDUMP_ADDR LEVEL n. n是一个十六位的subheap地址描述符.这些地址可以从KSM X$表中的字段KSMCHPAR得到,也可以从heapdump的文件中的字符串ds=得到
SQL>ALTER SESSION SET TRACEFILE_IDENTIFIER=TEST
SQL>ALTER SESSION SET EVENTS ‘IMMEDIATE TRACE NAME HEAPDUMP LEVEL 1’;
然后到$ORACLE_HOME/ADMIN/UDUMP下找到一个文件名含有TEST的文件用记事本打开,DUMP出来的文件大概如下:
*** 2004-11-30 10:42:09.000
******************************************************
HEAP DUMP heap name="pga heap" desc=067D1FE8---红色可以看到我们DUMP的是哪个HEAP,这里DUMP的PGA.
extent sz=0x213c alt=84 het=32767 rec=0 flg=2 opc=2
parent=00000000 owner=00000000 nex=00000000 xsz=0x25b8
EXTENT 0 addr=07BEB9A4---EXTENT号以及它的地址
Chunk 7beb9ac sz= 9648 freeable "kcrr kcrrpdi ar"
Chunk 7beb9ac---Chunk地址
sz= 9648---这个Chunk的SIZE,以bytes为单位.
freeable----这个Chunk的类型
"kcrr kcrrpdi ar"----这个Chunk的用处描述
EXTENT 1 addr=07BE9854
Chunk 7be985c sz= 8500 perm "perm " alo=7524
EXTENT 2 addr=07BE7474
Chunk 7be747c sz= 9156 freeable "Fixed Uga "
EXTENT 3 addr=07BE5324
Chunk 7be532c sz= 3764 perm "perm " alo=3764
Chunk 7be61e0 sz= 2788 freeable "Alloc environm " ds=07B6ADF4
ds=07B6ADF4-----这个是前面讲到的Subheapdump的level,subheap的地址描述
Chunk 7be6cc4 sz= 540 freeable "kopolal dvoid "
Chunk 7be6ee0 sz= 288 freeable "kopolal dvoid "
Chunk 7be7000 sz= 220 freeable "kopolal dvoid "
Chunk 7be70dc sz= 900 freeable "kopolal dvoid "
EXTENT 4 addr=07BE31D4
Chunk 7be31dc sz= 8440 perm "perm " alo=8440
Chunk 7be52d4 sz= 60 free " "
EXTENT 5 addr=07BE1084
Chunk 7be108c sz= 7096 perm "perm " alo=7096
Chunk 7be2c44 sz= 1140 perm "perm " alo=1140
Chunk 7be30b8 sz= 28 free " "
Chunk 7be30d4 sz= 36 freeable "koh-kghu call h"
Chunk 7be30f8 sz= 200 freeable "PLS cca hp desc"
EXTENT 6 addr=07BB0034
Chunk 7bb003c sz= 3052 perm "perm " alo=3052
Chunk 7bb0c28 sz= 404 perm "perm " alo=404
Chunk 7bb0dbc sz= 56 free " "
Chunk 7bb0df4 sz= 92 freeable "joxp heap "
Chunk 7bb0e50 sz= 36 freeable "external name "
Chunk 7bb0e74 sz= 36 freeable "kzsna:login nam"
Chunk 7bb0e98 sz= 17012 freeable "ksm stack "
EXTENT 7 addr=07B68D34
Chunk 7b68d3c sz= 2000 perm "perm " alo=2000
Chunk 7b6950c sz= 152 perm "perm " alo=152
Chunk 7b695a4 sz= 116 free " "
Chunk 7b69618 sz= 540 freeable "kopolal dvoid "
Chunk 7b69834 sz= 92 freeable "KSFQ heap descr"
Chunk 7b69890 sz= 16 freeable "KSFH indicator "
Chunk 7b698a0 sz= 4144 recreate "Alloc environm " latch=00000000
ds 7b6adf4 sz= 6932 ct= 2
7be61e0 sz= 2788
Chunk 7b6a8d0 sz= 1424 freeable "kpuinit env han"
Total heap size = 81976----这个heap的SIZE,应该是以kb为单位.
FREE LISTS:-----这个PGA Free Lists的一些信息
Bucket 0 size=44---Bucket号以及其对应的Free Chunks SIZE,这个SIZE以bytes为单位.
Chunk 7bb0dbc sz= 56 free " "
Chunk 7be52d4 sz= 60 free " "
Chunk 7be30b8 sz= 28 free " "
Bucket 1 size=76
Bucket 2 size=96
Chunk 7b695a4 sz= 116 free " "
查看本文来源