Saturday, December 19, 2009

Track long running queries in Oracle

It happens sometime or shall i say most of the time that your manager or user calls and asks the DBA ...the db is very slow..can you check what is running in the system or can you check for any long running queries in the database. In this case oracle has provided us a view call v$session_longops, this is a fantastic view and it really helps in checking out for long running queries. for a simple example just run the query -

select * from v$session_longops where sofar <> totalwork;

if it is RAC you should use gv$session_longops.

This is just a basic example and will give you lots of information about long queries running in the system, and will also tell you how much work is done and how much work is left..time shall i say..

No comments:

Post a Comment