[20210407]oradebug dump heapdump_addr.txt

lfree發表於2021-04-07

[20210407]oradebug dump heapdump_addr.txt

--//順便學習一下oradebug dump heapdump_addr。

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> select * from dept where deptno=20;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        20 RESEARCH       DALLAS

SCOTT@book> @ hash
HASH_VALUE SQL_ID        CHILD_NUMBER HASH_HEX
---------- ------------- ------------ ---------
  95129850 80baj2c2ur47u            0   5ab90fa

SYS@book> oradebug help dump
DUMP           <dump_name> <lvl> [addr]  Invoke named dump
 
2.測試:
SYS@book> @ sharepool/shp4 80baj2c2ur47u 0
TEXT                  KGLHDADR         KGLHDPAR         C40                                        KGLHDLMD   KGLHDPMD   KGLHDIVC KGLOBHD0         KGLOBHD6           KGLOBHS0   KGLOBHS6   KGLOBT16   N0_6_16        N20   KGLNAHSH KGLOBT03        KGLOBT09
--------------------- ---------------- ---------------- ---------------------------------------- ---------- ---------- ---------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
child handle address  000000007CD7D040 000000007D138148 select * from dept where deptno=20                1          0          1 000000007D138088 000000007DBF1B70       4552      12144       3067     19763      19763   95129850 80baj2c2ur47u          0
parent handle address 000000007D138148 000000007D138148 select * from dept where deptno=20                1          0          1 000000007CB47E98 00                     4720          0          0      4720       4720   95129850 80baj2c2ur47u      65535

SYS@book> @ tix
New tracefile_identifier=/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0013.trc
SYS@book> oradebug dump heapdump_addr 1 0x000000007D138088
Statement processed.

SYS@book> @ tix
New tracefile_identifier=/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0014.trc

SYS@book> oradebug dump heapdump_addr 2 0x000000007D138088
Statement processed.

--//tracefile_identifier=/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0013.trc
*** 2021-04-07 11:15:17.787
Processing Oradebug command 'dump heapdump_addr 1 0x000000007D138088'
******************************************************
HEAP DUMP heap name="KGLH0^5ab90fa"  desc=0x7d138088
 extent sz=0xfe8 alt=32767 het=56 rec=9 flg=2 opc=0
 parent=0x60001190 owner=0x7d138038 nex=(nil) xsz=0xfd0 heap=(nil)
 fl2=0x26, nex=(nil), dsxvers=1, dsxflg=0x0
 dsx first ext=0x7e127548
EXTENT 0 addr=0x7e127548
  Chunk        07e127558 sz=       80    perm      "perm           "  alo=80
  Chunk        07e1275a8 sz=     2592    perm      "perm           "  alo=1920
  Chunk        07e127fc8 sz=      600    free      "               "
  Chunk        07e128220 sz=      152    freeable  "kgltbtab       "
  Chunk        07e1282b8 sz=      152    freeable  "kgltbtab       "
  Chunk        07e128350 sz=      152    freeable  "kgltbtab       "
  Chunk        07e1283e8 sz=      152    freeable  "kgltbtab       "
  Chunk        07e128480 sz=      152    freeable  "kgltbtab       "
Total heap size    =     4032
FREE LISTS:
 Bucket 0 size=0
  Chunk        07e127fc8 sz=      600    free      "               "
  Chunk        07e127578 sz=        0    kghdsx
Total free space   =      600
UNPINNED RECREATABLE CHUNKS (lru first):
PERMANENT CHUNKS:
  Chunk        07e1275a8 sz=     2592    perm      "perm           "  alo=1920
  Chunk        07e127558 sz=       80    perm      "perm           "  alo=80
Permanent space    =     2672
******************************************************

*** 2021-04-07 11:15:17.788
Oradebug command 'dump heapdump_addr 1 0x000000007D138088' console output: <none>
*** TRACE CONTINUES IN FILE /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0014.trc ***
--//可以顯示堆描述符下chunk的情況。

--//tracefile_identifier=/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0014.trc
--//還轉儲了每個chunk的內容。

SYS@book> @ tix
New tracefile_identifier=/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0015.trc

SYS@book> oradebug dump heapdump_addr 1 0x000000007DBF1B70
Statement processed.

--//內容很多略。實際上輸出於查詢v$sql_shared_memory類似,tanel poder提供一個指令碼sqlmem.sql查詢:

SYS@book> @ sqlmem 80baj2c2ur47u
Show shared pool memory usage of SQL statement with SQL_ID 80baj2c2ur47u
CHILD_NUMBER SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM TYPECHECK_MEM
------------ ------------ -------------- ----------- -------------
           0        19763           5040        3816             0

TOTAL_SIZE   AVG_SIZE     CHUNKS ALLOC_CL CHUNK_TYPE STRUCTURE            FUNCTION             CHUNK_COM            HEAP_ADDR
---------- ---------- ---------- -------- ---------- -------------------- -------------------- -------------------- ----------------
      3416       3416          1 free              0                      free memory          free memory          000000007DBF1B70
       936        936          1 freeabl           0 ctxdef               kksLoadC             ctxdef:kksLoadC      000000007DBF1B70
       896        224          4 freeabl           0 kccdef               qkxrMem              kccdef: qkxrMem      000000007DBF1B70
       688        114          6 freeabl           0 opn                  qkexrInitO           opn: qkexrInitO      000000007DBF1B70
       536        536          1 freeabl           0 qerixs               rixalo               qerixs : rixalo      000000007DBF1B70
       400        400          1 freeabl           0 opixpop              kctdef               opixpop:kctdef       000000007DBF1B70
       400        400          1 freeabl           0 kctdef               qcdlgo               kctdef : qcdlgo      000000007DBF1B70
       368         40          9 freeabl           0 idndef               qcuAll               idndef : qcuAll      000000007DBF1B70
       360        360          1 freeabl           0 qertbs               qertbIAl             qertbs:qertbIAl      000000007DBF1B70
       280         56          5 freeabl           0 idndef*[]            qkex                 idndef*[]: qkex      000000007DBF1B70
       232        232          1 freeabl           0 pqctx                kkfdParal            pqctx:kkfdParal      000000007DBF1B70
       200         40          5 freeabl           0                      kggsmInitCompac      kggsmInitCompac      000000007DBF1B70
       160         80          2 freeabl           0                      qertbAllocatePa      qertbAllocatePa      000000007DBF1B70
       152        152          1 freeabl           0 qcctx                kkmqccr              qcctx : kkmqccr      000000007DBF1B70
       152        152          1 freeabl           0 kafco                qkacol               kafco : qkacol       000000007DBF1B70
       144        144          1 freeabl           0                      kggsmCommonInit      kggsmCommonInit      000000007DBF1B70
       144         48          3 freeabl           0 qeSel                qkxrXfor             qeSel: qkxrXfor      000000007DBF1B70
       136        136          1 freeabl           0 audRegFro            audta                audRegFro:audta      000000007DBF1B70
       128        128          1 freeabl           0 qeeOpt               qeesCre              qeeOpt: qeesCre      000000007DBF1B70
       128         64          2 freeabl           0 kksol                kkscuf               kksol : kkscuf       000000007DBF1B70
       120        120          1 freeabl           0 kafco[]              qkaPru               kafco[]: qkaPru      000000007DBF1B70
       112        112          1 freeabl           0                      KGHSC_ALLOC_BUF      KGHSC_ALLOC_BUF      000000007DBF1B70
       104        104          1 freeabl           0 opiprwd              opitc                opiprwd : opitc      000000007DBF1B70
       104         52          2 freeabl           0 qeeRwo               qeeCrea              qeeRwo: qeeCrea      000000007DBF1B70
        96         96          1 freeabl           0 qkaapd               qkaqkn               qkaapd : qkaqkn      000000007DBF1B70
        88         88          1 freeabl           0 ctxPlanSig           qksc                 ctxPlanSig:qksc      000000007DBF1B70
        80         40          2 freeabl           0 qeKey[]              qkxrXf               qeKey[]: qkxrXf      000000007DBF1B70
        80         80          1 freeabl           0 ctxqrol              kkqsr                ctxqrol : kkqsr      000000007DBF1B70
        80         80          1 freeabl           0 qcpctx               kkmqccr              qcpctx: kkmqccr      000000007DBF1B70
        80         80          1 perm              0                      permanent memor      permanent memor      000000007DBF1B70
        80         40          2 freeabl           0 chedef               qcuatc               chedef : qcuatc      000000007DBF1B70
        80         80          1 freeabl           0 kkpoxgii             Alloc                kkpoxgii: Alloc      000000007DBF1B70
        80         40          2 freeabl           0                      qesmaInitTblCtx      qesmaInitTblCtx      000000007DBF1B70
        80         80          1 freeabl           0 kggsmInit            sm                   kggsmInit:sm         000000007DBF1B70
        72         72          1 freeabl           0 qksmm                qksmmCs              qksmm: qksmmCs       000000007DBF1B70
        72         72          1 freeabl           0 qcsctx               kkmqccr              qcsctx: kkmqccr      000000007DBF1B70
        72         72          1 freeabl           0                      qesmaInitIdxCtx      qesmaInitIdxCtx      000000007DBF1B70
        64         64          1 freeabl           0 cxach                opiSem               cxach : opiSem       000000007DBF1B70
        64         64          1 freeabl           0 kksol                kksnsg               kksol : kksnsg       000000007DBF1B70
        64         64          1 freeabl           0                      unmdef in opipr      unmdef in opipr      000000007DBF1B70
        56         56          1 freeabl           0 qcmemctx             kkmq                 qcmemctx : kkmq      000000007DBF1B70
        56         56          1 freeabl           0 kggac                kggacCre             kggac: kggacCre      000000007DBF1B70
        48         48          1 freeabl           0 qksrcMarkQB          qks                  qksrcMarkQB:qks      000000007DBF1B70
        48         48          1 freeabl           0 kksoff               opitca               kksoff : opitca      000000007DBF1B70
        48         48          1 freeabl           0 qctctx               kkmqccr              qctctx: kkmqccr      000000007DBF1B70
        48         48          1 freeabl           0 ktamd                ktagmd               ktamd : ktagmd       000000007DBF1B70
        40         40          1 freeabl           0 qcptgc               kkmqccr              qcptgc: kkmqccr      000000007DBF1B70
        40         40          1 freeabl           0 xplGenXpl            planL                xplGenXpl:planL      000000007DBF1B70
        40         40          1 freeabl           0 qkaEnableWide        c                    qkaEnableWide:c      000000007DBF1B70
        32         32          1 freeabl           0 kobjn                kkdcchs              kobjn : kkdcchs      000000007DBF1B70
        32         32          1 freeabl           0 ub1[]                qkexrXfo             ub1[]: qkexrXfo      000000007DBF1B70
        32         32          1 freeabl           0 opixfalo             froaty               opixfalo:froaty      000000007DBF1B70
        32         32          1 freeabl           0 kafco*               qkanin               kafco* : qkanin      000000007DBF1B70
        32         32          1 freeabl           0 kafco                rixalo               kafco : rixalo       000000007DBF1B70
        32         32          1 freeabl           0 opixfalo             ctxkct               opixfalo:ctxkct      000000007DBF1B70
55 rows selected.
--//HEAP_ADDR = 0x000000007DBF1B70,實際上就是堆6的資訊。只不過彙總罷了。

SYS@book> @ tix
New tracefile_identifier=/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0016.trc

SYS@book> oradebug dump heapdump_addr 1 0x000000007D138148
Statement processed.
--//這樣輸入不行。最後的地址只能是ds的地址。

Processing Oradebug command 'dump heapdump_addr 1 0x000000007D138148'
******************************************************
HEAP DUMP heap name=""  desc=0x7d138148
 extent sz=0x80528f30 alt=0 het=0 rec=1 flg=0 opc=0
 parent=0x80528f30 owner=0x7dbf14b0 nex=0x10000 xsz=0x0 heap=0x10000
 fl2=0x0, nex=0x10000
EXTENT 0 addr=0x7d1382a0
ERROR extent at 0x7d1382a0 contains wrong ds 0xdab00042e8ec445e
***** Dump of memory around addr 0x7d1382a0:


--//tanel poder提供一個指令碼分析:

$ ./tpt/heapdump_analyzer /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0013.trc

  -- Heapdump Analyzer v1.00 by Tanel Poder ( )

  Total_size #Chunks  Chunk_size,        From_heap,       Chunk_type,  Alloc_reason
  ---------- ------- ------------ ----------------- ----------------- -----------------
        2592       1       2592 ,    KGLH0^5ab90fa,             perm,  perm
         760       5        152 ,    KGLH0^5ab90fa,         freeable,  kgltbtab
         600       1        600 ,    KGLH0^5ab90fa,             free,
          80       1         80 ,    KGLH0^5ab90fa,             perm,  perm

$ ./tpt/heapdump_analyzer /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0014.trc

  -- Heapdump Analyzer v1.00 by Tanel Poder ( )

  Total_size #Chunks  Chunk_size,        From_heap,       Chunk_type,  Alloc_reason
  ---------- ------- ------------ ----------------- ----------------- -----------------
        2592       1       2592 ,    KGLH0^5ab90fa,             perm,  perm
         760       5        152 ,    KGLH0^5ab90fa,         freeable,  kgltbtab
         600       1        600 ,    KGLH0^5ab90fa,             free,
          80       1         80 ,    KGLH0^5ab90fa,             perm,  perm

$ ./tpt/heapdump_analyzer /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_34519_0015.trc

  -- Heapdump Analyzer v1.00 by Tanel Poder ( )

  Total_size #Chunks  Chunk_size,        From_heap,       Chunk_type,  Alloc_reason
  ---------- ------- ------------ ----------------- ----------------- -----------------
        3416       1       3416 ,     SQLA^5ab90fa,             free,
         936       1        936 ,     SQLA^5ab90fa,         freeable,  ctxdef:kksLoadC
         896       4        224 ,     SQLA^5ab90fa,         freeable,  kccdef: qkxrMem
         600       5        120 ,     SQLA^5ab90fa,         freeable,  opn: qkexrInitO
         536       1        536 ,     SQLA^5ab90fa,         freeable,  qerixs : rixalo
         400       1        400 ,     SQLA^5ab90fa,         freeable,  opixpop:kctdef
         400       1        400 ,     SQLA^5ab90fa,         freeable,  kctdef : qcdlgo
         360       1        360 ,     SQLA^5ab90fa,         freeable,  qertbs:qertbIAl
         320       8         40 ,     SQLA^5ab90fa,         freeable,  idndef : qcuAll
         280       5         56 ,     SQLA^5ab90fa,         freeable,  idndef*[]: qkex
         232       1        232 ,     SQLA^5ab90fa,         freeable,  pqctx:kkfdParal
         160       2         80 ,     SQLA^5ab90fa,         freeable,  qertbAllocatePa
         152       1        152 ,     SQLA^5ab90fa,         freeable,  qcctx : kkmqccr
         152       1        152 ,     SQLA^5ab90fa,         freeable,  kafco : qkacol
         144       3         48 ,     SQLA^5ab90fa,         freeable,  qeSel: qkxrXfor
         144       1        144 ,     SQLA^5ab90fa,         freeable,  kggsmCommonInit
         136       1        136 ,     SQLA^5ab90fa,         freeable,  audRegFro:audta
         128       2         64 ,     SQLA^5ab90fa,         freeable,  kksol : kkscuf
         128       1        128 ,     SQLA^5ab90fa,         freeable,  qeeOpt: qeesCre
         120       1        120 ,     SQLA^5ab90fa,         freeable,  kafco[]: qkaPru
         112       1        112 ,     SQLA^5ab90fa,         freeable,  KGHSC_ALLOC_BUF
         104       1        104 ,     SQLA^5ab90fa,         freeable,  opiprwd : opitc
          96       1         96 ,     SQLA^5ab90fa,         freeable,  qkaapd : qkaqkn
          88       1         88 ,     SQLA^5ab90fa,         freeable,  opn: qkexrInitO
          88       1         88 ,     SQLA^5ab90fa,         freeable,  ctxPlanSig:qksc
          80       2         40 ,     SQLA^5ab90fa,         freeable,  qesmaInitTblCtx
          80       2         40 ,     SQLA^5ab90fa,         freeable,  qeKey[]: qkxrXf
          80       2         40 ,     SQLA^5ab90fa,         freeable,  kggsmInitCompac
          80       2         40 ,     SQLA^5ab90fa,         freeable,  chedef : qcuatc
          80       1         80 ,     SQLA^5ab90fa,             perm,  perm
          80       1         80 ,     SQLA^5ab90fa,         freeable,  qcpctx: kkmqccr
          80       1         80 ,     SQLA^5ab90fa,         freeable,  kkpoxgii: Alloc
          80       1         80 ,     SQLA^5ab90fa,         freeable,  kggsmInit:sm
          80       1         80 ,     SQLA^5ab90fa,         freeable,  ctxqrol : kkqsr
          72       1         72 ,     SQLA^5ab90fa,         freeable,  qksmm: qksmmCs
          72       1         72 ,     SQLA^5ab90fa,         freeable,  qesmaInitIdxCtx
          72       1         72 ,     SQLA^5ab90fa,         freeable,  qcsctx: kkmqccr
          64       2         32 ,     SQLA^5ab90fa,         freeable,  kggsmInitCompac
          64       1         64 ,     SQLA^5ab90fa,         freeable,  unmdef in opipr
          64       1         64 ,     SQLA^5ab90fa,         freeable,  kksol : kksnsg
          64       1         64 ,     SQLA^5ab90fa,         freeable,  cxach : opiSem
          56       1         56 ,     SQLA^5ab90fa,         freeable,  qeeRwo: qeeCrea
          56       1         56 ,     SQLA^5ab90fa,         freeable,  qcmemctx : kkmq
          56       1         56 ,     SQLA^5ab90fa,         freeable,  kggsmInitCompac
          56       1         56 ,     SQLA^5ab90fa,         freeable,  kggac: kggacCre
          48       1         48 ,     SQLA^5ab90fa,         freeable,  qksrcMarkQB:qks
          48       1         48 ,     SQLA^5ab90fa,         freeable,  qeeRwo: qeeCrea
          48       1         48 ,     SQLA^5ab90fa,         freeable,  qctctx: kkmqccr
          48       1         48 ,     SQLA^5ab90fa,         freeable,  ktamd : ktagmd
          48       1         48 ,     SQLA^5ab90fa,         freeable,  kksoff : opitca
          48       1         48 ,     SQLA^5ab90fa,         freeable,  idndef : qcuAll
          40       1         40 ,     SQLA^5ab90fa,         freeable,  xplGenXpl:planL
          40       1         40 ,     SQLA^5ab90fa,         freeable,  qkaEnableWide:c
          40       1         40 ,     SQLA^5ab90fa,         freeable,  qcptgc: kkmqccr
          32       1         32 ,     SQLA^5ab90fa,         freeable,  ub1[]: qkexrXfo
          32       1         32 ,     SQLA^5ab90fa,         freeable,  opixfalo:froaty
          32       1         32 ,     SQLA^5ab90fa,         freeable,  opixfalo:ctxkct
          32       1         32 ,     SQLA^5ab90fa,         freeable,  kobjn : kkdcchs
          32       1         32 ,     SQLA^5ab90fa,         freeable,  kafco : rixalo
          32       1         32 ,     SQLA^5ab90fa,         freeable,  kafco* : qkanin

3.總結:
--//oradebug dump heapdump_addr [12] 0xaddr,後面的地址只能是ds描述符地址。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2766828/,如需轉載,請註明出處,否則將追究法律責任。

相關文章