Skip to content

Instantly share code, notes, and snippets.

@fljdin
Created April 9, 2014 14:43
Show Gist options
  • Save fljdin/d25390d44dd9b729b5ed to your computer and use it in GitHub Desktop.
Save fljdin/d25390d44dd9b729b5ed to your computer and use it in GitHub Desktop.
RMAN history and statistics
select To_Char(Start_Time, 'D') NUM_DAY, To_Char(Start_Time, 'Dy') DAY,
to_char(to_date(round(avg(ELAPSED_SECONDS)),'sssss'),'hh24:mi:ss') avg_time_taken,
round(avg(input_bytes_per_sec)/(1024*1024),2) || ' Mo/sec.' input_bytes_per_sec_mo,
round(avg(output_bytes_per_sec)/(1024*1024),2) || ' Mo/sec.' output_bytes_per_sec_mo,
round(avg(input_bytes)/(1024*1024*1024),2) || ' Go' input_bytes_go,
round(avg(output_bytes)/(1024*1024*1024),2) || ' Go'output_bytes_go
from V$RMAN_BACKUP_JOB_DETAILS
where input_type='DB INCR'
and status like 'COMPLETED%'
group by To_Char(Start_Time, 'D'),To_Char(Start_Time, 'Dy')
order by To_Char(Start_Time, 'D'),To_Char(Start_Time, 'Dy') ;
select to_char(Start_Time, 'Dy Dd-Mon Hh24:Mi:Ss'),time_taken_display,status,
round(input_bytes_per_sec/(1024*1024),2) input_bytes_per_sec_mo, round(output_bytes_per_sec/(1024*1024),2) output_bytes_per_sec_mo,
output_device_type, round(compression_ratio,2),
input_type,
round(input_bytes/(1024*1024*1024),2) input_bytes_go,
round(output_bytes/(1024*1024*1024),2) output_bytes_go
from V$RMAN_BACKUP_JOB_DETAILS
where input_type='DB INCR'
order by start_time asc;
set lines 130
set pages 300
col status for a15
alter session set NLS_DATE_FORMAT="DD/MM-HH24:MI:SS";
select start_time "Start", round(input_bytes/1024/1024*10)/10 "Source MB", round(output_bytes/1024/1024*10)/10 "Backup MB", input_type "Type", status "Status", round(elapsed_seconds/60*10)/10 "Min", round(input_bytes/1024/1024/elapsed_seconds,1) "read MB/s", round(output_bytes/1024/1024/elapsed_seconds,1) "write MB/s" from v$rman_backup_job_details where start_time >= SYSDATE-2 order by 1 desc;
select to_char(min_checkpoint_time,'Dd-Mon Hh24:Mi:Ss') Min_Checkpoint_Time, to_char(max_checkpoint_time,'Dd-Mon Hh24:Mi:Ss') Max_Checkpoint_Time, num_files_backed, input_bytes_display, output_bytes_display
from v$backup_datafile_summary;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment