Thursday, July 10, 2008

Long operation can be monitored in oracle

Long operation can be monitored in oracle. V$SESSION_LONGOPS is provided for this purpose. There are two columns that describes the time that has been elapsed and time that is remained. Name of the columns are,

TIME_REMAINING: Estimate (in seconds) of time remaining for the operation to complete.
ELAPSED_SECONDS: The number of elapsed seconds from the start of operations

This view displays the status of various operations that run for longer than 6 seconds (in absolute time). The statistics of the objects must have to be gathered to get the real result. We can use ANALYZE command or DBMS_STATS package.

For example,
Start a long operation in one session like,
SQL> select d.table_name,f.type from dictionary d,v$fixed_table f order by 1,2;

then, in another session do the following query,
SQL> select TIME_REMAINING from v$session_longops where TIME_REMAINING > 0;

we will get the result after executing the SQL many times.

No comments:

search engine

Custom Search