oracle 10046其他用户会话

授权

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",共同学习,共同成长!!!





请使用浏览器的分享功能分享到微信等