11gR2Data GuardOracle

Duplicate Database Using 'FROM ACTIVE DATABASE' clause – 11gR2

I was asked to duplicate a production database on a new server and as it was on 11gR2, it was time to use the best available option i.e., using ‘from active database’ clause.After doing a successful duplication i thought of putting it on blog as i observed and encountered few things which i wanted to share.
This duplication is done on my laptop, so few things are different , which i would mention as an when required.I will be using the below 2 terms –
Source (Production DB) –> MATRIX
Target (To be Duplicated) –> ORCL
The rman command may create little confusion, as TARGET would be MATRIX.Rest every where Target server/db would mean ORCL.
1. Edited the TNSNAMES.ora and the LISTENER.ora file to have the below entry
==========================================================================

TNSNAMES.ora
==============
MATRIX =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ANANPRAK-LAP) (PORT=1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = MATRIX )
    )
  )
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ANANPRAK-LAP) (PORT=1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )
LISTENER.ora
=============
Added the below in SID_LIST_LISTENER -
(SID_DESC =
          (GLOBAL_DBNAME = MATRIX)
          (ORACLE_HOME = D:\oracle\app\product\11.2.0\dbhome_1)
          (SID_NAME = MATRIX)
    )
    (SID_DESC =
             (GLOBAL_DBNAME = ORCL)
             (ORACLE_HOME = D:\oracle\app\product\11.2.0\dbhome_1)
             (SID_NAME = ORCL)
   )

The TNS entry of both the database must be present in TNSNAMES.ora file on both the servers.If the TNS entry is not present on the source (MATRIX) server, the duplicate command would fail with ORA-12154: TNS:could not resolve the connect identifier specified.
2. Check pre-requisites and change the required parameter on Primary database
===========================================================================
The production(source) database must be in archivelog mode.No datafile must be in OFFLINE status.If datafile is in OFFLINE status you get the below error while rman duplicate run

RMAN-03002: failure of Duplicate Db command at 01/15/2011 23:32:52
RMAN-03015: error occurred in stored script Memory Script
RMAN-06056: could not access datafile 8

3. Create INIT file, Password file and as it is on windows, create a new Instance service using ORADIM utility.
================================================================================================
i) Created the INITorcl.ora file with only one parameter

*.db_name='ORCL'

ii) Create a new instance using ORADIM utility

D:\scripts>oradim -new -sid ORCL -pfile D:\oracle\app\product\11.2.0\dbhome_1\database\INITorcl.ORA
Instance created.

D:\scripts>
iii) Create the Password file using ORAPWD utility.It would be used for connecting with sys user using as auxiliary
D:\scripts>orapwd file=D:\oracle\app\product\11.2.0\dbhome_1\database\PWDORCL.ora entries=2 password=sys123
SYS user password must be the same.If not you will receive the below error

RMAN-03002: failure of Duplicate Db command at 19/01/2011 23:10:26
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on C1 channel at 19/01/2011 23:10:26
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
ORA-17629: Cannot connect to the remote database server

iv) Create the directories on the target (ORCL) for datafiles,redo logfiles,archivelogs.In my case i created folder “D:\oracle\app\oradata\ORCL”
4. Startup nomount ORCL instance using the pfile
====================================================

D:\>set oracle_sid=ORCL
D:\>sqlplus sys/sys123 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 19 23:13:59 2011
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to an idle instance.
23:13:59 [email protected]> startup nomount
ORACLE instance started.
Total System Global Area  150667264 bytes
Fixed Size                  1373152 bytes
Variable Size              92277792 bytes
Database Buffers           50331648 bytes
Redo Buffers                6684672 bytes
23:14:22 [email protected]>

The moment instance started, ADR directory for ORCL got created “D:\oracle\app\diag\rdbms\orcl\orcl\trace”.

23:16:26 [email protected]> show parameter diag
NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------
diagnostic_dest                      string      D:\ORACLE\APP
23:16:29 [email protected]> show parameter db_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------
db_name                              string      ORCL
23:16:46 [email protected]>

5. Invoke the RMAN to create duplicate database
====================================================

D:\>rman target sys/[email protected] auxiliary sys/[email protected]
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jan 20 00:13:32 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: MATRIX (DBID=2278859282)
connected to auxiliary database: ORCL (not mounted)
RMAN> run {
2>  allocate channel C1 type disk;
3>  allocate auxiliary channel DUP type disk;
4>  duplicate target database
5> to ORCL
6>  from active database
7>  spfile
8>  SET MEMORY_TARGET="270M"
9>  set db_unique_name='ORCL'
10>  set db_file_name_convert='D:\oracle\app\oradata\MATRIX','D:\oracle\app\oradata\ORCL'
11>  set log_file_name_convert='D:\oracle\app\oradata\MATRIX','D:\oracle\app\oradata\ORCL'
12>  set control_files='D:\ORACLE\APP\ORADATA\ORCL\control01.ctl','D:\ORACLE\APP\ORADATA\ORCL\control02.ctl'
13>  set log_archive_max_processes='5'
14>  set log_archive_dest_1='LOCATION=D:\oracle\app\admin\ORCL\archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
15>  ;
16>  }

Below is the memory script contents.Few important points are highlighted.

using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=13 device type=DISK
allocated channel: DUP
channel DUP: SID=135 device type=DISK
Starting Duplicate Db at 20-JAN-11
contents of Memory Script:
{
   backup as copy reuse
   targetfile  'D:\ORACLE\APP\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILEMATRIX.ORA' auxiliary format
 'D:\ORACLE\APP\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILEORCL.ORA'   ;
   sql clone "alter system set spfile= ''D:\ORACLE\APP\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILEORCL.ORA''";
}
executing Memory Script
Starting backup at 20-JAN-11
Finished backup at 20-JAN-11
sql statement: alter system set spfile= ''D:\ORACLE\APP\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILEORCL.ORA''
contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''ORCL'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  MEMORY_TARGET =
 270M comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''D:\oracle\app\oradata\MATRIX'', ''D:\oracle\app\oradata\ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''D:\oracle\app\oradata\MATRIX'', ''D:\oracle\app\oradata\ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''D:\ORACLE\APP\ORADATA\ORCL\control01.ctl'', ''D:\ORACLE\APP\ORADATA\ORCL\control02.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_max_processes =
 5 comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
 ''LOCATION=D:\oracle\app\admin\ORCL\archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
sql statement: alter system set  db_name =  ''ORCL'' comment= ''duplicate'' scope=spfile
sql statement: alter system set  MEMORY_TARGET =  270M comment= '''' scope=spfile
sql statement: alter system set  db_unique_name =  ''ORCL'' comment= '''' scope=spfile
sql statement: alter system set  db_file_name_convert =  ''D:\oracle\app\oradata\MATRIX'', ''D:\oracle\app\oradata\ORCL'' comment= '''' scope=spfile
sql statement: alter system set  log_file_name_convert =  ''D:\oracle\app\oradata\MATRIX'', ''D:\oracle\app\oradata\ORCL'' comment= '''' scope=spfile
sql statement: alter system set  control_files =  ''D:\ORACLE\APP\ORADATA\ORCL\control01.ctl'', ''D:\ORACLE\APP\ORADATA\ORCL\control02.ctl'' comment= '''' scope=spfile
sql statement: alter system set  log_archive_max_processes =  5 comment= '''' scope=spfile
sql statement: alter system set  log_archive_dest_1 =  ''LOCATION=D:\oracle\app\admin\ORCL\archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     267825152 bytes
Fixed Size                     1373996 bytes
Variable Size                 92276948 bytes
Database Buffers             167772160 bytes
Redo Buffers                   6402048 bytes
allocated channel: DUP
channel DUP: SID=63 device type=DISK
contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''MATRIX'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCL'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  'D:\ORACLE\APP\ORADATA\ORCL\CONTROL01.CTL';
   restore clone controlfile to  'D:\ORACLE\APP\ORADATA\ORCL\CONTROL02.CTL' from
 'D:\ORACLE\APP\ORADATA\ORCL\CONTROL01.CTL';
   alter clone database mount;
}
executing Memory Script
sql statement: alter system set  db_name =  ''MATRIX'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set  db_unique_name =  ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area     267825152 bytes
Fixed Size                     1373996 bytes
Variable Size                 92276948 bytes
Database Buffers             167772160 bytes
Redo Buffers                   6402048 bytes

*NOTE --> In case, you get some error at this point please remember db_name has changed to "MATRIX" now.The instance will be up, but the database name would be 'MATRIX'.So, before restarting the rman, make sure you change the db_name back to what you wanted (in my case ORCL) or delete the spfile.*
allocated channel: DUP
channel DUP: SID=63 device type=DISK
Starting backup at 20-JAN-11
channel C1: starting datafile copy
copying current control file
output file name=D:\ORACLE\APP\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFMATRIX.ORA tag=TAG20110116T001414 RECID=7 STAMP=740535255
channel C1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 20-JAN-11
Starting restore at 20-JAN-11
channel DUP: copied control file copy
Finished restore at 20-JAN-11
database mounted
contents of Memory Script:
{
   set newname for datafile  1 to
 "D:\ORACLE\APP\ORADATA\ORCL\SYSTEM01.DBF";
   set newname for datafile  2 to
 "D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF";
   set newname for datafile  3 to
 "D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF";
   set newname for datafile  4 to
 "D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF";
   set newname for datafile  5 to
 "D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF";
   set newname for datafile  6 to
 "D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF";
   set newname for datafile  7 to
 "D:\ORACLE\APP\ORADATA\ORCL\TEST_02.DBF";
   backup as copy reuse
   datafile  1 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\SYSTEM01.DBF"   datafile
 2 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF"   datafile
 3 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF"   datafile
 4 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF"   datafile
 5 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF"   datafile
 6 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF"   datafile
 7 auxiliary format
 "D:\ORACLE\APP\ORADATA\ORCL\TEST_02.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
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 20-JAN-11
channel C1: starting datafile copy
input datafile file number=00001 name=D:\ORACLE\APP\ORADATA\MATRIX\SYSTEM01.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\SYSTEM01.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:45
channel C1: starting datafile copy
input datafile file number=00002 name=D:\ORACLE\APP\ORADATA\MATRIX\SYSAUX01.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:25
channel C1: starting datafile copy
input datafile file number=00006 name=D:\ORACLE\APP\ORADATA\MATRIX\TEST_01.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:25
channel C1: starting datafile copy
input datafile file number=00007 name=D:\ORACLE\APP\ORADATA\MATRIX\TEST_02.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_02.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:25
channel C1: starting datafile copy
input datafile file number=00005 name=D:\ORACLE\APP\ORADATA\MATRIX\EXAMPLE01.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:07
channel C1: starting datafile copy
input datafile file number=00003 name=D:\ORACLE\APP\ORADATA\MATRIX\UNDOTBS01.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:03
channel C1: starting datafile copy
input datafile file number=00004 name=D:\ORACLE\APP\ORADATA\MATRIX\USERS01.DBF
output file name=D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF tag=TAG20110116T001425
channel C1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20-JAN-11
sql statement: alter system archive log current
contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "D:\ORACLE\APP\ADMIN\MATRIX\ARCHIVE\ARC0000000207_0738534549.0001" auxiliary format
 "D:\ORACLE\APP\ADMIN\ORCL\ARCHIVE\ARC0000000207_0738534549.0001"   ;
   catalog clone archivelog  "D:\ORACLE\APP\ADMIN\ORCL\ARCHIVE\ARC0000000207_0738534549.0001";
   switch clone datafile all;
}
executing Memory Script
Starting backup at 20-JAN-11
channel C1: starting archived log copy
input archived log thread=1 sequence=207 RECID=362 STAMP=740535400
output file name=D:\ORACLE\APP\ADMIN\ORCL\ARCHIVE\ARC0000000207_0738534549.0001 RECID=0 STAMP=0
channel C1: archived log copy complete, elapsed time: 00:00:03
Finished backup at 20-JAN-11
cataloged archived log
archived log file name=D:\ORACLE\APP\ADMIN\ORCL\ARCHIVE\ARC0000000207_0738534549.0001 RECID=362 STAMP=740535405
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\SYSTEM01.DBF
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF
datafile 6 switched to datafile copy
input datafile copy RECID=12 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF
datafile 7 switched to datafile copy
input datafile copy RECID=13 STAMP=740535406 file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_02.DBF
contents of Memory Script:
{
   set until scn  2547410;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script
executing command: SET until clause
Starting recover at 20-JAN-11
starting media recovery
archived log for thread 1 with sequence 207 is already on disk as file D:\ORACLE\APP\ADMIN\ORCL\ARCHIVE\ARC0000000207_0738534549.0001
archived log file name=D:\ORACLE\APP\ADMIN\ORCL\ARCHIVE\ARC0000000207_0738534549.0001 thread=1 sequence=207
media recovery complete, elapsed time: 00:00:02
Finished recover at 20-JAN-11
contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''ORCL'' 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
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     267825152 bytes
Fixed Size                     1373996 bytes
Variable Size                104859860 bytes
Database Buffers             155189248 bytes
Redo Buffers                   6402048 bytes
allocated channel: DUP
channel DUP: SID=63 device type=DISK
sql statement: alter system set  db_name =  ''ORCL'' comment= ''Reset to original value by RMAN'' scope=spfile

*NOTE --> At this point the database name gets changed to the original (ORCL in my case).*
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     267825152 bytes
Fixed Size                     1373996 bytes
Variable Size                104859860 bytes
Database Buffers             155189248 bytes
Redo Buffers                   6402048 bytes
allocated channel: DUP
channel DUP: SID=63 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( 'D:\ORACLE\APP\ORADATA\ORCL\REDO01.LOG' ) SIZE 50 M  REUSE,
  GROUP  2 ( 'D:\ORACLE\APP\ORADATA\ORCL\REDO02.LOG' ) SIZE 50 M  REUSE,
  GROUP  3 ( 'D:\ORACLE\APP\ORADATA\ORCL\REDO03.LOG' ) SIZE 50 M  REUSE,
  GROUP  4 ( 'D:\ORACLE\APP\ORADATA\ORCL\REDO04.LOG' ) SIZE 50 M  REUSE
 DATAFILE
  'D:\ORACLE\APP\ORADATA\ORCL\SYSTEM01.DBF'
 CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
   set newname for tempfile  1 to
 "D:\ORACLE\APP\ORADATA\ORCL\TEMP01.DBF";
   switch clone tempfile all;
   catalog clone datafilecopy  "D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF",
 "D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF",
 "D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF",
 "D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF",
 "D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF",
 "D:\ORACLE\APP\ORADATA\ORCL\TEST_02.DBF";
   switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to D:\ORACLE\APP\ORADATA\ORCL\TEMP01.DBF in control file
cataloged datafile copy
datafile copy file name=D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF RECID=1 STAMP=740535433
cataloged datafile copy
datafile copy file name=D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF RECID=2 STAMP=740535433
cataloged datafile copy
datafile copy file name=D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF RECID=3 STAMP=740535433
cataloged datafile copy
datafile copy file name=D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF RECID=4 STAMP=740535433
cataloged datafile copy
datafile copy file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF RECID=5 STAMP=740535433
cataloged datafile copy
datafile copy file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_02.DBF RECID=6 STAMP=740535433
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=740535433 file name=D:\ORACLE\APP\ORADATA\ORCL\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=740535433 file name=D:\ORACLE\APP\ORADATA\ORCL\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=740535433 file name=D:\ORACLE\APP\ORADATA\ORCL\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=740535433 file name=D:\ORACLE\APP\ORADATA\ORCL\EXAMPLE01.DBF
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=740535433 file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_01.DBF
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=740535433 file name=D:\ORACLE\APP\ORADATA\ORCL\TEST_02.DBF
contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 20-JAN-11
released channel: C1
released channel: DUP
RMAN>

6. Login to the Duplicated DB – ORCL
============================================

01:32:38 [email protected]> select name,open_mode,database_role from v$database;
NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
ORCL      READ WRITE           PRIMARY
Elapsed: 00:00:00.04
01:32:42 [email protected]> show parameter db_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------
db_name                              string      ORCL
01:32:51 [email protected]>
01:33:04 [email protected]> select instance_name,startup_time from v$instance;
INSTANCE_NAME    STARTUP_TIME
---------------- -----------------
orcl             20-01-11 00:17:09
Elapsed: 00:00:00.03

The db_name had changed to MATRIX and then is again got reset to ORCL, so just be aware.Laurent Schneider recently posted “RMAN duplicate does change your DB_NAME !”
http://laurentschneider.com/wordpress/2011/01/rman-duplicate-does-change-your-db_name.html

3 thoughts on “Duplicate Database Using 'FROM ACTIVE DATABASE' clause – 11gR2

  1. Thanks so much. I’ve been struggling with this for a day now. And official documentation and other books have not helped in the least!
    I think the most helpful part is the setup of the remote tnsnames.ora section!

Leave a Reply