Wednesday, June 18, 2014

RMAN-05517: %S conflicts with file used by target database

1.Resynchronization of duplicate database fails with RMAN-05517
[oracle@ol6-112-rac2 rman]$ rman target="sys/sys123@newdb" auxiliary="sys/sys123@dupdb"

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jun 18 20:08:29 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: NEWDB (DBID=3090890366)
connected to auxiliary database: DUPDB (not mounted)

RMAN> host 'cat rman_duplicate_fs_7.cmd';

run
{
duplicate database newdb to dupdb
from active database
logfile
group 1('/u03/oradata/dupdb/redo01.log') size 52428800 reuse,
group 2('/u03/oradata/dupdb/redo02.log') size 52428800 reuse,
group 3('/u03/oradata/dupdb/redo03.log') size 52428800 reuse;
}
host command complete

RMAN> @ rman_duplicate_fs_7.cmd

RMAN> run
2> {
3> duplicate database newdb to dupdb
4> from active database
5> logfile
6> group 1('/u03/oradata/dupdb/redo01.log') size 52428800 reuse,
7> group 2('/u03/oradata/dupdb/redo02.log') size 52428800 reuse,
8> group 3('/u03/oradata/dupdb/redo03.log') size 52428800 reuse;
9> }
Starting Duplicate Db at 18-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''NEWDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''DUPDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u03/oradata/newdb/control01.ctl';
   restore clone controlfile to  '/u03/fra/newdb/control02.ctl' from
 '/u03/oradata/newdb/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''NEWDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''DUPDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                121635456 bytes
Database Buffers             146800640 bytes
Redo Buffers                   4915200 bytes

Starting backup at 18-JUN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/snapcf_newdb.f tag=TAG20140618T200857 RECID=5 STAMP=850594138
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 18-JUN-14

Starting restore at 18-JUN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 18-JUN-14

database mounted
Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                121635456 bytes
Database Buffers             146800640 bytes
Redo Buffers                   4915200 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DUPDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
}
executing Memory Script

sql statement: alter system set  db_name =  ''DUPDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/18/2014 20:09:13
RMAN-05501: aborting duplication of target database
RMAN-05517: tempfile /u03/oradata/newdb/temp01.dbf conflicts with file used by target database

RMAN> **end-of-file**


2.Updated the script with nofilenamecheck and the resynchronization of duplicate database completed succesfully.
 run
 {
 #set newname for tempfile 1 to '/u03/oradata/newdb/temp01.dbf';
 duplicate database newdb to dupdb
 from active database
 nofilenamecheck
 logfile
 group 1('/u03/oradata/dupdb/redo01.log') size 52428800 reuse,
 group 2('/u03/oradata/dupdb/redo02.log') size 52428800 reuse,
 group 3('/u03/oradata/dupdb/redo03.log') size 52428800 reuse;
}

3.Output of script execution
[oracle@ol6-112-rac2 rman]$ rman target="sys/sys123@newdb" auxiliary="sys/sys123@dupdb"

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jun 18 20:39:44 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: NEWDB (DBID=3090890366)
connected to auxiliary database: DUPDB (not mounted)

RMAN> @rman_duplicate_fs_7.cmd

RMAN> run
2> {
3> #set newname for tempfile 1 to '/u03/oradata/newdb/temp01.dbf';
4> duplicate database newdb to dupdb
5> from active database
6> nofilenamecheck
7> logfile
8> group 1('/u03/oradata/dupdb/redo01.log') size 52428800 reuse,
9> group 2('/u03/oradata/dupdb/redo02.log') size 52428800 reuse,
10> group 3('/u03/oradata/dupdb/redo03.log') size 52428800 reuse;
11> }
Starting Duplicate Db at 18-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

contents of Memory Script:
{
   sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''NEWDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''DUPDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/cntrldupdb.dbf';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''NEWDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''DUPDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes

Starting backup at 18-JUN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/snapcf_newdb.f tag=TAG20140618T204004 RECID=8 STAMP=850596004
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 18-JUN-14

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
 "/u03/oradata/dupdb/system01.dbf";
   set newname for datafile  2 to
 "/u03/oradata/dupdb/sysaux01.dbf";
   set newname for datafile  3 to
 "/u03/oradata/dupdb/undotbs01.dbf";
   set newname for datafile  4 to
 "/u03/oradata/dupdb/users01.dbf";
   set newname for datafile  5 to
 "/u03/oradata/dupdb/example01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/u03/oradata/dupdb/system01.dbf"   datafile
 2 auxiliary format
 "/u03/oradata/dupdb/sysaux01.dbf"   datafile
 3 auxiliary format
 "/u03/oradata/dupdb/undotbs01.dbf"   datafile
 4 auxiliary format
 "/u03/oradata/dupdb/users01.dbf"   datafile
 5 auxiliary format
 "/u03/oradata/dupdb/example01.dbf"   ;
   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

Starting backup at 18-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u03/oradata/newdb/system01.dbf
output file name=/u03/oradata/dupdb/system01.dbf tag=TAG20140618T204012
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u03/oradata/newdb/sysaux01.dbf
output file name=/u03/oradata/dupdb/sysaux01.dbf tag=TAG20140618T204012
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u03/oradata/newdb/example01.dbf
output file name=/u03/oradata/dupdb/example01.dbf tag=TAG20140618T204012
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u03/oradata/newdb/undotbs01.dbf
output file name=/u03/oradata/dupdb/undotbs01.dbf tag=TAG20140618T204012
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u03/oradata/newdb/users01.dbf
output file name=/u03/oradata/dupdb/users01.dbf tag=TAG20140618T204012
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 18-JUN-14

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/u03/fra/1_35_850479107.dbf" auxiliary format
 "/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/arch1_35_850479107.dbf"   ;
   catalog clone archivelog  "/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/arch1_35_850479107.dbf";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 18-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=35 RECID=30 STAMP=850596216
output file name=/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/arch1_35_850479107.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 18-JUN-14

cataloged archived log
archived log file name=/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/arch1_35_850479107.dbf RECID=30 STAMP=850596218

datafile 1 switched to datafile copy
input datafile copy RECID=8 STAMP=850596218 file name=/u03/oradata/dupdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=9 STAMP=850596218 file name=/u03/oradata/dupdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=10 STAMP=850596218 file name=/u03/oradata/dupdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=11 STAMP=850596218 file name=/u03/oradata/dupdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=12 STAMP=850596218 file name=/u03/oradata/dupdb/example01.dbf

contents of Memory Script:
{
   set until scn  1213000;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 18-JUN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

starting media recovery

archived log for thread 1 with sequence 35 is already on disk as file /u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/arch1_35_850479107.dbf
archived log file name=/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/arch1_35_850479107.dbf thread=1 sequence=35
media recovery complete, elapsed time: 00:00:00
Finished recover at 18-JUN-14
Oracle instance started

Total System Global Area     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DUPDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''DUPDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '/u03/oradata/dupdb/redo01.log' ) SIZE 52428800    REUSE,
  GROUP   2 ( '/u03/oradata/dupdb/redo02.log' ) SIZE 52428800    REUSE,
  GROUP   3 ( '/u03/oradata/dupdb/redo03.log' ) SIZE 52428800    REUSE
 DATAFILE
  '/u03/oradata/dupdb/system01.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u03/oradata/newdb/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u03/oradata/dupdb/sysaux01.dbf",
 "/u03/oradata/dupdb/undotbs01.dbf",
 "/u03/oradata/dupdb/users01.dbf",
 "/u03/oradata/dupdb/example01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u03/oradata/newdb/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/sysaux01.dbf RECID=1 STAMP=850596233
cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/undotbs01.dbf RECID=2 STAMP=850596233
cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/users01.dbf RECID=3 STAMP=850596233
cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/example01.dbf RECID=4 STAMP=850596233

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=850596233 file name=/u03/oradata/dupdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=850596233 file name=/u03/oradata/dupdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=850596233 file name=/u03/oradata/dupdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=850596233 file name=/u03/oradata/dupdb/example01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 18-JUN-14

RMAN> **end-of-file**

No comments: