When backups start running into business hours, the question is whether they got slower or just bigger. rmans.sql gives backup throughput (KB per second) and the number of files per hour for the last seven days; bks.sql shows the RMAN sessions running now and their current waits.
Usage
SQL> @rmans.sql
SQL> @bks.sql
-- rmans.sql: RMAN backup speed per hour over the last 7 days (v$backup_async_io)
-- Copyright (c) HASHJOIN. MIT License (https://hashjoin.com/kb/license/)
-- https://hashjoin.com/kb/oracle/rman-backup-throughput/
--
-- Usage: @rmans.sql
col kb_sec format 999,999,999 heading "KB/S"
col hr heading "HH|24"
col dd heading "Day"
col cnt heading "#Files"
break on dd skip page
set pages 1000
select to_char(close_time,'YYYY/MM/DD') dd
, to_char(close_time,'HH24') hr
, avg(ebps)/1024 kb_sec
, count(*) cnt
from (
select type,filename, effective_bytes_per_second ebps, open_time, close_time
from V$BACKUP_ASYNC_IO
where status = 'FINISHED'
and close_time >= sysdate-7)
group by to_char(close_time,'YYYY/MM/DD')
, to_char(close_time,'HH24')
order by to_char(close_time,'YYYY/MM/DD'),
to_char(close_time,'HH24')
;curl -O https://hashjoin.com/kb/oracle/rman-backup-throughput/rmans.sql
-- bks.sql: RMAN sessions running now and what they wait on
-- Copyright (c) HASHJOIN. MIT License (https://hashjoin.com/kb/license/)
-- https://hashjoin.com/kb/oracle/rman-backup-throughput/
--
-- Usage: @bks.sql
set lines 132
col username format a4
col module format a20
col event format a30
select sid,serial#,username,module,event,WAIT_TIME,SECONDS_IN_WAIT from v$session where module like 'backup%';curl -O https://hashjoin.com/kb/oracle/rman-backup-throughput/bks.sql
Reading the output
Compare the same hour across days. Throughput that drops on one day and recovers points at contention (another job on the same storage or network); throughput that drifts down over weeks points at the backup target. If throughput holds steady but the run takes longer, the database just grew.
In bks.sql, RMAN channels waiting on I/O events (... I/O or RMAN backup & recovery I/O) are limited by disk or tape; channels on CPU or waiting on nothing in particular are limited by compression or by the number of channels.
Gotchas
v$backup_async_ioonly covers asynchronous I/O. Backups that use synchronous I/O (some tape setups) are inv$backup_sync_ioinstead; change the view name.- The 7-day window is in the script (
sysdate-7). bks.sqlmatches RMAN sessions bymodule like 'backup%', which is how RMAN labels its channels.
What it reads
Tired of fixing the same thing twice?
HASHJOIN turns the checks and fixes your on-call runs by hand into tooling that gives the same answer every time. Fixed scope, and you own all of the code.
New fixes and field notes by email, about once a month.