Ask the Expert

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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: