Blog

How to rename Datafile in Oracle 12c


SQL> SELECT name FROM v$datafile WHERE name LIKE '%users01%';

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/cdb1/users01.dbf

SQL> ALTER TABLESPACE users OFFLINE NORMAL;

Rename the file on server level

HOST mv /u01/app/oracle/oradata/cdb1/users01.dbf /u01/app/oracle/oradata/cdb1/users02.dbf


ALTER TABLESPACE users
    RENAME DATAFILE '/u01/app/oracle/oradata/cdb1/users01.dbf' TO '/u01/app/oracle/oradata/cdb1/users02.dbf';

ALTER TABLESPACE users ONLINE;

SQL> SELECT name FROM v$datafile WHERE name LIKE '%users02%';

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/cdb1/users02.dbf

SQL>

Follow me

Contact us for Training/ Job Support

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.