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:
- Take the data file's tablespace offline.
- Use operating system commands to copy the data file to its new location.
- Issue an
ALTER DATABASE
statement to rename the data file.
- Bring the tablespace back online.
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.
|