Protected by Copyscape Web Copyright Protection Software

Pages

Search This Blog

Wednesday, March 12, 2014

Query To Display Execution Plans in Oracle

SELECT *
FROM TABLE(sys.dbms_xplan.display_cursor
            (NULL, NULL, 'ALLSTATS +COST LAST'));


DISPLAY_CURSOR displays the execution plans for one or several
  ---             cursors in the shared SQL area, depending on a filter
  ---             criteria. It can display the plan for the last executed
  ---             statement, the current (if session is active) or last
  ---             executed statement (if session is inactive) of a specific
  ---             session, or all cursors matching an arbitrary criteria
  ---             defined via SQL. In addition to the explain plan, various
  ---             plan statistics (e.g. io, memory and timing) can be
  ---             reported (based on the v$sql_plan_statistics_all views).
  ---
  ---             Specific cursors are identified by SQL_ID and optionally a
  ---             SQL_CHILD_NUMBER.
  ---
  ---             The DEFAULT without any parameters shows the last executed
  ---             statement of the session.
  ---
  ---             NOTE: To use the DISPLAY_CURSOR functionality, the calling
  ---             user must have SELECT privilege on V$SQL_PLAN_STATISTICS_ALL,
  ---             V$SQL, and V$SQL_PLAN. By default, only the select_catalog
  ---             role has the SELECT privilege on these views.

No comments:

Post a Comment