COLUMN sid FORMAT 999 COLUMN serial# FORMAT 9999999 COLUMN machine FORMAT A30 COLUMN progress_pct FORMAT 99999999.00 COLUMN elapsed FORMAT A10 COLUMN remaining FORMAT A10 SELECT S.SID || ',' || S.SERIAL#|| CASE WHEN S.INST_ID IS NOT NULL THEN ',@' || S.INST_ID END AS "SID/SERIAL", SUBSTR(S.USERNAME,1,10)||DECODE(S.USERNAME,'SYS',SUBSTR(NVL2(S.MODULE,' [',NULL)||UPPER(S.MODULE),1,6)||NVL2(S.MODULE,']',NULL)) AS USERNAME, S.SQL_ID, substr(DECODE(TARGET_DESC, NULL, DECODE(TARGET, NULL, OPNAME, CONCAT(OPNAME, CONCAT(' - ', TARGET))), DECODE(TARGET, NULL, CONCAT(OPNAME, CONCAT(' : ',TARGET_DESC)), CONCAT(OPNAME, CONCAT(' : ', CONCAT(TARGET_DESC, CONCAT(' - ',TARGET)))))),1,50) "OPERATION", TO_CHAR(sl.START_TIME, 'DD/MM/YYYY HH24:MI:SS') STARTED, TO_CHAR(TRUNC(ELAPSED_SECONDS/3600) , 'FM000') || ':' || TO_CHAR(TRUNC(MOD(ELAPSED_SECONDS, 3600)/60), 'FM00') || ':' || TO_CHAR(MOD(MOD(ELAPSED_SECONDS, 3600), 60) , 'FM00') ELAPSED, TO_CHAR(TRUNC(TIME_REMAINING/3600) , 'FM000') || ':' || TO_CHAR(TRUNC(MOD(TIME_REMAINING, 3600)/60), 'FM00') || ':' || TO_CHAR(MOD(MOD(TIME_REMAINING, 3600), 60) , 'FM00') ESTIMATED, TO_CHAR(TOTALWORK, 'FM9,999,999,990') TOTAL, TO_CHAR(SOFAR, 'FM9,999,999,990') DONE, TO_CHAR(SOFAR / TOTALWORK * 100, '990.99') "% DONE" , TO_CHAR(TIME_REMAINING/(24*3600)+SYSDATE,'DD/MM HH24:MI') FINISH_TIME FROM GV$SESSION_LONGOPS SL, GV$SESSION S, GV$PROCESS P WHERE SL.SID= S.SID AND SL.SERIAL#=S.SERIAL# and sl.INST_ID = s.INST_ID AND (SL.SOFAR/SL.TOTALWORK)*100 < 100AND SL.TOTALWORK > 0AND S.PADDR = P.ADDR and s.INST_ID = p.INST_ID order by S.SQL_ID||SOFAR||S.SID||S.INST_ID desc , ELAPSED;