Re: RMAN duplication step by step

  • From: Andrey Goryunov <goryunov.oracle.l@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Mon, 31 Oct 2011 11:57:40 +1100

Hello,
finally I understood where was the problem.

To add data file copy first of all set name should be issued
followed by catalog datafilecopy and switch datafile


(just system and undo files there)
RMAN> sql clone "CREATE CONTROLFILE REUSE SET DATABASE TEMP RESETLOGS
ARCHIVELOG
2>   MAXLOGFILES     16
  MAXLOGMEMBERS      3
3> 4>   MAXDATAFILES      100
5>   MAXINSTANCES     8
6>   MAXLOGHISTORY      292
7>  LOGFILE
8>   GROUP  1 ( ''/u02/oradata/temp/redo01.log'' ) SIZE 50 M  REUSE,
9>   GROUP  2 ( ''/u02/oradata/temp/redo02.log'' ) SIZE 50 M  REUSE,
10>   GROUP  3 ( ''/u02/oradata/temp/redo03.log'' ) SIZE 50 M  REUSE
11>  DATAFILE
12>   ''/u02/oradata/temp/system01.dbf'',
13>   ''/u02/oradata/temp/undotbs01.dbf''";

using target database control file instead of recovery catalog
sql statement: CREATE CONTROLFILE REUSE SET DATABASE TEMP RESETLOGS
ARCHIVELOG  MAXLOGFILES     16  MAXLOGMEMBERS      3  MAXDATAFILES
100  MAXINSTANCES     8  MAXLOGHISTORY      292 LOGFILE  GROUP  1 (
''/u02/oradata/temp/redo01.log'' ) SIZE 50 M  REUSE,  GROUP  2 (
''/u02/oradata/temp/redo02.log'' ) SIZE 50 M  REUSE,  GROUP  3 (
''/u02/oradata/temp/redo03.log'' ) SIZE 50 M  REUSE DATAFILE
''/u02/oradata/temp/system01.dbf'',  ''/u02/oradata/temp/undotbs01.dbf''


******************************************

temp> select name, file#, status from v$datafile;

NAME
-------------------------------------------------
     FILE# STATUS
---------- -------
/u02/oradata/temp/system01.dbf
         1 SYSTEM

/u02/oradata/temp/undotbs01.dbf
         3 RECOVER


Elapsed: 00:00:02.91

******************************************

RMAN> run {
   set newname for tempfile  1 to
 "/u02/oradata/temp/temp01.dbf";
   switch clone tempfile all;2> 3> 4> }

executing command: SET NEWNAME

renamed tempfile 1 to /u02/oradata/temp/temp01.dbf in control file


******************************************

temp> select name, file#, status from v$tempfile;

NAME
--------------------------------------------------
     FILE# STATUS
---------- -------
/u02/oradata/temp/temp01.dbf
         1 ONLINE


Elapsed: 00:00:00.02

******************************************
(set names for sysaux and one of tablespaces)
RMAN> run {
set newname for datafile 2 to "/u02/oradata/temp/sysaux01.dbf";
2> 3> set newname for datafile 8 to "/u02/oradata/temp/t.dbf";
4> catalog clone datafilecopy  "/u02/oradata/temp/sysaux01.dbf",
"/u02/oradata/temp/undotbs01.dbf", "/u02/oradata/temp/t.dbf";
switch clone datafile all;
}5> 6>

executing command: SET NEWNAME

executing command: SET NEWNAME

cataloged datafile copy
datafile copy file name=/u02/oradata/temp/sysaux01.dbf RECID=1
STAMP=765883206
cataloged datafile copy
datafile copy file name=/u02/oradata/temp/undotbs01.dbf RECID=2
STAMP=765883210
cataloged datafile copy
datafile copy file name=/u02/oradata/temp/t.dbf RECID=3 STAMP=765883210

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=765883206 file
name=/u02/oradata/temp/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=3 STAMP=765883210 file
name=/u02/oradata/temp/t.dbf


******************************************

temp> select name, file#, status from v$datafile;

NAME
-------------------------------------------------
     FILE# STATUS
---------- -------
/u02/oradata/temp/system01.dbf
         1 SYSTEM

/u02/oradata/temp/sysaux01.dbf
         2 RECOVER

/u02/oradata/temp/undotbs01.dbf
         3 RECOVER

/u02/oradata/temp/t.dbf
         8 RECOVER


Elapsed: 00:00:00.17

******************************************


RMAN> run {
   Alter clone database open resetlogs;
}2> 3>

database opened

RMAN>

******************************************

temp> /

NAME
---------------------------------------------------------
     FILE# STATUS
---------- -------
/u02/oradata/temp/system01.dbf
         1 SYSTEM

/u02/oradata/temp/sysaux01.dbf
         2 ONLINE

/u02/oradata/temp/undotbs01.dbf
         3 ONLINE

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00004
         4 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00005
         5 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00006
         6 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00007
         7 RECOVER

/u02/oradata/temp/t.dbf
         8 ONLINE

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00009
         9 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00010
        10 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00011
        11 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00012
        12 RECOVER

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/MISSING00013
        13 RECOVER


13 rows selected.

Elapsed: 00:00:04.14


Thanks,
Andrey

On 26 October 2011 00:16, Andrey Goryunov <goryunov.oracle.l@xxxxxxxxx>wrote:

> Hello,
>
> I am trying to perform copy of database that RMAN does with duplicate from
> active database but manually step by step.
> I took debug and trace of "duplicate target database to ... from active
> database"
> and using contents of memory scripts repeated them manually once again
>
> It all went almost fine until steps where controlfile being created,
> copies cataloged and data files switched to them.
>
> Based on memory scripts contents, control file recreated just with system
> file
> and other copied files cataloged. When I tried to switch datafiles to
> their copies manually
> (after successful catalog operation) operation failed with:
>
> RMAN> switch datafile 2 to copy;
>
> RMAN-00571: ===========================================================
> RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
> RMAN-00571: ===========================================================
> RMAN-03002: failure of switch to copy command at 10/25/2011 01:33:12
> RMAN-20201: datafile not found in the recovery catalog
> RMAN-06010: error while looking up datafile: 2
>
> It seems to me that it is not possible to add file through catalog and
> switch commands
> when control file was recreated with only system file, but based on log
> RMAN somehow does it.
>
> Do you know how RMAN does it and where is the problem in manual execution
> that I can not reach the same result.
>
> Attached output of RMAN duplicate and log of actions for manual execution.
>
> --
> Thank you,
> Andrey Goryunov
>



-- 
Regards,
Andrey Goryunov


--
//www.freelists.org/webpage/oracle-l


Other related posts: