#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2009
    Posts
    24
    Rep Power
    0

    Find out what are sql statements are currently running--THIS IS URGENT!!


    Hi,


    From database server, I need to monitor the details about the sql statements which are being currenlt running in client machines.

    I tried with V_$SQLTEXT view where I can only see the SQL statements, hash value,address,SQL_id. but I'm not able to get the user name,name the client machine .


    Can anyone please help me to find out these details?.Which Data Dictionary i need to use ?.

    IT's urgent!!!!!!...........

    Thanks in advance for your efforts.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2009
    Location
    Texas, USA
    Posts
    40
    Rep Power
    22
    sql Code:
    SELECT s.SID, s.STATUS, s.process, s.osuser, a.sql_text, p.program
      FROM v$session s, v$sqlarea a, v$process p
    WHERE s.PREV_HASH_VALUE = a.hash_value
       AND s.PREV_SQL_ADDR = a.address
       AND s.paddr = p.addr
       AND s.STATUS = 'ACTIVE'


    That should do it.

    Comments on this post

    • ManiacDan agrees
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2009
    Posts
    24
    Rep Power
    0
    Thanks atheist!!.

    One of my friend help me & I've tried this query.....

    select b.sql_id, a.sql_text, b.osuser, b.USERNAME
    from sys.v_$sqltext a, Sys.v_$session b
    where a.SQL_ID = b.SQL_ID;

    I got more information from your query...

    Thanks a lot for your help!!!

IMN logo majestic logo threadwatch logo seochat tools logo