Sometimes you run an INSERT or DELETE statement that takes a long time to complete. You have wondered how many rows have already been inserted or deleted so that you can decide whether or not to abort the statement. Is there a way to display how many rows have been deleted while the statement is occurring ?
You can query the V$SESSION_LONGOPS table to track the progress of the statement.
Example: Starting the following long running INSERT
INSERT INTO bigemp SELECT * FROM bigemp;
Check the progress:
SELECT sid,sofar,totalwork,time_remaining
FROM v$session_longops
WHERE sid = 10 and time_remaining > 0;
SID SOFAR TOTALWORK TIME_REMAINING
---------- ---------- ---------- --------------
10 8448 11057 20
10 8832 11057 17
10 9024 11057 16
10 9184 11057 14
10 9536 11057 12
10 9646 11057 11
10 9920 11057 9
10 10421 11057 5
10 10529 11057 4
10 10814 11057 2