Skip to Main Content
  • Questions
  • Size difference between redo log and archive redo log

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Kamran.

Asked: September 11, 2020 - 5:49 am UTC

Last updated: September 11, 2020 - 8:27 am UTC

Version: 11.2.0.1

Viewed 1000+ times

You Asked

Hi, I am confusing with the size of redo log and archive redo log

Here I used script for monitoring
# Daily Count and Size of Redo Log Space (Single Instance)
SELECT A.*,
Round(A.Count#*B.AVG#/1024/1024) Daily_Avg_Mb
FROM
(
   SELECT
   To_Char(First_Time,'YYYY-MM-DD') DAY,
   Count(1) Count#,
   Min(RECID) Min#,
   Max(RECID) Max#
FROM
   v$log_history
GROUP BY
   To_Char(First_Time,'YYYY-MM-DD')
ORDER
BY 1 DESC
) A,
(
SELECT
Avg(BYTES) AVG#,
Count(1) Count#,
Max(BYTES) Max_Bytes,
Min(BYTES) Min_Bytes
FROM
v$log
) B
;


RESULT
DAY            COUNT#       MIN#       MAX# DAILY_AVG_MB
---------- ---------- ---------- ---------- ------------
2020-09-09          6          1          6          300


But the total size of archive redo logs different
[oracle@localhost archivelog]$ du -h
58M     ./2020_09_09
58M     .
[oracle@localhost archivelog]$ cd 2020_09_09/
[oracle@localhost 2020_09_09]$ du -h
58M     .
[oracle@localhost 2020_09_09]$ ls
o1_mf_1_3_hokmyqvv_.arc  o1_mf_1_4_hokn4s92_.arc  o1_mf_1_5_hoknsz36_.arc  o1_mf_1_6_hol3smy3_.arc
[oracle@localhost 2020_09_09]$ ls -ltr
total 58684
-rw-r----- 1 oracle oinstall 15892992 Sep  9 17:51 o1_mf_1_3_hokmyqvv_.arc
-rw-r----- 1 oracle oinstall   127488 Sep  9 17:54 o1_mf_1_4_hokn4s92_.arc
-rw-r----- 1 oracle oinstall  1089024 Sep  9 18:06 o1_mf_1_5_hoknsz36_.arc
-rw-r----- 1 oracle oinstall 42897408 Sep  9 22:21 o1_mf_1_6_hol3smy3_.arc
[oracle@localhost 2020_09_09]$




and Chris said...

The size of the redo log files remains constant. The size of the archived log files is proportional to the size of redo copied out.

So you can't use the redo log file sizes to predict out the archive log file sizes like this. Get the actual size from v$archive_log:

select bytes * blocksize / 1024 / 1024 redo_mb
from   v$log;

REDO_MB   
    524288 
    524288 
    524288 

select recid, blocks * block_size  / 1024 / 1024 archive_mb
from   v$archived_log
where  name like '%2020_09_11%'
order  by recid desc;

RECID           ARCHIVE_MB       
      72    55.19189453125 


Notice that after I force a log switch, the redo log files are all still the same size. But the archive log generated is substantially smaller:

alter system archive log current;

select bytes * blocksize / 1024 / 1024 redo_mb
from   v$log;

REDO_MB   
    524288 
    524288 
    524288 

select recid, blocks * block_size  / 1024 / 1024 archive_mb
from   v$archived_log
where  name like '%2020_09_11%'
order  by recid desc;

RECID           ARCHIVE_MB       
      73    14.99902343750 
      72    55.19189453125 

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Kamran Abbasov, September 12, 2020 - 5:54 am UTC

This is very helpful, thank you very much for clarification :)

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database