Tuesday, January 1, 2013

How to find Query Execution Time in Oracle database?

select * from v$sql;

You will notice that you can further filter on lot of useful stuff.

For example:
Lets say you want to see only those queries coming via a JDBC Thin Driver, you can do:

select LAST_LOAD_TIME, ELAPSED_TIME, MODULE, SQL_TEXT elasped from v$sql
WHERE MODULE='JDBC Thin Client'
ORDER BY LAST_LOAD_TIME DESC


To see all the columns in this table:
desc v$sql

Finding open Cursor in particular user : 

select  sql_text, count(*) as "OPEN CURSORS", user_name from v$open_cursor where user_name='XXXXX' group by sql_text, user_name order by count(*) desc;
 

No comments:

Post a Comment