четверг, 25 февраля 2016 г.

Monitoring the recovery progress of Standard/Standby database using v$recovery_process


Here it is script to track recovery progress of your standard/standby database:
  1. set linesize 255
  2. set pagesize 60
  3. col type format a30
  4. col sofar_formatted format a20
  5. col total_formatted format a15
  6. col comments format a30
  7.  
  8. select to_char(start_time, 'dd-mon-rr hh24:mi:ss') start_time, type, item, units,
  9. sofar,
  10. case units
  11. when 'KB/sec' then round(sofar/1024,2) || ' MB/Sec'
  12. when 'Megabytes' then round(sofar/1024,2) || ' G'
  13. when 'Seconds' then to_char(cast(numtodsinterval(sofar, 'SECOND') as interval day(2) to second(2)), 'DD HH24:MI:SS')
  14. else to_char(sofar)
  15. end sofar_formatted,
  16. total,
  17. case units
  18. when 'KB/sec' then round(total/1024,2) || ' MB/Sec'
  19. when 'Megabytes' then round(total/1024,2) || ' G'
  20. when 'Seconds' then to_char(cast(numtodsinterval(total, 'SECOND') as interval day(2) to second(2)), 'DD HH24:MI:SS')
  21. else to_char(total)
  22. end total_formatted,
  23. comments
  24. from v$recovery_progress;

Output:

  1. set linesize 255
  2. START_TIME TYPE ITEM UNITS SOFAR SOFAR_FORMATTED TOTAL TOTAL_FORMATTED COMMENTS
  3. --------------------------- ------------------------------ -------------------------------- -------------------------------- ---------- -------------------- ---------- --------------- ------------------------------
  4. 11-feb-16 22:50:00 Media Recovery Log Files Files 8 8 8 8
  5. 11-feb-16 22:50:00 Media Recovery Active Apply Rate KB/sec 3316 3.24 MB/Sec 3316 3.24 MB/Sec
  6. 11-feb-16 22:50:00 Media Recovery Average Apply Rate KB/sec 762 .74 MB/Sec 762 .74 MB/Sec
  7. 11-feb-16 22:50:00 Media Recovery Maximum Apply Rate KB/sec 9617 9.39 MB/Sec 9617 9.39 MB/Sec
  8. 11-feb-16 22:50:00 Media Recovery Redo Applied Megabytes 1144 1.12 G 1144 1.12 G
  9. 11-feb-16 22:50:00 Media Recovery Last Applied Redo SCN+Time 0 0 0 0 SCN: 6296684740127
  10. 11-feb-16 22:50:00 Media Recovery Active Time Seconds 214 +00 00:03:34.00 214 +00 00:03:34.00
  11. 11-feb-16 22:50:00 Media Recovery Apply Time per Log Seconds 22 +00 00:00:22.00 22 +00 00:00:22.00
  12. 11-feb-16 22:50:00 Media Recovery Checkpoint Time per Log Seconds 5 +00 00:00:05.00 5 +00 00:00:05.00
  13. 11-feb-16 22:50:00 Media Recovery Elapsed Time Seconds 1537 +00 00:25:37.00 1537 +00 00:25:37.00

References