how to view the current sql queries?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: how to view the current sql queries?

  1. #1
    Join Date
    Aug 2007
    Location
    Cyberjaya,kuala lumpur
    Posts
    340

    how to view the current sql queries?

    how to view the current sql queries that the current user is firing?
    how can i view this using v$sql view
    gopu

  2. #2
    Join Date
    Jul 2006
    Posts
    96
    use the following

    select sql_text,last_load_time from v$sql where
    last_load_time = (select max(last_load_time) from v$sql)

  3. #3
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Try this in 10g:

    set lines 101 pages 10000
    col sql_fulltext for a76 word_wrapped
    col last_load_time for a22

    select last_load_time, sql_fulltext
    from v$SQL
    order by 1 desc
    /

  4. #4
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    You guys are not answering OP's question.

    Providing you know the username of the user you want to track you might want to try:

    Code:
    select  a.username,
            b.last_load_time,
            b.sql_text
    from    v$session a,
            v$sql     b
    where   a.username = 'USERNAME_YOU_WANT_TO_TRACK'
       and  a.sql_address = address
    order by b.last_load_time desc
    ;
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

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