27
Oct
09

Move or Rename Datafile in RAC + ASM Environment

Moving datafile is a common task we used to do as a DBA. Most of the time this was caused by placing the datafile in the wrong directory.
This time I got a call from the customer saying that one of their team miss placed 3 datafiles while creating them.

So what are we going to do now?  How can we move those 3 datafiles to the right place?
Please note this, the datafiles were still in ASM however it is not in the right folder.

Here are the steps:

  1. Check the file number and the path to the datafile.
    SELECT file#, name FROM v$datafile;
    or
    SELECT file#, name FROM v$datafile WHERE name like ‘%custdata07.dbf%’;
    The same goes with the other 2 datafiles.

    For example, lets say that file# for custdata07.dbf is 75. Currently it is located in +DATA/oradata/custdata07.dbf and supposed to be located in +DATA/oradata/prod/custdata07.dbf.

  2. We have to bring the datafile offline first.
    ALTER DATABASE DATAFILE 75 OFFLINE;
  3. Now we have to go to RMAN to make a backup, do the datafile switch, recover the datafile and finally bring it online.
    C:\> rman target sys
    password: <your secret password>
    RMAN> backup as copy datafile 75 format ‘+DATA/oradata/prod/custdata07.dbf’;
    RMAN> switch datafile 75 to copy;
    RMAN> recover datafile 75;
  4. Now this is the last step  which is bring the datafile online.
    C:\> sqlplus /nolog
    SQL> connect sys as sysdba
    password: <your secret password>
    SQL> alter database datafile 75 online;
  5. Please double check in the v$datafile view and make sure that the datafile is already there.

This article is made based on the following link with some simplification here and there and also as my own reference.


0 Responses to “Move or Rename Datafile in RAC + ASM Environment”



  1. No Comments Yet

Leave a Reply




Calendar

October 2009
M T W T F S S
« Aug    
 1234
567891011
12131415161718
19202122232425
262728293031  

Posts