User Tools

Site Tools


dba:oracle:howtos: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';
dba/oracle/howtos/howto_trace_sql.txt · Last modified: 2023/01/31 08:26 by dodger