Wednesday, 21 May 2014

Online Data-file Movement



In earlier Version (Prior to 12c Release):

To move or rename a data file in earlier versions (9i,10g,11g) we used to perform the below steps.
a. Shutdown the database.
b. Rename the physical file on the OS using mv command on Linux/Unix.
c. Start the database in mount mode.
d. Issue the below command on sql prompt to rename the file within the Oracle dictionary.

ALTER DATABASE RENAME FILE < old_file_name/path>   to   <new_file_name/path>; 
     
                                                                 OR

ALTER DATABASE MOVE DATAFILE ‘< Source Path >‘ TO ‘< Destination Path >';


e. Open the database.



In Oracle 12c Release:

In order to rename the datafile in oracle 12c Release, there is no need to perform all above time consuming steps. life with oracle 12c is much easier. Just one step is enough. Also there is no downtime required in this activity.

ALTER DATABASE RENAME FILE < old_file_name/path>   to   <new_file_name/path>; 

                                                     
                                                                    OR

ALTER DATABASE MOVE DATAFILE ‘< Source Path >‘ TO ‘< Destination Path >';

2 comments: