Monday, March 19, 2012

Performance issue for a particular query


Q) When yesterday developer gives the following command: select count(*) from [table name]
it gives the output within minutes, today the same command takes hours? What will you check?

Ans) we have to take the sql trace. but it cannot be read by us. so we have to take the tkprof of this file which can be read by us. to take the sql trace fire the below command

SQL>alter session set sql_trace=true;

then fire that sql statement

SQL>select count(*) from [tablename];

it will generate a trace file in udump

then stop the trace by following command

SQL>alter session set sql_trace=false;

then produce a tkprof

$tkprof [filename] [tkprof filename]

tkprof <input_file_name.trc> <output_file_name.txt> explain=apps/apps

No comments:

Post a Comment