How to move datafiles in Oracle.



In this example, we will move UNDO tablespace datafiles in another location.



1- Check what daatfiles does contains UNDO tablespace.

SQL> select file_name
from dba_data_files
where tablespace_name='UNDOTBS';

file_name
--------------------------------
/home/ora11/oradata/db1/undo.dbf


2- SQL> shutdown immediate

3- Copy physically the datafile to the new location with same name.

mv /home/ora11/oradata/db1/undo.dbf  /home/ora11/oradata/db2/undo.dbf

4- SQL> startup mount

5- SQL> alter database rename file '/home/ora11/oradata/db1/undo.dbf ' to '/home/ora11/oradata/db2/undo.dbf';

6-  SQL> shutdown immediate
    SQL> startup
    SQL> select file_name
    from dba_data_files
    where tablespace_name='UNDOTBS';

    file_name
    --------------------------------
    /home/ora11/oradata/db2/undo.dbf



Comments