Thursday, May 7, 2015

How to add a logfile group and a logfile member - syntax

alter database add logfile group 2
(
'/u01/app/oracle/flash_recovery_area/mydb/onlinelog/redo02a.log',
'/u01/app/oracle/oradata/mydb/onlinelog/redo02b.log'
) size 50M;

Remember, if you have just recently dropped the redo log members, they are still present physically on disk.
If you'd like to reuse the log file member names, and to avoid

ORA-00301: error in adding log file /u03/oradata/arutvt/redo03.log - file cannot be created,

add the REUSE keyword at the end of the statement:

alter database add logfile group 3 ('/u03/oradata/mydb/redo03.log') size 1024M REUSE;
To add another member to an already existing group:
ALTER DATABASE ADD LOGFILE MEMBER '/u03/oradata/mydb/redo03.log' TO GROUP 3;
If the redo log file member is already present on disk, use reuse:
ALTER DATABASE ADD LOGFILE MEMBER '/u03/oradata/mydb/redo3b.log' REUSE TO GROUP 3;

If you do not specifically say which log group number you want to create, Oracle will take add another group based on the largest log file group number in v$logfile. So if I have 3 groups already, and execute
alter database add logfile '/rdodata/mydb/redo04.log' size 2048M;
It will create group number 4 for you, even if you do not explicitly say so:
SYS@cdb>SQL>@redo

    GROUP# MEMBER                                                     MB ARC STATUS            SEQUENCE#
---------- -------------------------------------------------- ---------- --- ---------------- ----------
         1 /rdodata/mydbredo01.log                              2048 YES INACTIVE                220
         2 /rdodata/mydb/redo02.log                             2048 YES INACTIVE                221
         3 /rdodata/mydb/redo03.log                             2048 NO  CURRENT                 222
         4 /rdodata/mydb/redo04.log                             2048 YES UNUSED                    0


Documentation for Oracle 19c is found here

No comments:

Post a Comment