Nov 20, 2009

Move ASM files across diskgroups

Below are the steps to move ASM files from one ASM disk group to another:

Note:Make sure the database is in archive log mode before proceeding with the below exercise.

  1. Identify the data file to be moved.
  2. SQL>Select file_name from dba_data_files;
    FILE_NAME
    --------------------------------------------------------------------------------
    +DATA/easydw/datafile/tbl_abacus.271.703296941
  3. Identify the diskgroup on to which the file has to be moved.
  4. ASM>SELECT name FROM v$asm_diskgroup;
    NAME
    ------------------------------
    DATA
    FRA
  5. Take the file offline.
  6. SQL>ALTER DATABASE DATAFILE '+DATA/easydw/datafile/tbl_abacus.271.703296941' OFFLINE';
  7. Copy the file to new diskgroup using RMAN.
  8. $ rman target /
    RMAN> COPY DATAFILE '+DATA/easydw/datafile/tbl_abacus.271.703296941' TO '+FRA';
    Starting backup at 20-NOV-09
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=140 devtype=DISK
    channel ORA_DISK_1: starting datafile copy
    input datafile fno=00028 name=+DATA/easydw/datafile/tbl_abacus.271.703296941
    output filename=+FRA/easydw/datafile/tbl_abacus.316.703382539 tag=TAG20091120T000218 recid=2 stamp=703382539
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
    Finished backup at 20-NOV-09
    Starting Control File and SPFILE Autobackup at 20-NOV-09
    piece handle=+FRA/easydw/autobackup/2009_11_20/s_703382539.317.703382541 comment=NONE
    Finished Control File and SPFILE Autobackup at 20-NOV-09
  9. Rename the file to point to new location.
  10. SQL>ALTER DATABASE RENAME FILE '+DATA/easydw/datafile/tbl_abacus.271.703296941'
              TO '+FRA/easydw/datafile/tbl_abacus.316.703382539';
  11. Switch data file copy
  12. RMAN> SWITCH DATAFILE '+FRA/easydw/datafile/tbl_abacus.316.703382539' TO COPY;
  13. Recover the file.
  14. SQL> RECOVER DATAFILE '+FRA/easydw/datafile/tbl_abacus.316.703382539';
  15. Bring the file online.
  16. SQL> ALTER DATABASE DATAFILE '+FRA/easydw/datafile/tbl_abacus.316.703382539' ONLINE;
  17. Verify the new file locations.
  18. SQL>SELECT file_name FROM dba_data_files;
    FILE_NAME
    --------------------------------------------------------------------------------
    +FRA/easydw/datafile/tbl_abacus.316.703382539
  19. Delete the file from its original location.
  20. $ export ORACLE_SID=+ASM
    $ sqlplus "/ as sysdba"
    ASM> ALTER DISKGROUP DATA DROP FILE '+DATA/easydw/datafile/tbl_abacus.271.703296941';

No comments:

Post a Comment

Search This Blog