sql_trace and tkprof

sql_trace and tkprof
session1  (sysdba)
    1) : alter session set timed_statistics=true;

    2 ) select * from v$session where v$session.USERNAME='SCOTT'; //find the trace session

    3)  exec dbms_system.set_sql_trace_in_session(25,6,true);  //open the sql_trace for the session

session2  (scott)
    4) select * from t;

session 1(sysbda)
    5) exec dbms_system.set_sql_trace_in_session(25,6,false); //close the sql_trace
   
    6) show parameter user_dump;  //get the trace file path

session 3: OS,
    7)  cd /opt/oracle/diag/rdbms/orcl/orcl/trace
    8) ll -t  *.trc   //get the last trc file

    9) /opt/oracle/product/11.1.x/bin/tkprof /opt/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_7688.trc /opt/oracle/diag/rdbms/orcl/orcl/trace/
orcl_ora_7688.trc.txt

   
   

你可能感兴趣的:(sql_trace and tkprof)