// // Renaming and Relocating Datafiles Online

A technical troubleshooting blog about Oracle with other Databases & Cloud Technologies.

Renaming and Relocating Datafiles Online

1 min read

Relocating an Online Data File

SQL> ALTER DATABASE MOVE DATAFILE '/rman_backup/backup/datafile1' TO '+DATA';
 
Database altered.

Copying an Online Data File

This example copies the data file to  +DEV_DG and the old file is retained in the /rman_backup/backup directory.

SQL> ALTER DATABASE MOVE DATAFILE '/rman_backup/backup/datafile1' TO '+DATA' KEEP ;
 
Database altered.

Relocating an Online Data File and Overwriting an Existing File

This example moves the data file to /rman_backup/backup directory. If a file with the same name exists in the /rman_backup/backup directory, then the statement overwrites the file.

SQL> ALTER DATABASE MOVE DATAFILE '+DATA/CDATA/ED7B4B/DATAFILE/datafile1' TO '/rman_backup/backup/datafile1' REUSE  ;