ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Event 10046 - Enable SQL Statement Trace

Event 10046 - Enable SQL Statement Trace

原创 Linux操作系统 作者:paulyibinyi 时间:2008-01-09 11:31:48 0 删除 编辑

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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-120040/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
oracle 10g ocm oracle 10g/11g/12c ocp aix 6.1 administrator,ogg expert,ITSS 技术交流群 201703254 微信公众号 paulyibin 探讨技术,开心工作 电话 13719354869 ,深入研究数据库和开始研究big data

注册时间:2007-12-11

  • 博文量
    902
  • 访问量
    6512163