Skip to Main Content
  • Questions
  • Enabling TKPROF/TRACE on certain queries

Breadcrumb

May 4th

Question and Answer

Connor McDonald

Thanks for the question, Rajan.

Asked: October 13, 2018 - 2:36 pm UTC

Last updated: October 15, 2018 - 1:37 am UTC

Version: 11g

Viewed 1000+ times

You Asked

Hey,
Is there a way to enable TKPROF / TRACE on certain queries only. I have application with hundreds of queries. When we do load test using appdynamics(profiling tool) it shows certain simple queries like insert/update too slow (43 seconds,53 seconds). The same queries executes in milliseconds when executed from SQL developer/any other SQL client. Is there a way I can TKPROF/TRACE just these queries and ignore others while the load is being run.

Thanks!

and Connor said...

If you can find the SQL_ID for that query, then this should work in most versions of Oracle:

alter system set events 'sql_trace [sql:gg5tyt1pvnr47]';

You can get the SQL_ID by querying V$SQL

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database