一条SQL语句执行后,如何找到其在shared pool里占用的chunks,做了一个简单的测试:
---先清空shared pool
alter system flush shared_pool;
---执行sql语句
select * from scott.t1 where username='SYS';
USERNAME USER_ID CREATED
------------------------------ ---------- -----------------
SYS 0 20141110 21:16:12
---这时我们可以看到一个父游标和一个子游标生成了
set linesize 180 pagesize 100 word wrapped
col kglnaobj format a100 word_wrapped
select kglhdadr,kglhdpar,kglnaobj from x$kglob where kglnaobj like 'select * from scott.t1 where username=%';
KGLHDADR KGLHDPAR KGLNAOBJ
---------------- ---------------- ----------------------------------------------------------------------------------------------------
07000001B84F85E8 07000001B8670420 select * from scott.t1 where username='SYS' >>>>父游标heap 0所在的chunk信息
。。。。省略部分内容
Chunk 700000195d40f60 sz= 4096 recreate "KGLH0^f6439b10 " latch=0 >>>>>>>父游标heap 0描述符所在的chunk信息
。。。。省略部分内容
Chunk 70000019bb13788 sz= 240 freeable "KGLDA " heap 6所在chunk地址:0700000199EA5AB0、0700000199E9FAB0(类型为SQLA,x$ksmsp)
: