Wednesday 2 November 2016

How to rename datafile in oracle database?

Steps

1)Bring the tablespace offline
2)Move the datafile at OS level
3)Rename datafile using sql command
4)Bring the tablespace online


1)Bring the tablespace offline
SQL> alter tablespace CTXD offline;

Tablespace altered.


2)Move the datafile at OS level
ls -lrth ctxd01.dbf
-rw-r-----   1 oracle dba      30M Apr  4 18:05 ctxd01.dbf

mv ctxd01.dbf ctxd02.dbf

3)Rename datafile using sql command
SQL> alter tablespace CTXD rename datafile '/u01/dbdata/data1/ctxd01.dbf' to '/u01/dbdata/data1/ctxd02.dbf';

Tablespace altered.


4)Bring the tablespace online
SQL> alter tablespace CTXD online;

Tablespace altered.

No comments:

Post a Comment