Script: RMAN Backup Status

set lines 120 col RMAN_Status FORMAT A20 heading "Status" col INPUT_TYPE FORMAT A15 heading "Backup Type" col Hrs        FORMAT 999.99 heading "Backup Time" col Start_Time FORMAT A20 heading "Backup Start Time" col Start_Time FORMAT A20 heading "Backup End Time"

SELECT SESSION_KEY "Backup Session ID", INPUT_TYPE, STATUS 				     RMAN_Status, TO_CHAR(START_TIME,'DY mm/dd hh24:mi') Start_Time, TO_CHAR(END_TIME,'DY mm/dd hh24:mi')  Start_Time, ELAPSED_SECONDS/3600                  Hrs FROM V$RMAN_BACKUP_JOB_DETAILS ORDER BY SESSION_KEY desc;

Backup Session ID Backup Type    Status               Backup Start Time    Backup End Time      Backup Time - ---   ---             3422 ARCHIVELOG      COMPLETED            THU 11/03 20:41      THU 11/03 22:18              .62 3420 DB INCR        COMPLETED            THU 11/03 19:02      FRI 11/04 20:48             7.77 3418 ARCHIVELOG     COMPLETED            THU 11/03 18:41      THU 11/03 19:47              .60 3416 ARCHIVELOG     COMPLETED            THU 11/03 16:41      THU 11/03 17:28              .78 3414 ARCHIVELOG     COMPLETED            THU 11/03 14:41      THU 11/03 14:56              .25 3412 ARCHIVELOG     COMPLETED            THU 11/03 12:41      THU 11/03 13:04              .39 3410 ARCHIVELOG     COMPLETED            THU 11/03 10:41      THU 11/03 11:19              .63 3408 ARCHIVELOG     COMPLETED            THU 11/03 08:41      THU 11/03 09:10              .50 3406 ARCHIVELOG     COMPLETED            THU 11/03 06:41      THU 11/03 07:20              .65 3403 ARCHIVELOG     COMPLETED            THU 11/03 04:41      THU 11/03 05:00              .33 3400 ARCHIVELOG     COMPLETED            THU 11/03 02:41      THU 11/03 03:28              .78

SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK, ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE" FROM V$SESSION_LONGOPS WHERE OPNAME LIKE 'RMAN%' --AND OPNAME NOT LIKE '%aggregate%' AND TOTALWORK != 0 AND SOFAR <> TOTALWORK
 * During the RMAN run, check the long-running sessions