Friday, May 25, 2012

How to monitor RMAN job

This script is reporting all backups - full, incremental and archivelog.
connect to sqlplus as sysdba and execute:


col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;

Output will be something like this
SESSION_KEY INPUT_TYPE    STATUS    START_TIME     END_TIME           HRS
----------- ------------- --------- -------------- -------------- -------
         39 DB INCR       FAILED    05/25/12 04:32
         42 ARCHIVELOG    FAILED    05/25/12 11:43
         44 ARCHIVELOG    FAILED    05/25/12 15:47
         48 ARCHIVELOG    FAILED    05/25/12 16:50
         50 ARCHIVELOG    FAILED    05/25/12 16:53
         52 ARCHIVELOG    FAILED    05/25/12 17:00
         54 DB INCR       RUNNING   05/25/12 17:06 05/26/12 03:00    9.91
Another usuful script to monitor the bakcup work is:
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 ;
The output will be something like this:
       SID    SERIAL#    CONTEXT      SOFAR  TOTALWORK %_COMPLETE
---------- ---------- ---------- ---------- ---------- ----------
       769      39801          1   32408560   61279360      52.89

No comments:

Post a Comment