Managing Tablespaces   «Prev  Next»
Lesson 12Moving data files
ObjectiveMove a data file to a new location.

Moving Data Files

Occasionally, you may need to move your data files to new locations. This could be because the file has become full or because a disk has been damaged. If a disk is full, you can relocate one or more data files to a different disk to free up space. If a disk is damaged, you may need to move a data file to a disk that still works.
To move a data file, follow these steps:
  1. Take the data file's tablespace offline.
  2. Use operating system commands to copy the data file to its new location.
  3. Issue an ALTER DATABASE statement to rename the data file.
  4. Bring the tablespace back online.

ALTER DATABASE Commands

The ALTER DATABASE statement that you use to rename a data file looks like this:
ALTER DATABASE RENAME 'oldfilename' TO 'newfilename';

Because this command changes the file's location only as recorded in the control file, you must still use operating system commands to move the file physically. The ALTER DATABASE command may be issued anytime the data file in question is closed.
For example, you may rename data files after using STARTUP MOUNT to mount an instance. The next lesson wraps up this module.
|

Moving Data Files - Quiz

Before you go on to the module wrap-up, take this quiz covering material from the previous two lessons.
Moving Data Files - Quiz