RMAN: Displaying current backup progress

When performing a backup of a large database using RMAN, you often get asked "how is the backup progressing?" and "when it will complete?". Although the log produced by RMAN is detailed in almost every other aspect, there isn't any  information recorded that will allow you to give a simple and straightforward answer to these questions

However, the information is available within the V$RMAN_STATUS data dictionary view.

RMAN progress output


This above details were obtained through querying this view (script below) and we can clearly see that the backup of this 10TB database is currently 8.68% complete and has an estimated completion tim of 14:45 on the 17th August 2013.

The calculation is based on the DBSIZE (the sum of all datafiles) and the amount of data that has been READ by RMAN, which is then projected from the backup start time to give an estimated completion time. The amount of data WRITTEN also allows us to calculate that RMAN has achieved an impressive compression ratio of 38.4% (of the original size) so far.

The SQL for this result is shown below:

col dbsize_mbytes      for 99,999,990.00 justify right head "DBSIZE_MB"
col input_mbytes       for 99,999,990.00 justify right head "READ_MB"
col output_mbytes      for 99,999,990.00 justify right head "WRITTEN_MB"
col output_device_type for a10           justify left head "DEVICE"
col complete           for 990.00        justify right head "COMPLETE %" 
col compression        for 990.00        justify right head "COMPRESS|% ORIG"
col est_complete       for a20           head "ESTIMATED COMPLETION"
col recid              for 9999999       head "ID"

select recid
     , output_device_type
     , dbsize_mbytes
     , input_bytes/1024/1024 input_mbytes
     , output_bytes/1024/1024 output_mbytes
     , (output_bytes/input_bytes*100) compression
     , (mbytes_processed/dbsize_mbytes*100) complete
     , to_char(start_time + (sysdate-start_time)/(mbytes_processed/dbsize_mbytes),'DD-MON-YYYY HH24:MI:SS') est_complete
  from v$rman_status rs
     , (select sum(bytes)/1024/1024 dbsize_mbytes from v$datafile) 
 where status='RUNNING'
   and output_device_type is not null

Below is a  link to a SQL script I have created which shows the results of this query and also lists the RMAN database connections (one per backup channel allocated) and what event they are currently waiting on (such as the Media Library creating, writing, querying or committing a backup piece).