欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

script:获取某张表上所有的DML操作

程序员文章站 2022-05-31 18:54:32
...

script:获取某张表上所有的DML操作本脚本from 老白的书 1 select /* ordered use_hash(d) use_hash(c) */ 2 c.kglnahsh hash_value, 3 sum(c.kglobt13) disk_reads, 4 sum(c.kglobt14) logical_reads, 5 sum(c.kglhdexc) executions, 6 c.kglnaobj sql_text

script:获取某张表上所有的DML操作 本脚本from 老白的书


1 select /*+ ordered use_hash(d) use_hash(c) */
2 c.kglnahsh hash_value,
3 sum(c.kglobt13) disk_reads,
4 sum(c.kglobt14) logical_reads,
5 sum(c.kglhdexc) executions,
6 c.kglnaobj sql_text
7 from
8 sys.x$kglob o,
9 sys.x$kgldp d,
10 sys.x$kglcursor c
11 where
12 o.inst_id = userenv('Instance') and
13 d.inst_id = userenv('Instance') and
14 c.inst_id = userenv('Instance') and
15 o.kglnaown = upper('hr') and
16 o.kglnaobj = upper('regions') and
17 d.kglrfhdl = o.kglhdadr and
18 c.kglhdadr = d.kglhdadr
19 group by
20 c.kglnaobj,c.kglnahsh
21* order by 3

HASH_VALUE DISK_READS LOGICAL_READS EXECUTIONS SQL_TEXT
---------- ---------- ------------- ---------- ----------------------------------------------------------
2859910006 0 20 1 select * from regions for update
485381962 5 30 1 delete regions where region_id=1
4202984667 11 66 1 select * from regions
1257077165 7 76 1 insert into regions select * from regions