Q

Query to see which user is executing which SQL statement

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

What is the query to see which user is executing what SQL statement?
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

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close