How to get sql text for fired by any application or client in Oracle?

1) For Inactive Session:
To get sql text fired by any application or client for Inactive sessions, run following script:
SELECT B.USERNAME, B.MACHINE, B.TERMINAL, B.STATUS, A.SQL_FULLTEXT, A.SQL_TEXT

FROM V$SQLAREA A, V$SESSION B
WHERE A.HASH_VALUE=B.PREV_HASH_VALUE AND STATUS=’INACTIVE’;


NOTE:-  In V$SQLAREA, column to see full text of sql “SQL_FULLTEXT” is of  CLOB Datatype
              so you might not see it on sqlplus prompt.You can use TOAD to see CLOB data.


You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply