Oracle Live

21/11/2014

ASM -Mover datafiles

Filed under: ASM — mogukiller @ 1:52 pm
Tags:

Se puede dar la situación en la que despues de una migración a ASM nos demos cuenta que ubicamos dbfs en el diskgroup incorrecto. El procedimiento para cambiarlos a la ubicación correcta es el siguiente.


12:24:14 moguland1 SQL>SELECT FILE_NAME FROM DBA_DATA_FILES;

FILE_NAME
--------------------------------------------------------
+DATA/asm/datafile/users.261.862681825
+DATA/asm/datafile/undotbs1.259.862681709
+DATA/asm/datafile/sysaux.257.862681481
+DATA/asm/datafile/system.258.862681533
+DATA/asm/datafile/example.256.862680521
+DATA/asm/datafile/undotbs2.260.862681817
+DATA/moguland/datafile/pruebas.262.862683347

-- Ponemos el datafile en offline o montamos la instancia

-- Probamos con la base de datos montada

rman> COPY DATAFILE '+DATA/asm/datafile/users.261.862681825' TO '+DATA';
/*
Starting backup at 21/11/14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 instance=moguland1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/asm/datafile/users.261.862681825
output file name=+DATA/moguland/datafile/users.263.864218323 tag=TAG20141121T123843 RECID=2 STAMP=864218323
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 21/11/14
*/

run {
set newname for datafile '+DATA/asm/datafile/users.261.862681825' to '+DATA/moguland/datafile/users.263.864218323' ;
switch datafile all;
}
/*
executing command: SET NEWNAME

datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=864218323 file name=+DATA/moguland/datafile/users.263.864218323
*/

ASMCMD> ls -l
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE NOV 21 12:00:00 Y PRUEBAS.262.862683347
DATAFILE UNPROT COARSE NOV 21 12:00:00 Y USERS.263.864218323

ASMCMD> rm -f +DATA/asm/datafile/users.261.862681825

-- Probamos con la base de datos levantada

sql> ALTER DATABASE DATAFILE '+DATA/asm/datafile/example.256.862680521' OFFLINE;
rman> COPY DATAFILE '+DATA/asm/datafile/example.256.862680521' TO '+DATA';
rman>run{
set newname for datafile '+DATA/asm/datafile/example.256.862680521' to '+DATA/moguland/datafile/EXAMPLE.264.864219257';
switch datafile all;
}
12:52:39 moguland1 SQL>RECOVER DATAFILE '+DATA/moguland/datafile/EXAMPLE.264.864219257';

Media recovery complete.

12:57:35 moguland1 SQL>ALTER DATABASE DATAFILE '+DATA/moguland/datafile/EXAMPLE.264.864219257' ONLINE;

Database altered.
ASMCMD> rm -f +DATA/asm/datafile/example.256.862680521

Crea un blog o un sitio web gratuitos con WordPress.com.

A %d blogueros les gusta esto: