Oracle 12c: Move datafile feature
Until the release 11g move a datafile was an operation very problematic; We had
to put the tablespace offline, copy the datafile to the new destination and rename it :
SQL> alter database rename datafile “A” to “B”;
From Oracle release Oracle 12c, you can move a datafile from a mount point to
another without having to put the tablespace offline .
All this is done while the database is active.
So with the command:
alter database
move datafile
‘/u01/app/oracle/oradata/FILE.dbf’
to
‘/u02/app/oracle/oradata/ORADB12/FILE.dbf’;
It is also possible to move a datafile from specific number that Oracle has assigned and move it to a new location, without specifying the old name of the datafile.
example:
SQL> select file#,name from v$datafile where file#=1;
FILE# NAME
———- ——————————————————-
1 /u01/app/oracle/oradata/ORADB12/FILE.dbf
1 rows selected.
SQL> alter database move datafile 1 to ‘/tmp/FILE.dbf’;
Database altered.
SQL> select file#,name from v$datafile where file#=1;
FILE# NAME
———- ——————————————————-
1 /tmp/FILE.dbf
1 rows selected.