Check Generated Archivelog Sizes

From NazimWIKI
Jump to navigation Jump to search

Script may or may not work for everyone. The difficulty with this one is that it has to get the archivelog sizes from v$archived_log which could contain duplicate rows as indicated in Oracle documentation ....

"If the log is archived twice, there will be two archived log records with the same THREAD#, SEQUENCE#, and FIRST_CHANGE#, but with a different name"

To counter this, I was able to simply filter out by the name field, which uniquely contained the orignal archivelog names ending with .arc.

select to_char(b.first_time,'yyyy-mm-dd') DAY
     , count(*) NO_LOGS
     , sum(BLOCKS * BLOCK_SIZE)/1024/1024 GB
  from v$archived_log a
     , v$log_history b
 where a.sequence# = b.sequence#
   and a.thread# = b.thread#
   and a.first_change# = b.first_change#
   and a.name like '%.arc%'
group by to_char(b.first_time,'yyyy-mm-dd');