1. 首页 > ITPUX技术网 > 正文

Event 10046 – Enable SQL Statement Trace

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

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息