Por Joel Perez , Mahir M. Quluzade (OCE) & Sebastián D'Alessandro (OCE)
Publicado en Mayo 2015
Índice:
Veamos el décimo ejemplo para duplicar una base de datos con RMAN en modo activo.
Antes de continuar con la lectura le aconsejamos leer la (parte I) de esta serie para que pueda estar seguro de comprender la teoría relacionada con estos artículos. Si preparó su host destino como se indica en los 7 pasos descritos en la (parte 1), entonces podrá duplicar la base de datos utilizando RMAN.
En el siguiente ejemplo estamos trabajando inicialmente como base de datos origen con la CDB llamada “prmcdb” que será duplicada en la CDB llamada “dupcdb” como ocurre en otra parte de esta serie de artículo. A continuación podemos ver nuestra base de datos CDB origen: prmcdb.
[oracle@oel62-ora12c-prm ~]$ export ORACLE_SID=prmcdb
[oracle@oel62-ora12c-prm ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Apr 14 09:51:44 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter pluggable database all open;
Pluggable database altered.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
----------------------------- --------------------
PDB$SEED READ ONLY
PRMPDB01 READ WRITE
PRMPDB02 READ WRITE
SQL> select con_id, tablespace_name from cdb_tablespaces order by 1,2;
CON_ID TABLESPACE_NAME
-------- ------------------------------
1 SYSAUX
1 SYSTEM
1 TEMP
1 UNDOTBS1
1 USERS
2 SYSAUX
2 SYSTEM
2 TEMP
3 PDB01_TBS1
3 PDB01_TBS2
3 SYSAUX
CON_ID TABLESPACE_NAME
-------- ------------------------------
3 SYSTEM
3 TEMP
3 USERS
4 PDB02_TBS1
4 PDB02_TBS2
4 SYSAUX
4 SYSTEM
4 TEMP
4 USERS
5 SYSAUX
5 SYSTEM
CON_ID TABLESPACE_NAME
-------- ------------------------------
5 TEMP
5 USERS
24 rows selected.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prmcdb/system01.dbf
/u01/app/oracle/oradata/prmcdb/sysaux01.dbf
/u01/app/oracle/oradata/prmcdb/undotbs01.dbf
/u01/app/oracle/oradata/prmcdb/pdbseed/system01.dbf
/u01/app/oracle/oradata/prmcdb/users01.dbf
/u01/app/oracle/oradata/prmcdb/pdbseed/sysaux01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb01/system01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb01/sysaux01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb01/prmpdb01_users01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb02/system01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb02/sysaux01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb02/prmpdb02_users01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb03/system01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb03/sysaux01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb03/prmpdb03_users01.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb01/pdb01_tbs1.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb01/pdb01_tbs2.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb02/pdb02_tbs1.dbf
/u01/app/oracle/oradata/prmcdb/prmpdb02/pdb02_tbs2.dbf
19 rows selected.
Como puede observarse en la salida, nuestra CDB origen (prmcdb) tiene dos PDBs: prmpdb01 and prmpdb02. También, tiene creados los tablespaces PDB01_TBS1, PDB01_TBS2 en la PDB prmpdb01 y los tablespaces PDB02_TBS1, PDB02_TBS2 en la PDB prmpdb02. Si usted no ha creado esos tablespaces en las PDBs, puede utilizar los scripts de creación del caso 8 en la parte IX de esta serie de artículos.
En este caso duplicamos la PDB prmpdb01 y el tablespace PDB02_TBS2 del PDB prmpdb02 . Usamos el comando duplicate de RMAN con las siguientes opciones:
Opción de duplicación | Skip Tablespace - skip tablespace prmpdb01:pdb01_tbs2 |
Tipo de duplicación | Active Database Duplication |
Método de duplicación | Pull-Based |
Tipo de backup utilizado | BACKUPSETS (default) |
Número de “Target Channels” | 1 (default) |
Número de “Auxiliary Channels” | 1 (default) |
El comando duplicate de RMAN en este caso quedará de la siguiente manera:
duplicate database to dupcdb skip tablespace prmpdb01:pdb01_tbs2
from active database
spfile
parameter_value_convert ='prmcdb','dupcdb'
set db_file_name_convert ='prmcdb','dupcdb'
set log_file_name_convert ='prmcdb','dupcdb';
Descripción del código:
Como puede verse en el código, RMAN duplicará la PDB prmpdb01 ignorando el tablespace PDB01_TBS2. Con este comando duplicate, RMAN duplica todos las PDBs incluida prmpdb01 , pero ignora el tablespace PDB01_TBS02 de la PDB prmpdb01 . Los canales target y auxiliary no son asignados de manera explícita en este código. RMAN asigna solamente un channel default para target y otro para auxiliary (ORA_ DISK_1 and ORA_AUX_DISK_1). La cantidad de target y auxiliary channels es la misma, esto significa que en este caso RMAN utilizara el método Pull-Based para la duplicación. También utilizamos para este caso los parámetros parameter_value_convert y db{log}_file_name_convert en el comando duplicate. El uso de estos parámetros está explicado en la primera parte (parte 1) de esta serie de artículos.
En la salida podemos observar un procedimiento normal de duplicación como siempre fue en versiones anteriores.
Veamos este código en acción:
[oracle@oel62-ora12c-prm ~]$ rman
Recovery Manager: Release 12.1.0.1.0 - Production on Mon Apr 14 12:08:48 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
RMAN> connect target "sys/******@prmcdb as sysdba";
connected to target database: PRMCDB (DBID=2508276746)
RMAN> connect auxiliary "sys/******@dupcdb as sysdba";
connected to auxiliary database: DUPCDB (not mounted)
Recovery Manager: Release 12.1.0.1.0 - Production on Mon Apr 14 13:03:13 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
RMAN> duplicate database to dupcdb skip tablespace prmpdb01:pdb01_tbs2
2> from active database
3> spfile
4> parameter_value_convert='prmcdb','dupcdb'
5> set db_file_name_convert='prmcdb','dupcdb'
6> set log_file_name_convert='prmcdb','dupcdb';
Starting Duplicate Db at 14-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=21 device type=DISK
current log archived
contents of Memory Script:
{
restore clone from service 'prmcdb' spfile to
'/u01/app/oracle/product/12.1.0/dbhome/dbs/spfiledupcdb.ora';
sql clone "alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome/dbs/spfiledupcdb.ora''";
}
executing Memory Script
Starting restore at 14-APR-14
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: restoring SPFILE
output file name=/u01/app/oracle/product/12.1.0/dbhome/dbs/spfiledupcdb.ora
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 14-APR-14
sql statement: alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome/dbs/spfiledupcdb.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''DUPCDB'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set audit_file_dest =
''/u01/app/oracle/admin/dupcdb/adump'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/u01/app/oracle/oradata/dupcdb/control01.ctl'', ''/u01/app/oracle/fra/dupcdb/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=dupcdbXDB)'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''prmcdb'', ''dupcdb'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''prmcdb'', ''dupcdb'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''DUPCDB'' comment= ''duplicate'' scope=spfile
sql statement: alter system set audit_file_dest = ''/u01/app/oracle/admin/dupcdb/adump'' comment= '''' scope=spfile
sql statement: alter system set control_files = ''/u01/app/oracle/oradata/dupcdb/control01.ctl'', ''/u01/app/oracle/fra/dupcdb/control02.ctl'' comment= '''' scope=spfile
sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=dupcdbXDB)'' comment= '''' scope=spfile
sql statement: alter system set db_file_name_convert = ''prmcdb'', ''dupcdb'' comment= '''' scope=spfile
sql statement: alter system set log_file_name_convert = ''prmcdb'', ''dupcdb'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1219260416 bytes
Fixed Size 2287768 bytes
Variable Size 838862696 bytes
Database Buffers 369098752 bytes
Redo Buffers 9011200 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''PRMCDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''DUPCDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone from service 'prmcdb' primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''PRMCDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''DUPCDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1219260416 bytes
Fixed Size 2287768 bytes
Variable Size 838862696 bytes
Database Buffers 369098752 bytes
Redo Buffers 9011200 bytes
Starting restore at 14-APR-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
output file name=/u01/app/oracle/oradata/dupcdb/control01.ctl
output file name=/u01/app/oracle/fra/dupcdb/control02.ctl
Finished restore at 14-APR-14
database mounted
Checking that duplicated tablespaces are self-contained
Datafile 35 skipped by request
contents of Memory Script:
{
set newname for datafile 1 to
"/u01/app/oracle/oradata/dupcdb/system01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/dupcdb/sysaux01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/dupcdb/undotbs01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/dupcdb/pdbseed/system01.dbf";
set newname for datafile 6 to
"/u01/app/oracle/oradata/dupcdb/users01.dbf";
set newname for datafile 7 to
"/u01/app/oracle/oradata/dupcdb/pdbseed/sysaux01.dbf";
set newname for datafile 8 to
"/u01/app/oracle/oradata/dupcdb/prmpdb01/system01.dbf";
set newname for datafile 9 to
"/u01/app/oracle/oradata/dupcdb/prmpdb01/sysaux01.dbf";
set newname for datafile 10 to
"/u01/app/oracle/oradata/dupcdb/prmpdb01/prmpdb01_users01.dbf";
set newname for datafile 28 to
"/u01/app/oracle/oradata/dupcdb/prmpdb02/system01.dbf";
set newname for datafile 29 to
"/u01/app/oracle/oradata/dupcdb/prmpdb02/sysaux01.dbf";
set newname for datafile 30 to
"/u01/app/oracle/oradata/dupcdb/prmpdb02/prmpdb02_users01.dbf";
set newname for datafile 31 to
"/u01/app/oracle/oradata/dupcdb/prmpdb03/system01.dbf";
set newname for datafile 32 to
"/u01/app/oracle/oradata/dupcdb/prmpdb03/sysaux01.dbf";
set newname for datafile 33 to
"/u01/app/oracle/oradata/dupcdb/prmpdb03/prmpdb03_users01.dbf";
set newname for datafile 34 to
"/u01/app/oracle/oradata/dupcdb/prmpdb01/pdb01_tbs1.dbf";
set newname for datafile 36 to
"/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs1.dbf";
set newname for datafile 37 to
"/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs2.dbf";
restore
from service 'prmcdb' clone database
skip forever tablespace "PRMPDB01":"PDB01_TBS2" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 14-APR-14
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/dupcdb/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/dupcdb/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/dupcdb/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/dupcdb/pdbseed/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/dupcdb/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/dupcdb/pdbseed/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/dupcdb/prmpdb01/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/dupcdb/prmpdb01/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/dupcdb/prmpdb01/prmpdb01_users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00028 to /u01/app/oracle/oradata/dupcdb/prmpdb02/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00029 to /u01/app/oracle/oradata/dupcdb/prmpdb02/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00030 to /u01/app/oracle/oradata/dupcdb/prmpdb02/prmpdb02_users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00031 to /u01/app/oracle/oradata/dupcdb/prmpdb03/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00032 to /u01/app/oracle/oradata/dupcdb/prmpdb03/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00033 to /u01/app/oracle/oradata/dupcdb/prmpdb03/prmpdb03_users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00034 to /u01/app/oracle/oradata/dupcdb/prmpdb01/pdb01_tbs1.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00036 to /u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs1.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00037 to /u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs2.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
Finished restore at 14-APR-14
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'prmcdb'
archivelog from scn 4870512;
switch clone datafile all;
}
executing Memory Script
Starting restore at 14-APR-14
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=102
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service prmcdb
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=103
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 14-APR-14
datafile 1 switched to datafile copy
input datafile copy RECID=21 STAMP=844866982 file name=/u01/app/oracle/oradata/dupcdb/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=22 STAMP=844866983 file name=/u01/app/oracle/oradata/dupcdb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=23 STAMP=844866984 file name=/u01/app/oracle/oradata/dupcdb/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=24 STAMP=844866985 file name=/u01/app/oracle/oradata/dupcdb/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=25 STAMP=844866986 file name=/u01/app/oracle/oradata/dupcdb/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=26 STAMP=844866987 file name=/u01/app/oracle/oradata/dupcdb/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=27 STAMP=844866988 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/system01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=28 STAMP=844866989 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=29 STAMP=844866989 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/prmpdb01_users01.dbf
datafile 28 switched to datafile copy
input datafile copy RECID=30 STAMP=844866990 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/system01.dbf
datafile 29 switched to datafile copy
input datafile copy RECID=31 STAMP=844866991 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/sysaux01.dbf
datafile 30 switched to datafile copy
input datafile copy RECID=32 STAMP=844866991 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/prmpdb02_users01.dbf
datafile 31 switched to datafile copy
input datafile copy RECID=33 STAMP=844866992 file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/system01.dbf
datafile 32 switched to datafile copy
input datafile copy RECID=34 STAMP=844866993 file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/sysaux01.dbf
datafile 33 switched to datafile copy
input datafile copy RECID=35 STAMP=844866993 file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/prmpdb03_users01.dbf
datafile 34 switched to datafile copy
input datafile copy RECID=36 STAMP=844866994 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/pdb01_tbs1.dbf
datafile 36 switched to datafile copy
input datafile copy RECID=37 STAMP=844866995 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs1.dbf
datafile 37 switched to datafile copy
input datafile copy RECID=38 STAMP=844866995 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs2.dbf
contents of Memory Script:
{
set until scn 4871324;
recover
clone database
skip forever tablespace "PRMPDB01":"PDB01_TBS2" delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 14-APR-14
using channel ORA_AUX_DISK_1
Executing: alter database datafile 35 offline drop
starting media recovery
archived log for thread 1 with sequence 102 is already on disk as file /u01/app/oracle/fra/DUPCDB/archivelog/2014_04_14/o1_mf_1_102_9nq6bhx1_.arc
archived log for thread 1 with sequence 103 is already on disk as file /u01/app/oracle/fra/DUPCDB/archivelog/2014_04_14/o1_mf_1_103_9nq6bmcm_.arc
archived log file name= /u01/app/oracle/fra/DUPCDB/archivelog/2014_04_14/o1_mf_1_102_9nq6bhx1_.arc thread=1 sequence=102
archived log file name= /u01/app/oracle/fra/DUPCDB/archivelog/2014_04_14/o1_mf_1_103_9nq6bmcm_.arc thread=1 sequence=103
media recovery complete, elapsed time: 00:00:19
Finished recover at 14-APR-14
Oracle instance started
Total System Global Area 1219260416 bytes
Fixed Size 2287768 bytes
Variable Size 838862696 bytes
Database Buffers 369098752 bytes
Redo Buffers 9011200 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''DUPCDB'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script
sql statement: alter system set db_name = ''DUPCDB'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started
Total System Global Area 1219260416 bytes
Fixed Size 2287768 bytes
Variable Size 838862696 bytes
Database Buffers 369098752 bytes
Redo Buffers 9011200 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPCDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/app/oracle/oradata/dupcdb/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u01/app/oracle/oradata/dupcdb/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u01/app/oracle/oradata/dupcdb/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/u01/app/oracle/oradata/dupcdb/system01.dbf',
'/u01/app/oracle/oradata/dupcdb/pdbseed/system01.dbf',
'/u01/app/oracle/oradata/dupcdb/prmpdb01/system01.dbf',
'/u01/app/oracle/oradata/dupcdb/prmpdb02/system01.dbf',
'/u01/app/oracle/oradata/dupcdb/prmpdb03/system01.dbf'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/dupcdb/temp01.dbf";
set newname for tempfile 2 to
"/u01/app/oracle/oradata/dupcdb/pdbseed/pdbseed_temp01.dbf";
set newname for tempfile 3 to
"/u01/app/oracle/oradata/dupcdb/prmpdb01/temp01.dbf";
set newname for tempfile 4 to
"/u01/app/oracle/oradata/dupcdb/prmpdb02/temp01.dbf";
set newname for tempfile 5 to
"/u01/app/oracle/oradata/dupcdb/prmpdb03/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/dupcdb/sysaux01.dbf",
"/u01/app/oracle/oradata/dupcdb/undotbs01.dbf",
"/u01/app/oracle/oradata/dupcdb/users01.dbf",
"/u01/app/oracle/oradata/dupcdb/pdbseed/sysaux01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb01/sysaux01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb01/prmpdb01_users01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb02/sysaux01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb02/prmpdb02_users01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb03/sysaux01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb03/prmpdb03_users01.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb01/pdb01_tbs1.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs1.dbf",
"/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs2.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/dupcdb/temp01.dbf in control file
renamed tempfile 2 to /u01/app/oracle/oradata/dupcdb/pdbseed/pdbseed_temp01.dbf in control file
renamed tempfile 3 to /u01/app/oracle/oradata/dupcdb/prmpdb01/temp01.dbf in control file
renamed tempfile 4 to /u01/app/oracle/oradata/dupcdb/prmpdb02/temp01.dbf in control file
renamed tempfile 5 to /u01/app/oracle/oradata/dupcdb/prmpdb03/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/sysaux01.dbf RECID=1 STAMP=844867059
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/undotbs01.dbf RECID=2 STAMP=844867059
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/users01.dbf RECID=3 STAMP=844867060
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/pdbseed/sysaux01.dbf RECID=4 STAMP=844867060
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/sysaux01.dbf RECID=5 STAMP=844867061
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/prmpdb01_users01.dbf RECID=6 STAMP=844867061
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/sysaux01.dbf RECID=7 STAMP=844867062
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/prmpdb02_users01.dbf RECID=8 STAMP=844867062
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/sysaux01.dbf RECID=9 STAMP=844867063
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/prmpdb03_users01.dbf RECID=10 STAMP=844867063
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/pdb01_tbs1.dbf RECID=11 STAMP=844867064
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs1.dbf RECID=12 STAMP=844867064
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs2.dbf RECID=13 STAMP=844867065
datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=844867059 file name=/u01/app/oracle/oradata/dupcdb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=844867059 file name=/u01/app/oracle/oradata/dupcdb/undotbs01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=3 STAMP=844867060 file name=/u01/app/oracle/oradata/dupcdb/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=4 STAMP=844867060 file name=/u01/app/oracle/oradata/dupcdb/pdbseed/sysaux01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=5 STAMP=844867061 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=6 STAMP=844867061 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/prmpdb01_users01.dbf
datafile 29 switched to datafile copy
input datafile copy RECID=7 STAMP=844867062 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/sysaux01.dbf
datafile 30 switched to datafile copy
input datafile copy RECID=8 STAMP=844867062 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/prmpdb02_users01.dbf
datafile 32 switched to datafile copy
input datafile copy RECID=9 STAMP=844867063 file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/sysaux01.dbf
datafile 33 switched to datafile copy
input datafile copy RECID=10 STAMP=844867063 file name=/u01/app/oracle/oradata/dupcdb/prmpdb03/prmpdb03_users01.dbf
datafile 34 switched to datafile copy
input datafile copy RECID=11 STAMP=844867064 file name=/u01/app/oracle/oradata/dupcdb/prmpdb01/pdb01_tbs1.dbf
datafile 36 switched to datafile copy
input datafile copy RECID=12 STAMP=844867064 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs1.dbf
datafile 37 switched to datafile copy
input datafile copy RECID=13 STAMP=844867065 file name=/u01/app/oracle/oradata/dupcdb/prmpdb02/pdb02_tbs2.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
contents of Memory Script:
{
sql clone "alter pluggable database all open";
}
executing Memory Script
sql statement: alter pluggable database all open
Dropping offline and skipped tablespaces
Executing: drop tablespace "PDB01_TBS2" including contents cascade constraints
Finished Duplicate Db at 14-APR-14
Recovery Manager complete.
Podemos verificar la PDB duplicada y el tablespace en la CDB duplicada:
[oracle@oel62-ora12c-dup ~]$ export ORACLE_SID=dupcdb
[oracle@oel62-ora12c-dup ~]$ sqlplus / as sysdba
SQL> select con_id, tablespace_name from cdb_tablespaces order by 1,2;
CON_ID TABLESPACE_NAME
-------- ------------------------------
1 SYSAUX
1 SYSTEM
1 TEMP
1 UNDOTBS1
1 USERS
2 SYSAUX
2 SYSTEM
2 TEMP
3 PDB01_TBS1
3 SYSAUX
3 SYSTEM
CON_ID TABLESPACE_NAME
-------- ------------------------------
3 TEMP
3 USERS
4 PDB02_TBS1
4 PDB02_TBS2
4 SYSAUX
4 SYSTEM
4 TEMP
4 USERS
5 SYSAUX
5 SYSTEM
5 TEMP
CON_ID TABLESPACE_NAME
-------- ------------------------------
5 USERS
23 rows selected.
Como podemos ver en la salida, todas las pluggable databases fueron duplicadas con todos los tablespaces, solamente fue ignorado el tablespace PDB01_TBS02 de la PDB prmpdb01.
Esperamos que esta serie de artículos haya resultado de utilidad.
Saludos.
Joel Pérez es un experto DBA (Oracle ACE Director, OCM Cloud Admin. & OCM11g) con más de 15 años de experiencia real en el mundo de tecnología Oracle, especializado en diseño e implementación de soluciones de: Cloud, Alta disponibilidad, Recuperación contra desastres, Upgrades, Replicación y toda área relacionada con bases de datos Oracle. Consultor Internacional con trabajos, conferencias y actividades relacionadas en más de 50 países alrededor del mundo. Habitual Orador en eventos Oracle alrededor del mundo como: OTN LAD, OTN MENA, OTN APAC y más. Joel se ha caracterizado siempre por ser un pionero en materia de tecnología Oracle desde los inicios de su carrera siendo el primer latinoamericano en ser nombrado "OTN Expert" en el año 2003, uno de los primeros Oracle ACE en el programa ACE en el año 2004, unos de los primeros OCP Cloud en el mercado global en el año 2013 y como uno de los mayores logros de su carrera, recientemente en el 2014 fue honorificado como uno de los primeros "OCM Database Cloud Administrator" del mundo. En la actualidad Joel Pérez esta radicado en el continente de Asia con base en Beijing, China llevando a cabo operaciones profesionales como “Chief Technologist & MAA, HA Arquitect” para Yunhe Enmo (Beijing) Technology Co. Ltd.
http://education.oracle.com/education/otn/JoelPerez.htm
Mahir M. Quluzade es un Senior DBA con mas de 10 anos de experiencia en bases de datos Oracle con especial foco en "High Availability" & "Disaster Recovery Solutions (RAC, Data Guard, RMAN,…)". Mahir actualmente trabaja en el "Central Bank of the Republic of Azerbaijan". El es OCP DBA. Mahir es frecuente orador en el "Azerbaijan Oracle User Group (AZEROUG)".
Sebastián D'Alessandro es un Senior DBA con más de 12 años de experiencia en tecnología Oracle, focalizado principalmente en seguridad de base de datos, soluciones de alta disponibilidad, disaster recovery y virtualización. Actualmente desarrolla su actividad como consultor e instructor de manera independiente.
Este artículo ha sido revisado por el equipo de productos Oracle y se encuentra en cumplimiento de las normas y prácticas para el uso de los productos Oracle.