Difference between revisions of "RMAN"

From dbawiki
Jump to: navigation, search
(Created page with "==A collection of useful bits and pieces I used on a regular basis when I was using RMAN== select s.db_name , s.status , max(s.start_time) start_time , max(round(...")
 
(A collection of useful bits and pieces I used on a regular basis when I was using RMAN)
Line 1: Line 1:
==A collection of useful bits and pieces I used on a regular basis when I was using RMAN==
+
==Script to check what has been backed up==
 
+
select s.db_name
select s.db_name
+
,      s.status
,      s.status
+
,      max(s.start_time) start_time
,      max(s.start_time) start_time
+
,      max(round(s.mbytes_processed/1024))  "processed_data(GB)"
,      max(round(s.mbytes_processed/1024))  "processed_data(GB)"
+
,      max(round((end_time-start_time)*60*24)) "duration(min)"
,      max(round((end_time-start_time)*60*24)) "duration(min)"
+
,      trunc(sysdate)-trunc(s.start_time)  days_since_last_backup
,      trunc(sysdate)-trunc(s.start_time)  days_since_last_backup
+
from  rman.rc_rman_status s  
from  rman.rc_rman_status s  
+
where  1=1
where  1=1
+
and    lower(s.operation)  = 'backup'
and    lower(s.operation)  = 'backup'
+
and    lower(s.object_type) ='db full'
and    lower(s.object_type) ='db full'
+
and    s.start_time =
and    s.start_time =
+
        (
      (
+
        select max(md.start_time)
      select max(md.start_time)
+
        from  rman.rc_rman_status md  
      from  rman.rc_rman_status md  
+
        where  1=1
      where  1=1
+
        and    lower(md.operation)  = 'backup'
      and    lower(md.operation)  = 'backup'
+
        and    lower(md.object_type) ='db full'
      and    lower(md.object_type) ='db full'
+
        and    md.db_name = s.db_name
      and    md.db_name = s.db_name
+
        )
      )
+
group  by s.db_name
group  by s.db_name
+
,      s.object_type
,      s.object_type
+
,      s.operation
,      s.operation
+
,      s.status
,      s.status
+
,      trunc(sysdate)-trunc(s.start_time)
,      trunc(sysdate)-trunc(s.start_time)
+
order  by trunc(sysdate)-trunc(s.start_time) desc
order  by trunc(sysdate)-trunc(s.start_time) desc
 

Revision as of 21:38, 22 November 2011

Script to check what has been backed up

select s.db_name
,      s.status
,      max(s.start_time) start_time
,      max(round(s.mbytes_processed/1024))  "processed_data(GB)"
,      max(round((end_time-start_time)*60*24)) "duration(min)"
,      trunc(sysdate)-trunc(s.start_time)   days_since_last_backup
from   rman.rc_rman_status s 
where  1=1
and    lower(s.operation)   = 'backup'
and    lower(s.object_type) ='db full'
and    s.start_time =
       (
       select max(md.start_time)
       from   rman.rc_rman_status md 
       where  1=1
       and    lower(md.operation)   = 'backup'
       and    lower(md.object_type) ='db full'
       and    md.db_name = s.db_name
       )
group  by s.db_name
,      s.object_type
,      s.operation
,      s.status
,      trunc(sysdate)-trunc(s.start_time)
order  by trunc(sysdate)-trunc(s.start_time) desc