How to move a datafile from a ASM disk group to another
2/27/2012 07:16:00 PM
Gönderen Mete Karar
I'll explain two ways of moving a datafile from a ASM disk group to another disk group. As you might guess, during migration of the data file you need to take whether the whole tablespace or just the the datafile offline, which makes the difference between two approaches I'm about to explain.
Here is the first way:
1. Find the name of the datafile that you're going to migrate:
SQL> SELECT FILE_NAME FROM DBA_DATA_FILES WHERE tablespace_name = 'EXAMPLE';
2. Take the tablespace offline:
SQL> alter tablespace example offline;
3. Copy the file using RMAN:
RMAN> COPY datafile '+RECOVERY/orcl/datafile/example.123.123456789' to '+DATA';
4. Change datafile's name to the name displayed as output of the command above:
SQL> ALTER DATABASE RENAME FILE '<old_name>' TO '<output file name written at rman output>';
5. Bring back the tablespace online:
And here is the second way:
1. Find the name of the datafile that you're going to migrate just like firt method:
2. Take the datafile offline instead this time:
3. Copy the file using RMAN:
4. Change datafile's name to the new name displayed as output of the command above to update data dictionary:
5. Rename the datafile using RMAN to update ASM. This command is equivalent of "alter database rename file":
6. Recover the new datafile:
7. Bring it online
Both ways do the job. To choose between them is deciding whether tablespace can be taken offline for while or not.
5/6/14 18:26
Excelente, me fue muy util