How to move a datafile to different diskgroup in ASM

rman target / nocatalog cmdfile=rman_move_ts.cmd

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Mar 26 09:56:03 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: GES (DBID=1576423539)
using target database control file instead of recovery catalog

RMAN> run {
2> allocate channel c1 device type disk;
3> backup as copy tablespace USERS format '+DATA01';
4> release channel c1;
5> }
6>
7> sql 'alter tablespace users offline';
8> switch tablespace users to copy;
9> recover tablespace users;
10> sql 'alter tablespace users online';
11>
allocated channel: c1
channel c1: sid=1070 instance=ges1 devtype=DISK

Starting backup at 26-MAR-09
channel c1: starting datafile copy
input datafile fno=00006 name=+SYS01/ges/datafile/users.265.675517679
output filename=+DATA01/ges_ges/datafile/users.260.682509367 tag=TAG20090326T095606 recid=20 stamp=682509394
channel c1: datafile copy complete, elapsed time: 00:00:35
Finished backup at 26-MAR-09

Starting Control File and SPFILE Autobackup at 26-MAR-09
piece handle=/apps/warehouse2/rman/wbeqdrac07p_ges/cf_c-1576423539-20090326-00.bak comment=NONE
Finished Control File and SPFILE Autobackup at 26-MAR-09

released channel: c1

sql statement: alter tablespace users offline

datafile 6 switched to datafile copy "+DATA01/ges_ges/datafile/users.260.682509367"

Starting recover at 26-MAR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1070 instance=ges1 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=1065 instance=ges1 devtype=DISK
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=1052 instance=ges1 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: Data Protection for Oracle: version 5.5.1.0
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: sid=1049 instance=ges1 devtype=SBT_TAPE
channel ORA_SBT_TAPE_2: Data Protection for Oracle: version 5.5.1.0

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

Finished recover at 26-MAR-09

sql statement: alter tablespace users online

Recovery Manager complete.

After this you may also need to delete the old file.

> asmcmd
ASMCMD [+] > cd SYS01/GES/DATAFILE
ASMCMD [+SYS01/GES/DATAFILE] > ls
SYSAUX.261.675517645
SYSTEM.259.675517625
UNDOTBS1.260.675517635
UNDOTBS2.263.675517655
UNDOTBS3.264.675517665
USERS.265.675517679
ASMCMD [+SYS01/GES/DATAFILE] > rm USERS.265.675517679

No comments:

Post a Comment