Question : Explain plan in Oracle

I'm really new to Oracle and I have been asked to run an explain plan on some oracle reports. How would I go about doing this? What are the steps? If I trace a user's session while they are running the report will it give me the explain plan and tkprof at the same time? or I have to run them separately.

Answer : Explain plan in Oracle

explan plan for  <your query>

for example...

explain plan for
     select * from dual;

then to see that plan...

select * from table(dbms_xplan.display)


To trace your session in 10g and higher use dbms_monitor.

in 9i, you
alter session set timed_statistics=TRUE;
alter session set sql_trace=TRUE;

even better is (officially unsupported, but well documented by Oracle support as an approved method)
alter session set events '10046 trace name context forever,level 12';

or, if you have the dbms_support package installed, use it.






Random Solutions  
 
programming4us programming4us