Oracle 数据库1046事件
例子:
session 2:
SQL> connect test/test
Connected.
select * from v$mystat where rownum=1;
143
select b.spid,a.sid,a.serial# from v$session a,v$process b where a.paddr =b.addr and a.sid =143;
session 1: 针对对应的session,打开10046事件。
alter session set timed_statistics = true;
alter session set statistics_level=all;
alter session set max_dump_file_size = unlimited;
execute sys.dbms_system.set_ev(143,99,10046,12,''); /*打开LEVEL 12的10046事件,不打开12级的话,无法看到等待事件*/
session 2: 执行需要排查的SQL语句
update t_table01 set name='niko' where NO=4;
commit;
session 1:
execute sys.dbms_system.set_ev(143,99,10046,0,''); /*关闭10046事件*/
show parameter user
进入对应目录:
生成格式文件:
tkprof oracle03_ora_20052.trc oracle03_ora_20052.sql
查看生成的文件找到对应的SQL:
more oracle03_ora_20052.sql