Search This Blog

Wednesday, November 19, 2025

[Oracle DBA] - Display Explain Plan with SET AUTOTRACE in SQL Plus

To generate Explain plan and performance statistics

SET AUTOTRACE ON
 - Displays the query results, the execution plan, and the execution statistics.

SET AUTOTRACE ON EXPLAIN
 - Displays the query results and only the optimizer's execution path (no statistics).

SET AUTOTRACE ON STATISTICS
 - Displays the query results and only the execution statistics (no plan).

SET AUTOTRACE TRACEONLY
 - Displays the execution plan and statistics but suppresses the actual query output. This is useful for large result sets.

SET AUTOTRACE TRACEONLY EXPLAIN
 - Only generates the execution plan without actually running the query (fastest for tuning long-running queries).

SET AUTOTRACE OFF
 - Disable autotrace setting


** The user must have PLUSTRACE role assigned to the user and PLAN_TABLE is created in the user schema.