授权
conn /as sysdba
grant execute on dbms_system to chen;
首先查看要跟踪用户的sid,serial#
select sid,serial#,username from v$session where username is not null;
开启跟踪
SQL>execute sys.dbms_system.set_ev(7,36,10046,12,'');
执行语句
create table aa(id number;
alter table aa add(sal number);
drop table aa;
关闭10046追踪
SQL>execute sys.dbms_system.set_ev(7,36,10046,0,'');
当退出当前会话的时候,Oracle就会将追踪的结果写入到trace文件目录
使用Oracle提供的tkprof来格式化打开追踪文件,进行分析,如下:
tkprof ora_2229_10046.trc 888.trc
vim 888.trc
欢迎关注我的微信公众号"IT小Chen",共同学习,共同成长!!!


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