Tuesday, June 5, 2012

how to move datafiles when you change db_unique name

I made a typo this week on the db_unique_name while configuring dataguard  and had to correct it. some datafiles where already created under the wrong db_unique_name ...


rman is you friend especially with ASM most of the time there it is your only friend.

so basically it comes down to put the correct DB_UNIQUE_NAME bounce the instance put it in mount ...

and of course make sure that you put the device channel disk in rman correctly in our case


 CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '+DATADG1'
errata :
       this is handled by the db_recovery_file_dest parameter or can be controlled
      with backup as copy ... format '+DATADG1' clause

so here goes :

rman target /


run
{
backup as copy datafile 652 ;
....
}


after this finishes 
     
run
{
switch datafile to copy ;
}



this is an example to do it on datafile level ofcourse you can do it on db level as well with




backup as copy database 






you can delete the old files in old asm directory.