denrepo

OracleSessions

Long operations with time remaining (all instances)

Long operations still running on any instance, with percent done and elapsed, remaining and estimated total minutes. RMAN is left out because it has its own progress script, and so are aggregate rows and operations Oracle can't estimate yet.

All RAC instances

Not yet verified. How scripts are tested

ora-longops-rac.sql
1CLEAR COLUMNS2SET LINESIZE 250 PAGESIZE 100 TRIMOUT ON TAB OFF3COLUMN inst        HEADING "INST" FORMAT 9904COLUMN sid_serial  HEADING "SID,SERIAL#" FORMAT A145COLUMN username    FORMAT A206COLUMN sql_id      FORMAT A137COLUMN opname      FORMAT A25 TRUNCATE8COLUMN target      FORMAT A30 TRUNCATE9COLUMN started     FORMAT A1410COLUMN pct_done    HEADING "% DONE"      FORMAT 990.9911COLUMN elapsed_min HEADING "ELAPSED MIN" FORMAT 99,990.912COLUMN remain_min  HEADING "REMAIN MIN"  FORMAT 99,990.913COLUMN total_min   HEADING "TOTAL MIN"   FORMAT 99,990.914COLUMN message     FORMAT A60 WORD_WRAPPED15 16SELECT inst_id AS inst,17       sid || ',' || serial# AS sid_serial,18       username, sql_id, opname, target,19       TO_CHAR(start_time, 'MM-DD HH24:MI:SS') AS started,20       ROUND(sofar / totalwork * 100, 2) AS pct_done,21       ROUND(elapsed_seconds / 60, 1) AS elapsed_min,22       ROUND(time_remaining / 60, 1) AS remain_min,23       ROUND((elapsed_seconds + time_remaining) / 60, 1) AS total_min,24       message25FROM gv$session_longops26WHERE opname NOT LIKE 'RMAN%'27  AND opname NOT LIKE '%aggregate%'28  AND totalwork <> 029  AND sofar <> totalwork30  AND time_remaining > 031ORDER BY inst_id, start_time;

Save it as ora-longops-rac.sql and run it with SQL> @ora-longops-rac.

Open in denrepo

More Oracle scripts: Sessions