@@header
set term off
/*
*
*  Author  : Vishal Gupta
*  Purpose : Display last date of RMAN backup
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  23-Jun-08  Vishal Gupta  First Draft
*/
set term on

COLUMN max_end_time FORMAT a30 HEADING "Last Successfull DB Backup"
COLUMN backedup_yesterday FORMAT a30 HEADING "Backed up in last 24hrs ?"
SELECT to_char(s.start_Time,'dd-MON-YY hh24:mi:SS') start_time
      ,s.db_name
      ,s.status
   --  ,s.row_type
      ,s.operation
      ,s.object_type
      ,s.output_device_Type
      ,ROUND(s.input_bytes/1024/1024,2) input_mb
      ,ROUND(s.output_bytes/1024/1024,2) output_mb
      ,ROUND( (s.end_time - s.start_time) * 24 * 60,2) duration
FROM rc_rman_status s
WHERE s.end_time > sysdate - 1 + (1/24)
  AND s.status NOT IN  ('COMPLETED'
                       ,'RUNNING'
                       ,'COMPLETED WITH WARNINGS'
                       )
ORDER BY start_time asc;

@@footer
