How can I find out which stored procedure is currently running for a session?
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
The answer is to really find out which SQL statement a session is currently running. Stored procedures will appear as an SQL statement. To do this, we'll use the following query:
SELECT a.sqltext FROM v$session s, v$sqlarea a WHERE s.sql_address = a.addr AND s.sql_hash_value = a.hash_value AND s.username='MYUSER';In my example, I limited this to just queries issued by MYUSER. But you can do other limitations on the V$SESSION view as well.
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Dig Deeper on Oracle database design and architecture
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.