DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Find SQL using 100% CPU

  1. #1
    Join Date
    Sep 2000
    Location
    VA
    Posts
    343

    Find SQL using 100% CPU

    One of my DB CPU usage was 100%. Now after 30 minutes, can I find out which SQL was causing that overkill ? STATSPACK lists only the first few lines of the SQL .

    Thanks.

  2. #2
    Join Date
    Dec 2006
    Location
    Brazil
    Posts
    36
    If you are using UNIX system you can use following:

    get the pid process using TOP.

    Connected to SQL*Plus run:

    SQL> select sid,serial#,username,program,osuser,terminal,sql_hash_value
    from v$session
    where paddr = (Select addr from v$process where spid = PID_YOU_GOT_ON_TOP);

    Now to get the query:

    SQL> select sql_text
    from v$sql
    where hash_value = HASH_VALUE_FROM_ABOVE_QUERY;

    Regards
    Regards,

    Carlos Duarte
    Oracle Applications DBA

  3. #3
    Join Date
    Sep 2000
    Location
    VA
    Posts
    343
    That process is not running anymore, so doing TOP does not being it up.

  4. #4
    Join Date
    Sep 2000
    Location
    VA
    Posts
    343
    Just found out that the Statspack report has a column HashValue for every SQL. Checking for that hashvalue from v$sqltext gives me the complete SQL. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width