sqlplus scott/aaaaaa
create table test_abc(id int);
insert into test_abc select level from dual connect by level<=1000000;
commit;
exitsqlplus scott/aaaaaa
alter session set tracefile_identifier='10046_lei_highgo';
alter session set timed_statistics = true;
alter session set statistics_level=all;
alter session set max_dump_file_size = unlimited;
alter session set events '10046 trace name context forever,level 12';
select * from test_abc where rownum<100;
Alter session set events '10046 trace name context off';
上述命令,生成的trace名字是ecton1_ora_20829_10046_lei_highgo.trc.
用tkprof命令来格式化该trc文件:
tkprof ecton1_ora_20829_10046_lei_highgo.trc 20829_10046_lei_highgo.output
本文介绍如何在Oracle数据库中使用SQL Trace功能追踪SQL执行情况,并通过TKProf工具进行性能分析。首先创建了一个名为test_abc的大表,并对表进行查询操作;接着启用10046事件进行详细跟踪,最后利用tkprof命令将追踪文件转换为可读报告。
1605

被折叠的 条评论
为什么被折叠?



