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 mouseover 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:
  1. The command to use.
  2. The clause of the ALTER DATABASE command that allows you to add a member to a log file group.
  3. A complete path and filename reference identifying the name of the new member log file for the group.
  4. 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.
  5. Identifies the log file group to which you are adding a member. Identifying the group by number is usually the easiest approach to take.
  6. 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.
  7. 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.

Add Logfile Member
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 simulation shows you how:
  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