Move ASM files from one diskgroup to another diskgroup
---------------------------------------------------------------------------
Step 1: Get the data file name:
select file_name from dba_data_files where file_name like '%user%';
Step 2: Identify the target diskgroup to migrate to:
select name from v$asm_diskgroup;
FRA
Step 3: Take the old data file offline:
alter database datafile '+DATA/RAC/DATAFILE/users.261.898200463' offline;
Step 4: Copy the datafile to the new diskgroup (using RMAN)
$ rman target /
connected to target database: RAC (DBID=2486182530)
RMAN> copy datafile '+DATA/RAC/DATAFILE/users.261.898200463' to '+FRA';
Starting backup at 2-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=262 instance=RAC1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/RAC/DATAFILE/users.261.898200463
output file name=+FRA/RAC/DATAFILE/users.271.902270597 tag=TAG20160127T224316 RECID=3 STAMP=902270598
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2-JAN-15
Starting Control File and SPFILE Autobackup at 2-JAN-15
piece handle=+FRA/RAC/AUTOBACKUP/2016_01_27/s_902270598.261.902270605 comment=NONE
Finished Control File and SPFILE Autobackup at 2-JAN-15
Step 6: Re-name the data file:
SQL> alter database rename file '+DATA/RAC/DATAFILE/users.261.898200463' to '+FRA/RAC/DATAFILE/users.271.902270597';
Step 7: Get the new filename:
SQL> select file_name from dba_data_files where file_name like '%user%';
FILE_NAME
--------------------------------------------------------------------------------
+FRA/RAC/DATAFILE/users.271.902270597
Step 8: Rename the RMAN data file:
RMAN> switch datafile '+FRA/RAC/DATAFILE/users.271.902270597' to copy;
using target database control file instead of recovery catalog
datafile 6 switched to datafile copy "+FRA/RAC/DATAFILE/users.271.902270597"
Step 9: Use RMAN recovery to the new data file:
RMAN> recover datafile '+FRA/RAC/DATAFILE/users.271.902270597';
Starting recover at 2-JAN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=284 instance=RAC1 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 2-JAN-15
Step 10: Put the data file online:
RMAN> alter database datafile '+FRA/RAC/DATAFILE/users.271.902270597' online;
Statement processed
After Oracle renames the ASM database file in the data dictionary, it will remove the original ASM database file
No comments:
Post a Comment