科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航



ZDNet>软件频道>数据库-zhiding>获得Oracle各内存段的内部信息

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

  Taking HeapDumps:      Heapdumps可以在当前会话通过使用命令alter system set events或者通过oradebug events命令.Heapdumps将会被写成一个trace文件到进程dump的目录

来源:中国IT实验室 2007年10月07日

关键字:ORACLE 数据库 优化


  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   "        "

查看本文来源


  Bucket 3 size=140
  
  Bucket 4 size=236
  
  Bucket 5 size=268
  
  Bucket 6 size=524
  
  Bucket 7 size=1036
  
  Bucket 8 size=2060
  
  Bucket 9 size=4108
  
  Bucket 10 size=8204
  
  Bucket 11 size=16396
  
  Bucket 12 size=32780
  
  Bucket 13 size=65548
  
  Bucket 14 size=131084
  
  Bucket 15 size=262156
  
  Bucket 16 size=524300
  
  Bucket 17 size=2097164
  
  Total free space  =   260---以kb为单位.
  
  UNPINNED RECREATABLE CHUNKS (lru first):
  
  PERMANENT CHUNKS:
  
  Chunk 7be985c sz=   8500  perm   "perm      " alo=7524
  
  Chunk 7be532c sz=   3764  perm   "perm      " alo=3764
  
  Chunk 7b6950c sz=   152  perm   "perm      " alo=152
  
  Chunk 7bb0c28 sz=   404  perm   "perm      " alo=404
  
  Chunk 7be31dc sz=   8440  perm   "perm      " alo=8440
  
  Chunk 7be2c44 sz=   1140  perm   "perm      " alo=1140
  
  Chunk 7bb003c sz=   3052  perm   "perm      " alo=3052
  
  Chunk 7be108c sz=   7096  perm   "perm      " alo=7096
  
  Chunk 7b68d3c sz=   2000  perm   "perm      " alo=2000
  
  Permanent space  =  34548---以kb为单位.
  
  ******************************************************
  
  ******************************************************
  
  HEAP DUMP heap name="top call heap" desc=067D46D8
  
  heap name="top call heap"----这个PGA中的CGA信息
  
  extent sz=0x213c alt=92 het=32767 rec=0 flg=2 opc=3
  
  parent=00000000 owner=00000000 nex=00000000 xsz=0xfffc
  
  EXTENT 0 addr=07BF0004
  
  Chunk 7bf000c sz=  32828  perm   "perm      " alo=136
  
  Chunk 7bf8048 sz=  30552  free   "        "
  
  Chunk 7bff7a0 sz=   1072  recreate "callheap    " latch=00000000
  
  ds 67d3d00 sz=   1072 ct=    1
  
  Chunk 7bffbd0 sz=   1072  recreate "callheap    " latch=00000000
  
  ds 67d3d68 sz=   1072 ct=    1
  
  Total heap size  =  65524
  
  FREE LISTS:
  
  Bucket 0 size=44
  
  Bucket 1 size=76
  
  Bucket 2 size=96
  
  Bucket 3 size=140
  
  Bucket 4 size=236
  
  Bucket 5 size=268
  
  Bucket 6 size=524
  
  Bucket 7 size=1036
  
  Bucket 8 size=2060
  
  Bucket 9 size=4108
  
  Bucket 10 size=8204
  
  Bucket 11 size=16396
  
  Chunk 7bf8048 sz=  30552  free   "        "
  
  Bucket 12 size=32780
  
  Bucket 13 size=65548
  
  Bucket 14 size=131084
  
  Bucket 15 size=262156
  
  Bucket 16 size=524300
  
  Bucket 17 size=2097164
  
  Total free space  =  30552
  
  UNPINNED RECREATABLE CHUNKS (lru first):
  
  PERMANENT CHUNKS:
  
  Chunk 7bf000c sz=  32828  perm   "perm      " alo=136
  
  Permanent space  =  32828
  
  ******************************************************
  
  ******************************************************
  
  HEAP DUMP heap name="top uga heap" desc=067D47F8
  
  heap name="top uga heap"---这个PGA中的UGA信息
  
  extent sz=0xffdc alt=92 het=32767 rec=0 flg=2 opc=3
  
  parent=00000000 owner=00000000 nex=00000000 xsz=0x1fffc
  
  EXTENT 0 addr=07C00004
  
  Chunk 7c0000c sz=    48  free   "        "
  
  Chunk 7c0003c sz=  65476  recreate "session heap  " latch=00000000
  
  ds 7be7490 sz=  65476 ct=    1
  
  Total heap size  =  65524
  
  FREE LISTS:
  
  Bucket 0 size=44
  
  Chunk 7c0000c sz=    48  free   "        "
  
  Bucket 1 size=76
  
  Bucket 2 size=96
  
  Bucket 3 size=140
  
  Bucket 4 size=236
  
  Bucket 5 size=268
  
  Bucket 6 size=524
  
  Bucket 7 size=1036
  
  Bucket 8 size=2060
  
  Bucket 9 size=4108
  
  Bucket 10 size=8204
  
  Bucket 11 size=16396
  
  Bucket 12 size=32780
  
  Bucket 13 size=65548
  
  Bucket 14 size=131084
  
  Bucket 15 size=262156
  
  Bucket 16 size=524300
  
  Bucket 17 size=2097164
  
  Total free space  =    48
  
  UNPINNED RECREATABLE CHUNKS (lru first):
  
  PERMANENT CHUNKS:
  
  Permanent space  =    0
  
  ******************************************************
  
  这上面有一些还没搞清楚.所以在这里就没做解释.

查看本文来源