|Lesson 6||Moving redo log files |
|Objective||Move 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:
- Make a note of the current log file location.
- Shut down the database.
- Move the physical file to its new location using operating system commands.
- Restart the instance and mount the database using
- Issue an
ALTER DATABASE RENAME FILE command to tell Oracle of the new location.
- Open the database using
ALTER DATABASE OPEN.
You should already know how to mount and open a database from earlier courses in this series.
ALTER 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:
- Create a new log file group or member in the new location.
- Wait for a time when the old log file group or member is not current.
- 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