Sie sind auf Seite 1von 4

Maintenance of Online Redo Log Groups and Members

PURPOSE
--------------------------------To explain how to add and drop online redo log members and groups.

MIRRORING ONLINE REDO LOGS


----------------------------The Oracle server maintains online redo log files to minimize the loss of data
in the database. The redo log files record all changes made to data in the database
buffer cache with some exceptions; for example, in the case of direct writes.

Redo log files are used in a situation such as an instance failure to recover committed
data that has not been written to the data files. The redo log files are only used for
recovery.

Online Redo Log Groups

o A set of identical copies of online redo log files is called an online redo
log group.
o The backround process LGWR concurrently writes the same information to all
online redo log files in a group.
o The Oracle server needs a minimum of two online redo log file groups for the
normal operation of a database. We suggest at least three.

Online Redo Log Members

o Each online redo log file in a group is called a member.


1

o Each member in a group has identical log sequence number and the same size.
The log sequence number is assigned each time the server starts writing to a log
group to identify each redo log file uniquely.
The current log sequence number is stored in the control file and in the header
of all data files.

Obtaining Information about Groups and Members


The following query returns information about the online redo log file from the
control file:

SQL> select group#, sequence#, bytes, members, status from v$log;


GROUP#

SEQUENCE# BYTES

MEMBERS

STATUS

---------- ---------- ---------- ---------- ---------------1

41 20971520

1 INACTIVE

42 20971520

1 CURRENT

2 rows selected.

The following query returns information about all members of a group:

SQL> select * from v$logfile;


GROUP#

STATUS MEMBER

---------- ------- ------------------------------------------------------------1

/u03/databases/v1020/redologs/v1020_redolog01.dbf

/u03/databases/v1020/redologs/v1020_redolog02.dbf

2 rows selected.

Adding Online Redo Log Groups


-----------------------------

In some cases you might need to create additional log file groups. For example,
2

adding groups can solve availability problems. To create a new group of


online redo log files use the following command:

ALTER DATABASE ADD LOGFILE


('/DISK3/log3a.rdo','/DISK4/log3b.rdo') size 1M;

In OMF the following statement creates redo log group and adds log members
automatically (No need to specify the filename) in the path specified by the
parameters
explained in the Oracle documentation for OMF.

ALTER DATABASE ADD LOGFILE;

Adding Online Redo Log Members


--------------------------------------You can add new member to an existing redo log file group using the following
command:
ALTER DATABASE ADD LOGFILE MEMBER
/DISK4/log1b.rdo' TO GROUP 1,
'/DISK4/log2b.rdo' TO GROUP 2;

In OMF, Adding Online Redo Log Members step is not required, as they are added
automatically when ADD LOGFILE is issued.

Dropping Online Redo Log Groups


-------------------------------To drop a group of online redo log files use the following command:

ALTER DATABASE DROP LOGFILE GROUP 3;

Same statement holds good for OMF, find the group number & issue the above
command.

Dropping Online Redo Log Members


-------------------------------To drop a member of an online redo log group use the following command:

ALTER DATABASE DROP LOGFILE MEMBER '/DISK4/log2b.dbf';

Same statement holds good for OMF, find the logfile member full_path_file_name
and drop the member.
The filenames of Oracle Managed Files are accepted in SQL statements wherever a
filename is used to identify an existing file, just like other filenames.

Caution
------When dropping redo log groups and redo log files, there must be at least two
redo log groups and each redo log group must have at least one log member.