Active Database Duplication (Active Duplicate): Procedures and Key Points

Oracle Master Gold

Oracle RMAN features an “Active Database Duplication (Active Duplicate)” function that allows you to duplicate a database directly over the network from a live source database without using any pre-existing backup files. In this article, we will thoroughly explain the steps to perform an Active Database Duplication in an Oracle Database 19c environment. This guide is tailored to be easily understood by beginners while remaining highly useful for practical operations.

■ What is Active Database Duplication?

Active Database Duplication is a method where RMAN connects to the source database and copies the required data directly to the target database across the network, completely bypassing the need for traditional backup sets.

🔍 Key Characteristics

  • No backup files required: There is no need to take a backup beforehand.
  • Direct transfer: Data is streamed over the network straight from the live source DB.
  • Point-in-time cloning: You can specify a specific point in time to duplicate (set until).
  • Flexible file placement: Physical file paths can be changed dynamically during migration (file_name_convert).
  • Resource awareness: Because the process accesses the source DB while it is running, you must consider the performance and network impact on your production system.

✅ Common Use Cases

  • Building testing and development environments.
  • Creating a verification copy of a production environment.
  • Pre-stage setup for building Data Guard Standby databases.

■ Environment Configuration Example

[Source DB]

  • SID: v19
  • Host IP: 192.168.56.10

[Target DB (Destination)]

  • SID: orcl
  • Host IP: 192.168.56.20

■ Preparation Steps (Target DB Side)

1. Create the Initialization Parameter File (PFILE)

$ vi /var/tmp/init.ora
DB_NAME=orcl

2. Set Environment Variables and Password File

$ export ORACLE_SID=orcl
$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle entries=10 format=12

3. Configure listener.ora (Static Registration)

$ vi $ORACLE_HOME/network/admin/listener.ora

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.20)(PORT = 1521))))

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)))

4. Configure tnsnames.ora (Required on both Target and Source sides)

$ vi $ORACLE_HOME/network/admin/tnsnames.ora

V19 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.10)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = v19)))

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.20)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)))

5. Start the Target Instance (nomount)

$ sqlplus / as sysdba
SQL> startup nomount pfile=/var/tmp/init.ora

■ Executing Active Database Duplication

$ export ORACLE_SID=orcl
$ rman target sys/oracle@v19
RMAN> connect auxiliary sys/oracle@orcl;

RMAN> duplicate target database to orcl
  from active database
  spfile
    parameter_value_convert 'V19','ORCL'
    set db_file_name_convert='/u01/app/oracle/oradata/V19','/u01/app/oracle/oradata/ORCL'
    set log_file_name_convert='/u01/app/oracle/oradata/V19','/u01/app/oracle/oradata/ORCL'
    set control_files='/u01/app/oracle/oradata/ORCL/control01.ctl'
  nofilenamecheck;

💡 Specifying parameter_value_convert and file_name_convert allows you to flexibly transform the architecture configuration from the source to the target layout.


■ Visualizing the Active Duplication Flow

┌─────────────────────────┐
│       Source DB         │
│         (v19)           │
└────────────┬────────────┘
             │ 
             │ Streamed directly over the network
             ▼
┌─────────────────────────┐
│       Target DB         │
│         (orcl)          │
└─────────────────────────┘

Verification After Duplication Complete

SQL> select instance_name, status from v$instance;

INSTANCE_NAME STATUS
------------- -------
orcl          OPEN

■ Full Terminal & Execution Log

[oracle@v19single ~]$ vi /var/tmp/init.ora  ★Create pfile for auxiliary instance
[oracle@v19single ~]$ cat /var/tmp/init.ora
DB_NAME=orcl
[oracle@v19single ~]$ export ORACLE_SID=orcl
[oracle@v19single ~]$ echo $ORACLE_SID
orcl
[oracle@v19single ~]$ vi $ORACLE_HOME/network/admin/listener.ora  ★Static configuration
[oracle@v19single ~]$ cat $ORACLE_HOME/network/admin/listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.20 )(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))))

SID_LIST_LISTENER=
  (SID_LIST=
    (SID_DESC=
      (SID_NAME=orcl)
      (ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1)))
[oracle@v19single ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-APR-2025 15:01:39

Copyright (c) 1991, 2023, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/v19single/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.19)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.20)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-APR-2025 15:01:40
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora
Log File                  /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.20)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully.
[oracle@v19single ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
[oracle@v19single ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
V19 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.10)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = v19)))

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.20)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)))
[oracle@v19single ~]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle entries=10 format=12  ★Create password file
[oracle@v19single ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 2 15:02:18 2025
Version 19.21.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile=/var/tmp/init.ora  ★Start auxiliary instance in nomount mode
ORACLE instance started.

Total System Global Area  218102080 bytes
Fixed Size                  8923456 bytes
Variable Size             188743680 bytes
Database Buffers           16777216 bytes
Redo Buffers                3657728 bytes
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.21.0.0.0
[oracle@v19single ~]$ rman target sys/oracle@v19  ★Connect to source database

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Apr 2 15:45:22 2025
Version 19.21.0.0.0

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

Connected to target database: V19 (DBID=2957249400)

RMAN> connect auxiliary sys/oracle@orcl  ★Connect to auxiliary instance

Connected to auxiliary database: ORCL (not mounted)

RMAN> duplicate target database to orcl  ★Duplicate
2>   from active database
3>   spfile
4>     parameter_value_convert 'V19','ORCL'
5>     set db_file_name_convert='/u01/app/oracle/oradata/V19','/u01/app/oracle/oradata/ORCL'
6>     set log_file_name_convert='/u01/app/oracle/oradata/V19','/u01/app/oracle/oradata/ORCL'
7>     set control_files='/u01/app/oracle/oradata/ORCL/control01.ctl'
8>   nofilenamecheck;

Starting Duplicate Db at 25-04-02
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=38 device type=DISK
Current log archived.

contents of Memory Script:
{
   restore clone from service  'v19' spfile to
 '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfileorcl.ora';
   sql clone "alter system set spfile= ''/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfileorcl.ora''";
}
executing Memory Script

Starting restore at 25-04-02
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 v19
channel ORA_AUX_DISK_1: restoring SPFILE
output file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfileorcl.ora
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 25-04-02

sql statement: alter system set spfile= ''/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfileorcl.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''ORCL'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''/u01/app/oracle/oradata/V19'', ''/u01/app/oracle/oradata/ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''/u01/app/oracle/oradata/V19'', ''/u01/app/oracle/oradata/ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/u01/app/oracle/oradata/ORCL/control01.ctl'' 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  db_file_name_convert =  ''/u01/app/oracle/oradata/V19'', ''/u01/app/oracle/oradata/ORCL'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/u01/app/oracle/oradata/V19'', ''/u01/app/oracle/oradata/ORCL'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/u01/app/oracle/oradata/ORCL/control01.ctl'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database: ORCL (not started)
Oracle instance started

Total System Global Area    255851248 bytes

Fixed Size                     8923888 bytes
Variable Size                226492416 bytes
Database Buffers              16777216 bytes
Redo Buffers                   3657728 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''V19'' 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
   restore clone from service  'v19' primary controlfile;
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''V19'' 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    255851248 bytes

Fixed Size                     8923888 bytes
Variable Size                226492416 bytes
Database Buffers              16777216 bytes
Redo Buffers                   3657728 bytes

Starting restore at 25-04-02
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=424 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service v19
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/u01/app/oracle/oradata/ORCL/control01.ctl
Finished restore at 25-04-02

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/ORCL/system01.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/ORCL/sysaux01.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/ORCL/undotbs01.dbf";
   set newname for datafile  7 to
 "/u01/app/oracle/oradata/ORCL/users01.dbf";
   restore
   from  nonsparse   from service
 'v19'   clone database
   ;
   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

Starting restore at 25-04-02
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 v19
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/ORCL/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:26
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service v19
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/ORCL/sysaux01.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 v19
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/ORCL/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 v19
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/ORCL/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 25-04-02

sql statement: alter system archive log current
Current log archived.

contents of Memory Script:
{
   restore clone force from service  'v19'
           archivelog from scn  2278893;
   switch clone datafile all;
}
executing Memory Script

Starting restore at 25-04-02
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archive log restore to default location
channel ORA_AUX_DISK_1: using network backup set from service v19
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=16
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archive log restore to default location
channel ORA_AUX_DISK_1: using network backup set from service v19
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=17
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 25-04-02

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=1197388101 file name=/u01/app/oracle/oradata/ORCL/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=1197388101 file name=/u01/app/oracle/oradata/ORCL/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=1197388101 file name=/u01/app/oracle/oradata/ORCL/undotbs01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=1197388101 file name=/u01/app/oracle/oradata/ORCL/users01.dbf

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

executing command: SET until clause

Starting recover at 25-04-02
using channel ORA_AUX_DISK_1

starting media recovery

archive log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_16_1153872185.dbf thread=1 sequence=16
archive log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_17_1153872185.dbf thread=1 sequence=17
media recovery complete, elapsed time: 00:00:01
Finished recover at 25-04-02

contents of Memory Script:
{
   delete clone force archivelog all;
}
executing Memory Script

released channel: ORA_AUX_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=464 device type=DISK
deleted archive log
archive log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_16_1153872185.dbf RECID=1 STAMP=1197388098
deleted archive log
archive log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_17_1153872185.dbf RECID=2 STAMP=1197388100
deleted 2 objects

Oracle instance started

Total System Global Area    255851248 bytes

Fixed Size                     8923888 bytes
Variable Size                226492416 bytes
Database Buffers              16777216 bytes
Redo Buffers                   3657728 bytes

contents of Memory Script:
{
   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";
}
executing Memory Script

sql statement: alter system set  db_name =  ''ORCL'' 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    255851248 bytes

Fixed Size                     8923888 bytes
Variable Size                226492416 bytes
Database Buffers              16777216 bytes
Redo Buffers                   3657728 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP     1 ( '/u01/app/oracle/oradata/ORCL/redo01.log' ) SIZE 200 M  REUSE,
  GROUP     2 ( '/u01/app/oracle/oradata/ORCL/redo02.log' ) SIZE 200 M  REUSE,
  GROUP     3 ( '/u01/app/oracle/oradata/ORCL/redo03.log' ) SIZE 200 M  REUSE
 DATAFILE
  '/u01/app/oracle/oradata/ORCL/system01.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/ORCL/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/oracle/oradata/ORCL/sysaux01.dbf",
 "/u01/app/oracle/oradata/ORCL/undotbs01.dbf",
 "/u01/app/oracle/oradata/ORCL/users01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/ORCL/temp01.dbf in control file

datafile copy cataloged
datafile copy file name=/u01/app/oracle/oradata/ORCL/sysaux01.dbf RECID=1 STAMP=1197388131
datafile copy cataloged
datafile copy file name=/u01/app/oracle/oradata/ORCL/undotbs01.dbf RECID=2 STAMP=1197388131
datafile copy cataloged
datafile copy file name=/u01/app/oracle/oradata/ORCL/users01.dbf RECID=3 STAMP=1197388131

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1197388131 file name=/u01/app/oracle/oradata/ORCL/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=1197388131 file name=/u01/app/oracle/oradata/ORCL/undotbs01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=3 STAMP=1197388131 file name=/u01/app/oracle/oradata/ORCL/users01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
メモリー・スクリプトを実行しています

database opened
Finished Duplicate Db at 25-04-02

RMAN> exit


Recovery Manager complete.
[oracle@v19single ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 2 15:50:13 2025
Version 19.21.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.



Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.21.0.0.0

SQL> set linesize 1000 pagesize 1000
SQL> select instance_name,status from v$instance;

INSTANCE_NAME                            STATUS
---------------------------------------- ------------------------------------
orcl                                     OPEN

■ Troubleshooting Tips

SymptomCauseSolution
Connection fails with ORA-12514Incorrect configuration inside listener.ora or tnsnames.ora.Restart the listener and re-verify your network configuration syntax.
RMAN duplicate crashes midwayInsufficient resources or error within the conversion strings.Check the auxiliary alert log and RMAN log to see exactly where it halted.
Target DB cannot start upFaulty initialization parameters or path mapping errors.Re-verify your base PFILE configuration settings and conversion syntax.

■ Summary

Active Database Duplication is an extremely powerful feature that allows you to clone a live source database over the network to create a target environment without any prior backup operations.

It is incredibly useful when you need to provision test and verification environments quickly. Once you solidify this script syntax workflow, rebuilding or refreshing these environments becomes an easy task.

✅ Utilize from active database to implement highly efficient database cloning today! Try it out within your own environment.

[reference]
Duplicating Databases

How to Perform Oracle RMAN Backups and Basic Commands
In Oracle Database operations, data protection is the top priority. Oracle Recovery Manager (Oracle RMAN) is the standar…

コメント

Copied title and URL