Home > DBA Scripts, Oracle, Performance, SQL, SQL Tuning > Oracle – Find consuming sql from process id

Oracle – Find consuming sql from process id

If you find an oracle process is consuming a high amount of CPU, you can find the sql_text that is related to that process id using the following code:

SELECT SQL_TEXT
FROM v$sql
WHERE sql_id = (SELECT sql_id FROM v$session WHERE paddr = (sELECT addr
FROM v$process
WHERE spid = '&process_id'));

You will need to find the process id using either top (linux), topas -P (aix), or task manager (windows). Equally you can use Enterprise Manager to find this information, by looking under the performance monitor and any alerts regarding tuning / high CPU consumption.

Advertisements
  1. September 20, 2014 at 10:24 PM

    Appreciation to my father who shared with me regarding this
    website, this web site is genuinely amazing.

  2. November 24, 2016 at 7:02 AM

    Thank you 🙂

    • March 25, 2017 at 8:44 AM

      Trebuia sa faca si el ceva pentru intoarcerea favorurilor de la algeri nu te ambala prea tare, e tot cacialma, (bine, si ceva bani bagati pe-acolo dar in linii mari e un fas)romanului tre sa-i dai ceva de rumegat pentru distragerea atentiei de la realitatea in care se afla.N-ar fi rau sa intre si aia in UE, odata intrati va fi kaput cu plocoanele si pomenele de la noi care se pompeaza destul de mult tocmai datorita &#f0e2;8rati2i” (desi revers nu exista, si nici nu va fi, poate doar politic ..alegeri )Pe altceva nici nu se va merge, e mare separatismul, e destul de multi si rusi, sau russian lover.

  3. Anonymous
    December 3, 2016 at 2:55 PM

    Awesome query

  4. Anonymous
    March 21, 2017 at 7:12 AM

    Thanks.

  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: