This procedure documents a working method for moving a datafile under Oracle RDBMS 11.2.0.4. In Oracle 12c, this procedure is replaced by a much simpler and less intrusive one.
This procedure needs an outage on the affected tablespace.
The database has to be in ARCHIVELOG mode.
To demonstrate this procedure, I ran the following command on the REPOS database:
create smallfile tablespace dummy datafile '/tmp/dummy01.dbf' size 5m autoextend on next 5m maxsize unlimited;
To see where all of the data files are located, I ran the following command:
select name from v$datafile;
The result was:
The following RMAN commands do:
sql 'alter tablespace dummy offline'; backup as copy datafile '/tmp/dummy01.dbf' format '/opt/oracle/app/oradata/repos/dummy01.dbf'; switch datafile '/tmp/dummy01.dbf' to copy; recover tablespace dummy; sql 'alter tablespace dummy online';