How can I see queries that are executed against Oracle?

Viewed 51217

I need to see the queries that are being sent to Oracle to execute them. Can someone give me specific detailed instructions on how to do this ?

3 Answers

You can check and get the data if you have access to these two oracle tables/views (v$sqlarea & v$sqltext), Also accoridng to your need you can also modify the query and add A.cpu_time, A.elapsed_time if required.

Query -

 SELECT A.SQL_ID,
         A.FIRST_LOAD_TIME,
         A.SQL_TEXT,
         A.SQL_FULLTEXT
    FROM v$sqlarea A, v$sqltext B
   WHERE     A.PARSING_SCHEMA_NAME = 'TESTUSER'  --YOUR USERNAME
         AND A.SQL_ID = B.SQL_ID
         AND A.HASH_VALUE = B.HASH_VALUE
ORDER BY A.FIRST_LOAD_TIME DESC

Output -

enter image description here

Related