Thursday, September 29, 2005

Tracking the progress of long-running queries

Manish Upadhyay


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. on Tru64 and Windows. (Note: This tip is a modified version of a tip from Oracle documentation.)

SELECT * FROM (select
,round(sofar/totalwork*100,2) "% Complete"
from v$session_longops)
WHERE "% Complete" != 100

No comments: