Moving Datafile RMAN

Can someone please provide steps\commands to move a datafile between disk groups using RMAN.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Don't use RMAN to move datafiles.

Use standard SQLPLUS with Oracle DDL commands.

1) Take tablespace offline (if is system or undo tablespace you have to shutdown and go to mount mode)
2) Issue: alter tablespace foo name datafile '/old/path/foo.dbf' to '/new/path/foo.dbf'
3) Copy or move the filename at the OS level with appropriate command
4) Bring tablespace online

This is standard procedure, RMAN is not required
crishna1, my apologies, I assumed you meant a normal datafile in a standard volume manager disk group, but perhaps you were asking regarding moving between ASM disk groups? You can indeed use RMAN. Is this what you were requesting?

Since this is probably what you mean, here is a sample:

1) SQL> alter tablespace foo offline;
2) RMAN> copy datafile 'c:/oradata/ora1/foo.dbf' to 'd:/oradata/ora1/foo.dbf';
3) SQL> alter tablespace foo rename datafile 'c:/oradata/ora1/foo.dbf' to 'd:/oradata/ora1/foo.dbf';
4) SQL> alter tablespace foo online;

For ASM replace the filenames above in steps 2 and 3 with ASM paths

2) RMAN> copy datafile '+DISKGROUP1/ora1/foo.dbf.123' to '+DISKGROUP2/ora1/foo.dbf.123;
3) SQL> alter tablespace foo rename datafile '+DISKGROUP1/ora1/foo.dbf.123' to '+DISKGROUP1/ora1/foo.dbf.123';


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Copy datafile of the tablespace to the new diskgroup
Bring tablespace to offline mode
Switch datafile to its new location
Recover the tablespace
Bring tablespace to online mode
RMAN> run{
3> copy datafile 169 to +DGRP;
4> release channel disk1;
5> }

allocated channel: disk1
channel disk1: sid=450 devtype=DISK

Starting backup at 12-JUN-08 21:10:19
channel disk1: starting datafile copy
input datafile fno=00169 name=+DGROUP1/dds/datafile/cmp_default.463.645917347
output filename=+DGRP/dds/datafile/cmp_default.1093.657234623 tag=TAG20080612T211021 recid=7533 stamp=657234623
channel disk1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 12-JUN-08 21:10:25

Starting Control File and SPFILE Autobackup at 12-JUN-08 21:10:25
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657234626.7000.657234627 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:10:30

released channel: disk1

RMAN> sql alter tablespace cmp_default offline;

sql statement: alter tablespace cmp_default offline

RMAN> switch datafile 169 to copy;

datafile 169 switched to datafile copy +DGRP/dds/datafile/cmp_default.1093.6572346233

RMAN> recover tablespace cmp_default;

Starting recover at 12-JUN-08 21:13:20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=450 devtype=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 12-JUN-08 21:13:26

RMAN> sql alter tablespace cmp_default online;

sql statement: alter tablespace cmp_default online


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Enterprise Software

From novice to tech pro — start learning today.