Rename/move a data file in Oracle

Rename/move a data file in Oracle

For oracle 12c, move or rename of datafile can be done online with one line

alter database move datafile 'E:\oradata\hello.dbf' to 'F:\oradata\hello1.dbf';

Make the tablespace offline:

alter database datafile 'E:\oradata\hello.dbf' offline;

Move the file physically to a new location.

mv E:\oradata\test.dbf F:\oradata\produce01.dbf

Rename at DB level

alter database rename file 'E:\oradata\test.dbf' to 'F:\oradata\producing01.dbf';

Make the datafile online:

alter database datafile 'E:\oradata\test.dbf' online;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.