Tuesday, July 31, 2007

Monitor the SQL statement being executed in Oracle

There are several way to monitor the sql statement being executed in Oracle database.
We can do it through a client side monitoring tool, or some jdbc debugging drivers.
There is one thing we can do in the server side, and the following statement will do the trick:

select SQL_TEXT, SQL_ID, FIRST_LOAD_TIME, LAST_LOAD_TIME, LAST_ACTIVE_TIME, ELAPSED_TIME, MODULE
from v$sql where MODULE like '%JDBC Connect Client%'
order by FIRST_LOAD_TIME desc


More information about v$sql is available at v$sql reference .

For the implementation part of an Oracle client, we can use d, t, and ts. The specification about them is available at Time and Date literal .

No comments: