Query to see which user is executing which SQL statement

What is the query to see which user is executing what SQL statement?

    Requires Free Membership to View

You can join V$SESSION to V$SQL similar to the following:
SELECT sq.sql_text
FROM v$session se, v$sql sq
WHERE se.sql_address = sq.address
  AND se.sql_hash_value = sq.hash_value
  AND se.session_id = 123;
The above example will return the SQL statement currently being executed by the session with identifier 123. You can modify this query for your specific needs.

This was first published in November 2005

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.