Thursday, September 29, 2005

Tracking the progress of long-running queries

Manish Upadhyay

09.14.2005 SearchOracle.com


Sometimes there are batch jobs or long-running queries in the database that may take a while to complete. This query will show the status of the query -- how much of it is completed. In other words, this may be viewed as a "progress bar" for the query. It has been tested on v. 9.2.0.4 on Tru64 and Windows. (Note: This tip is a modified version of a tip from Oracle documentation.)

SELECT * FROM (select
username,opname,sid,serial#,context,sofar,totalwork
,round(sofar/totalwork*100,2) "% Complete"
from v$session_longops)
WHERE "% Complete" != 100
/

No comments: