Managing Redo log   «Prev  Next»
Lesson 6Moving redo log files
ObjectiveMove a redo log file.

Moving Redo Log Files

You might consider moving a redo log file to rearrange your database's use of disk. You can take a couple of different approaches, depending on whether or not you are willing to shut down your database.

Renaming a redo log file

If you are willing to shut down your database, you can move a redo log file by following these steps:
  1. Make a note of the current log file location.
  2. Shut down the database.
  3. Move the physical file to its new location using operating system commands.
  4. Restart the instance and mount the database usingSTARTUP MOUNT.
  5. Issue anALTER DATABASE RENAME FILE command to tell Oracle of the new location.
  6. Open the database usingALTER DATABASE OPEN.

You should already know how to mount and open a database from earlier courses in this series.
TheALTER DATABASE RENAME FILE command is new, and the syntax look like this:
ALTER DATABASE RENAME FILE 'old_filename' TO 'new_filename';

This command does not actually rename the file at the operating system level. It simply updates the database control file with the new information.

Dropping and re-creating Redo Log File

The other approach to "moving" a redo log file is to drop it and re-create it in the new location. Although this isn't really a move per se, the technique does allow you to accomplish your task without shutting down the database. Here are the steps to follow:
  1. Create a new log file group or member in the new location.
  2. Wait for a time when the old log file group or member is not current.
  3. Drop the old log file group or member.

Create Drop Technique

What you are doing is a create-and-drop technique, which works perfectly here because redo log files contain only transient information. Once a redo log file has been archived, it is no longe necessary to keep, and you can always retrieve it from the archive log destination if necessary. If you are moving one member at a time, you won't have any trouble because the other members of the group will still be valid. Creating new members and then dropping the old ones allow you to move redo log files to new disks without disrupting your client's use of the database.
In the next lesson, you will learn how to force a log switch manually.

Moving Redo Log Files - Quiz

Take this Quiz to see how well you understand the processes involved in creating and dropping redo log files.
Moving Redo Log Files - Quiz