Explain plan

 
-- ################################################
-- # Creator: Vincent Fenoll
-- # Created: 2011/03/10
-- # Name: Extended traces
-- ################################################
-- #
-- # Compatible: Oracle 9i 10g 11g
-- #
-- ################################################
-- #
-- # How to display the execution plan with explain plan
-- # for a sql statement
-- # 
-- # pre-requisite:
-- # PLAN_TABLE; created with @?/rdbms/admin/utlxplan.sql
-- #
-- ################################################



-- In thie first example the SQL Statement to audit is very
-- useful to show active SQL (often bad sql to tune) 


set lines 140 pages 2000

explain plan for
  select sql_fulltext 
  from v$session a, v$sqlarea b 
  where a.sql_address=b.address(+) and status = 'ACTIVE';

@?/rdbms/admin/utlxpls

explain plan for
  select sysdate from dual;

@?/rdbms/admin/utlxpls

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.