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

Thread: last SQL statement?

  1. #1
    Join Date
    Oct 2000
    Posts
    139
    Hi all

    How do I check the last and the current SQL statement a user issued?
    Also I tried to sql_text from v$open_cursor for the current statement (am I right) but the sql_text column is always truncated, is there anyway to see it fully with SQL*PLUS?

    Thanks

  2. #2
    Join Date
    Apr 2000
    Location
    roma
    Posts
    131
    you have to check V_$SQLTEXT_WITH_NEWLINES in join with v$session by address

  3. #3
    Join Date
    Oct 2000
    Posts
    23
    which address in v$session..
    paddr, saddr or sql_addr

  4. #4
    Join Date
    Oct 2000
    Posts
    139
    I think sql_address

    anyway I see sql_text truncated though, is there anyway to see them full?

  5. #5
    Join Date
    Oct 2000
    Posts
    139
    I did this

    select username, sql_text
    from v$session, v$sqltext_with_newlines
    where v$session.sql_address=v$sqltext_with_newlines.address
    and username is not null;

    I got this back:

    USERNAME SQL_TEXT
    ---------- ----------------------------------------------------------------
    LSC d username is not null


    LSC select username, sql_text
    from v$session, v$sqltext_with_newline

    LSC s
    where v$session.sql_address=v$sqltext_with_newlines.address
    an


    which is one query, how can i order it?

  6. #6
    Join Date
    Apr 2000
    Location
    roma
    Posts
    131
    try this:
    prompt USER VAR
    set heading off
    col ute for a10
    col time for a30
    col text format a500
    select v.sql_text text, d.username ute, to_char(d.logon_time, 'dd-mon-yyyy:hh:mi') time
    from V_$SQLTEXT_WITH_NEWLINES v, v$session d
    where d.username='&USER
    and
    v.address=d.SQL_ADDRESS order by logon_time
    /
    .... so you've to put the user you want to get

  7. #7
    Join Date
    Oct 2000
    Posts
    139
    That looked horrible, cant read anything at all :(

  8. #8
    Join Date
    Nov 2000
    Posts
    25
    Hi

    Change the order by column to piece instead of logon_time

    _____________
    Santosh
    OCP - Dba 8i


  9. #9
    Join Date
    Apr 2000
    Location
    Russia
    Posts
    11
    Sweetie, i have tested this now and got the current SQL statement

    select username,
    sql_text
    from v$session, v$sql
    where v$session.sql_address =
    v$sql.address;
    i have O7.2.3

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