Oracle Logbook

October 21, 2011

Simple way to get CPU usage

Filed under: Uncategorized — Helio Dias @ 6:36 pm

Often we want just the CPU usage from a query rather than complete 10046,

As Tom Kyte published in setember Oracle Magazine:

SQL> begin
   2   :cpu := dbms_utility.get_cpu_time;
   3   dbms_application_info.set_client_info(0);
   4 end;
   5 /
PL/SQL procedure successfully completed.

SQL> select owner, f(owner) from stage;

72841 rows selected.

SQL> select
  2  dbms_utility.get_cpu_time-:cpu cpu_hsecs,
  3  userenv(‘client_info’)
  4  from dual;

———   ———————–
       118                     72841

To read the whole article:

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: