Skip to content

How to Resize Redo Logs in Oracle

Increase Redo Log Size

The default size of redo logs during installation is 50MB which is too small for production databases. Of course, you can change the size of redo logs for your needs in DBCA if you know where to make the change.

As for built databases that you took over from other DBA, 50MB of redo logs could be very annoying because it makes log switching very frequently, most likely, you'll see:

Furthermore, it causes a lot of trivial and small sized files. In my opinion, 1GB of redo logs may be more appropriate for a production database.

To increase redo log size from 50MB to 1GB, we take the following steps to reach the goal.

  1. Check Current Redo Logs
  2. Add 3 Groups with New Size (1GB)
  3. Switch Logfile to New Groups
  4. Force a CheckPoint
  5. Drop Group 1, 2, 3
  6. Remove Redo Log Files
  7. Add Group 1, 2, 3 with New Size (1GB)
  8. Switch Logfile Several Times
  9. Check Status of All Redo Logs

But don't expect too much, there's no syntax available in Oracle to resize redo logs directly. In fact, the technique we used is a process of file replacement, you need to do it carefully.

1. Check Current Redo Logs

SQL> column group# format 99999;
SQL> column status format a10;
SQL> column mb format 99999;
SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     1 CURRENT        50
     2 INACTIVE       50
     3 INACTIVE       50

They are all 50MB.

2. Add 3 Groups with New Size (1GB)

SQL> alter database add logfile group 4 ('/u01/app/oracle/oradata/ORCL/redo04.log') size 1g, group 5 ('/u01/app/oracle/oradata/ORCL/redo05.log') size 1g, group 6 ('/u01/app/oracle/oradata/ORCL/redo06.log') size 1g;

Database altered.

SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     1 CURRENT        50
     2 INACTIVE       50
     3 INACTIVE       50
     4 UNUSED       1024
     5 UNUSED       1024
     6 UNUSED       1024

6 rows selected.

3. Switch Logfile to New Groups

Make some redo log switching until you see Log Writer Process (LGWR) is working on the new redo.

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     1 ACTIVE         50
     2 INACTIVE       50
     3 INACTIVE       50
     4 CURRENT      1024
     5 UNUSED       1024
     6 UNUSED       1024

6 rows selected.

To know the differences between ALTER SYSTEM ARCHIVE LOG CURRENT and ALTER SYSTEM SWITCH LOGFILE, you may take some time to read the post.

4. Force a CheckPoint

Now, we have to make all of the original groups to be INACTIVE, then drop them. An ACTIVE or CURRENT redo log group cannot be dropped.

SQL> alter system checkpoint;

System altered.

SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     1 INACTIVE       50
     2 INACTIVE       50
     3 INACTIVE       50
     4 CURRENT      1024
     5 UNUSED       1024
     6 UNUSED       1024

6 rows selected.

5. Drop Group 1, 2, 3

SQL> alter database drop logfile group 1, group 2, group 3;

Database altered.

SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     4 CURRENT      1024
     5 UNUSED       1024
     6 UNUSED       1024

6. Remove Redo Log Files

Now, you have to remove these physical log files by yourself, otherwise you will receive ORA-27038: created file already exists.

Be careful, don't remove online redo logs accidentally. A better practice to remove such sensitive files is to use interactive mode of rm.

[oracle@test ~]$ rm -i /u01/app/oracle/oradata/ORCL/redo0[1-3].log
rm: remove regular file `/u01/app/oracle/oradata/ORCL/redo01.log'? y
rm: remove regular file `/u01/app/oracle/oradata/ORCL/redo02.log'? y
rm: remove regular file `/u01/app/oracle/oradata/ORCL/redo03.log'? y

7. Add Group 1, 2, 3 with New Size (1GB)

SQL> alter database add logfile group 1 ('/u01/app/oracle/oradata/ORCL/redo01.log') size 1g, group 2 ('/u01/app/oracle/oradata/ORCL/redo02.log') size 1g, group 3 ('/u01/app/oracle/oradata/ORCL/redo03.log') size 1g;

Database altered.

SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     1 UNUSED       1024
     2 UNUSED       1024
     3 UNUSED       1024
     4 CURRENT      1024
     5 UNUSED       1024
     6 UNUSED       1024

6 rows selected.

8. Switch Logfile Several Times

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

9. Check Status of All Redo Logs

SQL> select group#, status, bytes/1024/1024 mb from v$log;

GROUP# STATUS         MB
------ ---------- ------
     1 ACTIVE       1024
     2 ACTIVE       1024
     3 ACTIVE       1024
     4 ACTIVE       1024
     5 ACTIVE       1024
     6 CURRENT      1024

6 rows selected.

SQL> column member format a40;
SQL> select group#, member from v$logfile;

GROUP# MEMBER
------ ----------------------------------------
     1 /u01/app/oracle/oradata/ORCL/redo01.log
     2 /u01/app/oracle/oradata/ORCL/redo02.log
     3 /u01/app/oracle/oradata/ORCL/redo03.log
     4 /u01/app/oracle/oradata/ORCL/redo04.log
     5 /u01/app/oracle/oradata/ORCL/redo05.log
     6 /u01/app/oracle/oradata/ORCL/redo06.log

6 rows selected.

As you can see, "resize" is actually a repeated dropping/adding process, no magic inside. The similar techique can also be use to move redo log locations.

2 thoughts on “How to Resize Redo Logs in Oracle”

    1. That’s right, we deleted the old redo logs with size 50MB and added the new ones with size 1GB. Of course, you can also use different file names in step 7, it doesn’t matter.

Leave a Reply

Your email address will not be published.