Friday, July 10, 2015

Get the time remaining for a session

SQL to find time remaining for a session ( to be run in the same NODE where session is running)

select b.username,a.sid,b.opname,b.target,round(b.SOFAR*100 / b.TOTALWORK,0) || '%' as "%DONE",
b.TIME_REMAINING,to_char(b.start_time,'YYYY/MM/DD HH24:MI:SS') START_TIME
from V$SESSION_LONGOPS b,V$SESSION a
where a.sid=b.sid and a.sid= <>

with global tables

select b.username,a.sid,b.opname,b.target,round(b.SOFAR*100 / b.TOTALWORK,0) || '%' as "%DONE",
b.TIME_REMAINING,to_char(b.start_time,'YYYY/MM/DD HH24:MI:SS') START_TIME
from gV$SESSION_LONGOPS b,gV$SESSION a
where a.sid=b.sid and a.sid= <> 

No comments:

Post a Comment