clear column
set lines 400
Col opname form a30
col status format a9
select sid, serial#, sofar, totalwork, opname,
round(sofar/totalwork*100,2) "% Complete"
from v$session_longops
where opname LIKE 'RMAN%'
and opname NOT LIKE '%aggregate%'
and totalwork != 0
and sofar <> totalwork;


#!/bin/ksh
# -----------------------------------------------------------------------------
# RMAN Job progress.
# -----------------------------------------------------------------------------
zzz=60 # Sleep duration
while true
do
echo " "
echo " RMAN Job Progress (${ORACLE_SID})"
sqlplus -s / as sysdba << EOF
set linesize 300 pagesize 50000 feedback off
clear columns breaks
col DONE_PCT for a10
col OPNAME for a50
select sid, start_time, totalwork, sofar,
trunc((sofar/totalwork)*100,2)||'%' Done_pct,
to_char(sysdate+time_remaining/3600/24,'dd/mm/yy hh24:mi:ss') end_at,
substr(opname,1,30) OPNAME
from v\$session_longops
where totalwork > sofar
and opname not like '%aggregate%'
and opname like 'RMAN%'
order by 6;

set feedback on
EOF
echo " "
echo " Sleeping ${zzz} seconds (${ORACLE_SID})"
sleep ${zzz}
done

  Estimated time of Backup / Restore via RMAN
Query to estimate the time of Backup / Restore via RMAN

Below, a query to be executed on target database or database auxiliary ( in the case of duplicate) to estimate the time of restore and the completed percentage .


col OPNAME for a30
select OPNAME,SOFAR/TOTALWORK*100 PCT, trunc(TIME_REMAINING/60) MIN_RESTANTES,
trunc(ELAPSED_SECONDS/60) MIN_ATEAGORA
from v$session_longops where TOTALWORK>0 and OPNAME like '%RMAN%';

Output example of a duplicate:

OPNAME PCT MIN_RESTANTES MIN_ATEAGORA
------------------------------ ---------- ------------- ------------
RMAN: aggregate input 67.6037414 176 368
RMAN: full datafile restore 100 0 26
RMAN: full datafile restore 100 0 10
RMAN: full datafile restore 100 0 21
RMAN: full datafile restore 100 0 22
RMAN: full datafile restore 100 0 20
RMAN: full datafile restore 100 0 51
RMAN: full datafile restore 49.1620893 26 25
RMAN: full datafile restore 100 0 32
RMAN: full datafile restore 100 0 26
RMAN: full datafile restore 100 0 20
RMAN: full datafile restore 100 0 27
RMAN: full datafile restore 100 0 26
RMAN: full datafile restore 100 0 19
RMAN: full datafile restore 100 0 52
RMAN: full datafile restore 49.4441805 25 24


Reading the Output:

The line ( RMAN: aggregate input ) is the sum of total and it is showing that was executed 67,60% of total of restore, and took until now, 368 minutes, and estimates that rest 176 minutes.

The other lines are of partials ( RMAN: full datafile restore ), we have many completed ( pct=100) , and two restore of pieces in execution, that will still take 26 minutes, the first, and 25 minutes the second.

HOME