Event 10046 – Enable SQL Statement Trace

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:434

Event 10046 - Enable SQL Statement Trace

This event can be used to dump SQL statements executed by a session with execution plans and statistics. Bind variable and wait statistics can optionally be included. Level 12 is the most detailed.
For example

1.使用触发器
create or replace trigger logon_trigger
after logon on database
begin
if (user='PAUL') then
execute immediate
'alter session set events ''10046 trace name context forever,level 12''';
end if;
end;

2.直接在sqlplus下使用命令
ALTER SESSION SET EVENTS '10046 trace name context forever, level 12';
关闭10046事件用以下命令:
alter session set events’10046 trace name context off’;

Level Action
1 Print SQL statements, execution plans and execution statistics
4 As level 1 plus bind variables
8 As level 1 plus wait statistics
12 As level 1 plus bind variables and wait statistics

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】