SELECT 'set newname for datafile '
|| a.file#
|| ' to ''&aux_data_mnt'
|| SUBSTR (a.NAME, INSTR (a.NAME, '/', -1, 1) + 1)
|| ''';'
FROM v$datafile a, v$tablespace b
WHERE a.ts# = b.ts# and
a.file# IN (SELECT DISTINCT file#
FROM v$backup_datafile)
UNION ALL
SELECT 'set newname for tempfile '
|| a.file#
|| ' to ''&aux_data_mnt'
|| SUBSTR (a.NAME, INSTR (a.NAME, '/', -1, 1) + 1)
|| ''';'
FROM v$tempfile a;
Una vez que obtuvimos los datafiles y tempfiles del script de arriba, podemos usar algo similar al template de abajo para poder clonar la instancia, reemplazando las partes del set new name, con el resultado del script
RUN
{
set until scn SCN_NUMBER;
ALLOCATE AUXILIARY CHANNEL CH1 TYPE DISK;
set newname for datafile 1 to '/data_location/datafile01.dbf';
set newname for datafile 2 to '/data_location/datafile02.dbf';
.
.
.
set newname for datafile nn to '/data_location/datafilenn.dbf';
set newname for tempfile 01 to '/data_location/tempfile01.dbf';
.
.
.
set newname for tempfile nn to '/data_location/tempfilenn.dbf';
duplicate target database to CLONED_DB open restricted
logfile
group 1 (
'/log_location/redo01g01.log',
'/log_location/redo02g01.log'
) size 100M,
group 2 (
'/log_location/redo01g02.log',
'/log_location/redo02g02.log'
) size 100M,
group 3 (
'/log_location/redo01g03.log',
'/log_location/redo02g03.log'
) size 100M
;
}
No hay comentarios.:
Publicar un comentario