Les sauvegardes et restaurations RMAN sont parfois longues et le Recovery MANager n'est pas toujours très bavard. les requêtes suivantes sont utiles afin de suivre l'avancement du processus.

Cette requête permet de suivre l'avancement et surtout de déterminer une date de fin approximative.

alter session set nls_date_format='dd/mm/yy hh24:mi:ss';

set linesize 250
col dbsize_mbytes      for 99,999,990.00 justify right head "TailleDB_MB"
col input_mbytes       for 99,999,990.00 justify right head "Lecture_MB"
col output_mbytes      for 99,999,990.00 justify right head "Ecriture_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 "Fin estimée"
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;

Ci dessous un exemple

                                                                 COMPRESS
      ID DEVICE        TailleDB_MB     Lecture_MB    Ecriture_MB   % ORIG COMPLETE % Fin estimée
-------- ---------- -------------- -------------- -------------- -------- ---------- --------------------
    9791 DISK         1,173,192.67     212,822.94      59,460.00    27.94      18.14 07-MAR-2018 17:28:28

Les requêtes suivantes permettent également de suivre le processus phase par phase. La seconde donne les événements d'attente.

select SID, START_TIME,TOTALWORK, sofar, (sofar/totalwork) * 100 done,
sysdate + TIME_REMAINING/3600/24 "Fin à"
from v$session_longops
where totalwork > sofar
AND opname NOT LIKE '%aggregate%'
AND opname like 'RMAN%';

column sid format 9999
column spid format 99999
column client_info format a25
column event format a30
column secs format 9999
SELECT SID, SPID, CLIENT_INFO, event, seconds_in_wait secs, p1, p2, p3
  FROM V$PROCESS p, V$SESSION s
  WHERE p.ADDR = s.PADDR
  and CLIENT_INFO like 'rman channel=%';

En complément voici comment connaitre la volumétrie prise par les sauvegardes

select ctime "Date", 
decode(backup_type, 'L', 'Archive Log', 'D', 'Full', 'Incremental') "Type Sauvegarde", 
bsize "Taille MB"
from (select trunc(bp.completion_time) ctime, backup_type, round(sum(bp.bytes/1024/1024),2) bsize
       from v$backup_set bs, v$backup_piece bp
       where bs.set_stamp = bp.set_stamp
       and bs.set_count  = bp.set_count
       and bp.status = 'A'
       group by trunc(bp.completion_time), backup_type)
order by 1, 2;