时间:2021-07-01 10:21:17 帮助过:28人阅读
SID SERIAL# USERNAME
---------- ---------- ------------------------------
8 2041 SYS
9 437 EYGLE
执行跟踪:
SQL> exec dbms_system.set_ev(9,437,10046,8,‘eygle‘);
PL/SQL procedure successfully completed.
结束跟踪:
SQL> exec dbms_system.set_ev(9,437,10046,0,‘eygle‘);
PL/SQL procedure successfully completed.
(c) 获取跟踪文件
以上生成的跟踪文件位于user_dump_dest目录中,位置及文件名可以通过以下SQL查询获得:
SQL> select
2 d.value||‘/‘||lower(rtrim(i.instance, chr(0)))||‘_ora_‘||p.spid||‘.trc‘ trace_file_name
3 from
4 ( select p.spid
5 from sys.v$mystat m,sys.v$session s,sys.v$process p
6 where m.statistic# = 1 and s.sid = m.sid and p.addr = s.paddr) p,
7 ( select t.instance from sys.v$thread t,sys.v$parameter v
8 where v.name = ‘thread‘ and (v.value = 0 or t.thread# = to_number(v.value))) i,
9 ( select value from sys.v$parameter where name = ‘user_dump_dest‘) d
10 /TRACE_FILE_NAME
--------------------------------------------------------------------------------
/opt/oracle/admin/hsjf/udump/hsjf_ora_1026.trc
(d) 读取当前session设置的参数
当我们通过alter session的方式设置了sql_trace,这个设置是不能通过show parameter的方式得到的,我们需要通过dbms_system.read_ev来获取:
SQL> set feedback off
SQL> set serveroutput on
SQL> declare
2 event_level number;
3 begin
4 for event_number in 10000..10999 loop
5 sys.dbms_system.read_ev(event_number, event_level);
6 if (event_level > 0) then
7 sys.dbms_output.put_line(
8 ‘Event ‘ ||
9 to_char(event_number) ||
10 ‘ is set at level ‘ ||
11 to_char(event_level)
12 );
13 end if;
14 end loop;
15 end;
16 /
Event 10046 is set at level 1
使用SQL_TRACE进行数据库诊断
标签:false 绑定 tput from arch mys c# 生产环境 def