Label

Wednesday, June 14, 2017

Relocate and Rename ASM datafile.

col file_name format a60
set linesize 130
select 'alter database datafile '''||file_name ||''' offline;' from dba_data_files where file_name like '+ORCL_DATA1%';


SQL> alter database datafile '+ORCL_DATA1/ORCL/datafile/dwprd.538.890842741' offline;


RMAN> copy datafile '+ORCL_DATA1/ORCL/datafile/dwprd.538.890842741'  to '+ORCL_DATA'; 

Starting backup at 24-SEP-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1903 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00044 name=+ORCL_DATA1/ORCL/datafile/dwprd.538.890842741
output file name=+ORCL_DATA/ORCL/datafile/dwprd.272.891298569 tag=TAG20150924T225609 RECID=1 STAMP=891298705
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:25
Finished backup at 24-SEP-15

Starting Control File and SPFILE Autobackup at 24-SEP-15
piece handle=/orcldb/db/orcl_base/11.2.0/dbs/c-941435738-20150924-01 comment=NONE
Finished Control File and SPFILE Autobackup at 24-SEP-15


SQL> alter database rename file '+ORCL_DATA1/ORCL/datafile/dwprd.538.890842741' to '+ORCL_DATA/ORCL/datafile/dwprd.272.891298569';


RMAN> switch datafile '+ORCL_DATA/ORCL/datafile/dwprd.272.891298569' to copy;


RMAN> recover datafile '+ORCL_DATA/ORCL/datafile/dwprd.272.891298569';


SQL> alter database datafile '+ORCL_DATA/ORCL/datafile/dwprd.272.891298569' online;

No comments:

Post a Comment