Thursday, January 22, 2009

Migrating Database To ASM Using RMAN

RMAN is the only tool that can backup ASM files. It is not possible to backup using :

1)user-managd bakups
2) Os utilities and commands - they cant see ASM files as ASM files are created on raw disk and there is no file system for ASM files.

RMAN is used to migrate database to ASM.Follow the steps below.

Consider the case where we have an instance named "neworacle".We have three ASM diskgroups dgnew1 - dtles,dgnew2 - controlfile, dgnew3 - online log files.

Follow the steps given below:

1) Change COROLFILES instance parameter to point towards disk group.

SQL> Alter system set controlfiles='+dgnew2','+dgnew3' scope=spfile;

2) Shutdown the instance.
SQL> shutdown immediate;

3) Start database in nomount mode.
SQL>startup nomount;

4) Launch RMAN(RMAN client),restore controlfile from its original location:
RMAN> restore controlfile from '/originalloc/contrl1.con';

5) Issue the steps from RMAN prompt.We can script the list of steps and execute from RMAN prompt as well.This migrates the datafiles from its original location to ASM.

RMAN>shutdown immediate;
RMAN> startup mount;
RMAN>backup as copy database format '+dgnew1';
RMAN> switch database to copy;
RMAN>alter database open;

6) To migrate redologs, create new members in the diskgroups and drop the old members.

SQL>alter database add logfile member '+dgnew2','+dgnew3' to group 1;
SQL>alter database drop logfile member '/originalloc/log1a.rdo','/originalloc/log1b.rdo';

7) Final step is to move tempfiles.It is not possible to move tempfiles(temporary tablespace).So drop and recreate the temporary tablespace on a disk group.

No comments: