User Tools

Site Tools


oracle:howto_trace_sql

[HOWTO] Trace any sql

Original documentation

Instructions

Identify your SQL ID of SQL Query which need to trace.

SELECT sql_id, plan_hash_value, substr(sql_text,1,40) sql_text
FROM v$sql
WHERE sql_text LIKE 'SQL QUERY%';

Enable the trace of SQL with using <SQLID> in following statements:

ALTER system SET events 'sql_trace [sql:<SQLID>] wait=true,bind=true';
ALTER system SET events 'trace[sql_optimizer.*] [sql:<SQLID>]';


Disable tracing:

ALTER system SET events 'sql_trace off';
ALTER system SET events 'trace[sql_optimizer.*] off';
oracle/howto_trace_sql.txt · Last modified: 2020/11/19 16:13 by dodger