High Level Steps to Migrate Datafiles (Disk Groups)

From NazimWIKI
Jump to navigation Jump to search

Just some notes for my own reference.

Had to migrate all my datafiles on a database from one Disk Group (DATA) to Another (DATAR), using RMAN to copy the datafiles.


Pre-Requisites: . Database must be in Archive Log Mode . The database must be in Mounted mode for System and Undo Tablespaces.


Use SQL to take the datafile offline:

alter database datafile '+DATA/TESTDB/datafile/UNDOTBS1.275.785779587' offline;


Use RMAN to copy the datafile:

rman target /
copy datafile '+DATA/TESTDB/datafile/UNDOTBS1.275.785779587' to '+DATAR/TESTDB/datafile/UNDOTBS1';


Use SQL to advise the database of the change:

alter database rename file '+DATA/TESTDB/datafile/UNDOTBS1.275.785779587' to '+DATAR/TESTDB/datafile/UNDOTBS1';


Use RMAN to switch to and recover the datafile:

rman target /
switch datafile '+DATA2/TESTDB/datafile/UNDOTBS1' to copy;
recover datafile '+DATA2/TESTDB/datafile/UNDOTBS1';


Use SQL to put the datafile online:

alter database datafile '+DATA2/TESTDB/datafile/UNDOTBS1' online;






Other Ways of Doing this ....

rman target /
sql 'alter database datafile n offline';
copy datafile n to '+DATA/${ORACLE_SID}/datafile/datafilename.dbf';
switch datafile n to copy;
recover datafile n;
sql 'alter database datafile n online';



Or at a database level ....

rman target /
backup as copy database format '+DATA2';
list copy of database;
switch database to copy;
recover database;
report schema;
  • Note: The exact same steps are used on physical standby.

Following this the tempfile on the standby was relocated by running the following commands ...

alter tablespace temp drop tempfile '+DATA/<tempfile name>';
alter tablespace temp add tempfile '+DATA2';