RMAN Backup Script to find the size, time

0

set lines 1000 pages 140
col OutBytesPerSec for a10
col OUTPUT_BYTES_DISPLAY for a20
col INPUT_BYTES_DISPLAY for a20
col TIME_TAKEN_DISPLAY for a20
col STATUS for a15
col DEVICE_TYPE for a8

SELECT b.session_key ses_key,
b.input_type,
b.status,
to_char(b.start_time,’DD-MM-YY HH24:MI’) “Start Time”,
to_char(b.END_TIME,’DD-MM-YY HH24:MI’) “END_TIME”,
b.time_taken_display,
b.output_device_type device_type,
b.input_bytes_display,
b.output_bytes_display,
b.output_bytes_per_sec_display “OutBytesPerSec”
FROM v$rman_backup_job_details b
WHERE b.start_time > (SYSDATE -7)
ORDER BY b.start_time desc;

How much time still remaining ?

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
/

Throughput

SET HEAD OFF
SELECT ‘RMAN Throughput : ‘||
ROUND(SUM(v.value/(power(2,30))),1) || ‘ GB so far —> Per Second Throughput = ‘ ||
ROUND(SUM(v.value /(power(2,30)))/NVL((SELECT MIN(elapsed_seconds)
FROM v$session_longops
WHERE opname LIKE ‘RMAN: aggregate input’
AND sofar != TOTALWORK
AND elapsed_seconds IS NOT NULL
),SUM(v.value /(power(2,30)))),2) || ‘ GB’
FROM gv$sesstat v, v$statname n, gv$session s
WHERE v.statistic# = n.statistic#
AND n.name = ‘physical write total bytes’
AND v.sid = s.sid
AND v.inst_id = s.inst_id
AND s.program LIKE ‘rman@%’
GROUP BY n.name
/

Share.

About Author

Leave A Reply