Long operations


set linesize 200
SET PAGESIZE 9999
SET VERIFY   OFF
COLUMN INST_ID	  		FORMAT 9999   	HEADING 'INST'
COLUMN sid_serial	  	FORMAT a15   	HEADING 'SID / Serial#'
COLUMN opname   		FORMAT a30   	HEADING 'Op Name'
COLUMN username			FORMAT a15   	HEADING 'Username'
COLUMN target			FORMAT a30   	HEADING 'Target'
COLUMN done	    		FORMAT 99.99    HEADING '% completed'
COLUMN start_date_time  FORMAT a20      HEADING 'Start time'
COLUMN remain    		FORMAT 999.99   HEADING 'Min remaining'
COLUMN end_time			FORMAT a20      HEADING 'End time (estim)'

select INST_ID, SID||'/'||Serial# sid_serial, 
		opname, 
		username, 
		target, 
		sofar/totalwork*100 done, 
		to_char(start_time, 'dd/mm/yyyy hh24:mi:ss') start_date_time, 
		time_remaining/60 remain,
		to_char(sysdate + TIME_REMAINING/3600/24, 'dd/mm/yyyy hh24:mi:ss') end_time
	from gv$session_longops	
		where sofar < totalwork
/