Each heap may have one or more subheaps. These can be dumped using the command
ALTER SESSION SET EVENTS
'immediate trace name heapdump_addr level level';
where the level is the address of the subheap.
The syntax for this command changed in Oracle 9.2
Oracle 9.0.1 and below |
Oracle 9.2.0 and above |
Oracle 9.0.1 and below
For Oracle 9.0.1 and below a summary dump is obtained by setting the level to the decimal value of the address. A detailed dump is obtained by adding 1 to the decimal value of the address.
For example to dump the subheap at address 0x8057eb78, first convert the address to decimal (2153245560)
The subheap address can be found in the heapdump, for example
ds=0x8057eb78
For a summary dump use
ALTER SESSION SET EVENTS
'immediate trace name heapdump_addr level 2153245560';
For a detailed dump, add 1 to the address e.g.
ALTER SESSION SET EVENTS
'immediate trace name heapdump_addr level 2153245561';
Oracle 9.2.0 and above
In Oracle 9.2 and above, for a summary dump
ALTER SESSION SET EVENTS
'immediate trace name heapdump_addr level 1, addr 2153245560';
The following ORADEBUG command has the same effect
ORADEBUG DUMP HEAPDUMP_ADDR 1 2153245560
In Oracle 9.2 and above, for a detailed dump
ALTER SESSION SET EVENTS
'immediate trace name heapdump_addr level 2, addr 2153245560';
Note that in Oracle 9.2 it is no longer necessary to add 1 to the address
The following ORADEBUG command has the same effect
ORADEBUG DUMP HEAPDUMP_ADDR 2 2153245560
A SQL statement child cursor contains two subheaps, heap 0 and heap 6. The addresses for the subheaps is reported by the X$KGLOB object for the child cursor (not the parent cursor). Among other places the child cursor address is externalized in the CHILD_ADDRESS column in V$SQL.
For example if the child cursor is 0x20F07A88 then the addresses of subheaps 0 and 6 can be determined using
SELECT kglobhd0, kglobhd6 FROM x$kglob WHERE kglhdadr = '20F07A88'; KGLOBHD0 KGLOBHD6 -------- -------- 24F675A0 20FB94E4
In Oracle 11.2 (and possibly lower versions) it is possible to specify the address in hexadecimal
ALTER SESSION SET EVENTS
'immediate trace name heapdump_addr level 2, addr 0x24F675A0';
http://www.juliandyke.com/Diagnostics/Dumps/HEAPDUMP_ADDR.html