Managing Redo log   «Prev  Next»
Lesson 4 Creating new redo log files
ObjectiveCreate new redo log file groups and members.

Creating new redo log files

You can add a new redo log group to a database at any time using the ALTER DATABASE command.
The following script shows the syntax for adding a new log file group:
ALTER DATABASE
  ADD LOGFILE [GROUP group_number]
  ('filename','filename'...) SIZE integer [REUSE];
Add Group
  1. The command to use.
  2. The clause of the ALTER DATABASE command that allows you to add a log file group.
  3. Optionally allows you to pick the group number for the group that you are creating. If you omit this, Oracle will generate the group number for you.
  4. A complete path and filename reference identifying the name of a member log file for the group. You may create as many members for a group as you like.
  5. If you are creating a group with only one member, you may omit the parentheses.
  6. Specifies the size of log files in this group. The value integer represents a number of bytes. You may append a K or an M for kilobytes or megabytes. Thus, 1m = 1000K = 1024000. If you do not specify a size, Oracle will assume that the files already exist and will attempt to reuse them.
  7. Optionally allows you to reuse a set of existing log files. All the files listed must exist, and their size must match that specified by the SIZE parameter.

Creating new redo log file group

  1. This is the opening screen that you will see after you start Storage Manager and connect to your database. Click the + sign next to the Database icon to expand the tree.
  2. Click the Redo Log Groups folder to see the current list of redo log groups for the database.
  3. Oracle will display a list of redo log groups currently in the database. In this case, there are currently five groups. To create a new group, begin by right-clicking on the Redo Log Groups folder.
  4. Select Create from the fly-out menu.
  5. Storage Manager will open the Create Redo Log Group window. Notice that Storage Manager has preselected both a size and a filename. You could edit those choices, but for this simulation, we will accept them. Go ahead and click the Create button to create the new group.
  6. Storage Manager will display a dialog confirming that it has created the new redo log group.
To create a fifth log file group for the COIN database, assuming that you have four to start with, you could issue a command like this:
ALTER DATABASE
ADD LOGFILE GROUP 5

('D:\ORACLE\ORADATA\COIN\REDOCOIN05A',

'E:\ORACLE\ORADATA\COIN\REDOCOIN05B') SIZE 10m;

Oracle also allows you to add log file members to an existing group. To do that, use this form of theALTER DATABASE command:
ALTER DATABASE
ADD LOGFILE MEMBER
'new_filename' [REUSE] 'new_filename' [REUSE]...
TO GROUP group_number;
TO ('existing_filename','existing_filename'...);
A command script or syntax reference for modifying a database, specifically for altering the log file configuration in a database system.
Description of the Command
  1. Command Structure: This is an SQL command intended to alter the log file settings of a database, which is crucial for data recovery and management purposes.
  2. Command Keywords:
    • ALTER DATABASE: This is the main command used to make changes to the database structure.
    • ADD LOGFILE MEMBER: This clause is used to add new log file members to a log file group.
  3. Parameters:
    • new_filename: Specifies the names of new log files to be added. The option [REUSE] indicates that the database should reuse an existing file if it already exists, rather than creating a new one.
    • group_number: Identifies the log file group to which the new members should be added.
    • existing_filename: Specifies existing log files to which the new log file members will be associated.

This command is typical in database systems that require precise control over log file management, such as Oracle or SQL Server, where log files play a critical role in data integrity and recovery mechanisms.

Add logfile member in Oracle

Adding members
Adding members

ALTER DATABASE The command to use.
ADD LOGFILE MEMBER The clause of the ALTER DATABASE command that allows you to add a member to a log file group.
new filname A complete path and filename reference identifying the name of the new member log file for the group.
REUSE An optional parameter that allows you to reuse an existing file, provided that it is the correct size. Its size must match that of the existing group members.
TO GROUP group_number; Identifies the log file group to which you are adding a member. Identifying the group by number is usually the easiest approach to take.
TO 'existing_filename'; You may optionally identify a log file group by naming its member files. If there is only one member filename, this is how you specify it.
TO ('existing_filename', 'existing_filename'...); If you are adding to a group with multiple files already and you want to identify the group by listing all those files, this is how you do it.


To add a member to group 5, the group that we just created, you could issue a command like this:
ALTER DATABASE
ADD LOGFILE MEMBER

'G:\ORACLE\ORADATA\COIN\REDOCOIN05C'
TO GROUP 5;

You do not need to specify a size when creating a new member. Oracle will create the file sized to match the existing group members. Note that in this example, the group was identified by number. That's the easiest approach to take. Identifying a group by listing all the member filenames is a very tedious and error-prone process.
Note: Your ability to create new members in a log file group is limited by the value that you specified forMAXLOGMEMBERS when you first created the database. Your ability to create new groups is limited by the value specified forMAXLOGFILES.

Simulation

You can use Enterprise Manager's Storage Manager application to create redo log groups. This following series of images shows you how:
Oracle Storage Manager System
1) Oracle Storage Manager System

Coin System
2) Coin System

Redo Log Groups
3) Redo Log Groups

Create
4) Create

Create Redo Log Group
5) Create Redo Log Group

Redo Log Group created successfully
6) Redo Log Group created successfully


  1. This is the opening screen that you will see after you start Storage Manager and connect to your database. Click the + sign next to the Database icon to expand the tree.
  2. DatabasePlusSign
  3. Click the Redo Log Groups folder to see the current list of redo log groups for the database.
  4. ClickRedoLogGroups
  1. Oracle will display a list of redo log groups currently in the database. In this case, there are currently five groups. To create a new group, begin by right-clicking on the Redo Log Groups folder.
  2. RightClick RedoLogGroups
  3. Select Create from the fly-out menu.
  4. SelectCreate
  1. Storage Manager will open the Create Redo Log Group window. Notice that Storage Manager has preselected both a size and a filename. You could edit those choices, but for this simulation, we'll accept them. Go ahead and click the Create button to create the new group.
  2. ClickCreateButton
  3. Storage Manager will display a dialog confirming that it has created the new redo log group. This is the end of the simulation. Click the Exit button.

Creating new redo log file group

  1. This is the opening screen that you will see after you start Storage Manager and connect to your database. Click the + sign next to the Database icon to expand the tree.
  2. Click the Redo Log Groups folder to see the current list of redo log groups for the database.
  3. Oracle will display a list of redo log groups currently in the database. In this case, there are currently five groups. To create a new group, begin by right-clicking on the Redo Log Groups folder.
  4. Select Create from the fly-out menu.
  5. Storage Manager will open the Create Redo Log Group window. Notice that Storage Manager has preselected both a size and a filename. You could edit those choices, but for this simulation, we will accept them. Go ahead and click the Create button to create the new group.
  6. Storage Manager will display a dialog confirming that it has created the new redo log group.
In the next lesson, you will learn how to drop redo log files.

Creating Redo Groups - Exercise

For an exercise, try your hand at creating a new redo log file group for the COIN database.
Creating Redo Groups - Exercise

SEMrush Software