Duplicate a Database Using RMAN in Oracle 19c

Preconditions & Assumptions

  • Source DB: ORCL (running and reachable over network).
  • Target DB (clone host): CLONE (OS user, Oracle software installed).
  • Network connectivity and valid tnsnames.ora / listener entries on both hosts.
  • You have SYSDBA credentials on source and auxiliary (clone).
  • Source database is backed up or accessible for network backups by RMAN (active duplication uses online data).
  • Adequate disk space on target for datafiles, redo, controlfiles, FRA, and temp.
  • Password file is copied to the target if needed for remote SYS connections.
  • PFILE for target is prepared with db_name and db_file_name_convert / log_file_name_convert configured.
  • You understand implications of RESETLOGS that RMAN may perform during duplicate.

High-level flow

  1. Copy password file and PFILE/SPFILE (or create PFILE from source SPFILE).
  2. Configure target pfile with db_name and *_file_name_convert entries.
  3. Prepare target directories and environment; start target instance NOMOUNT with PFILE.
  4. Ensure listeners and TNS entries allow RMAN to connect to the source from the target.
  5. Run RMAN DUPLICATE DATABASE TO 'clone' FROM ACTIVE DATABASE NOFILENAMECHECK from the clone host (auxiliary).
  6. RMAN creates control files, restores datafiles, applies logs, creates controlfile for clone, and opens clone database.
  7. Verify clone and perform post-duplicate housekeeping (backups, listeners, archive destinations, etc.).

Detailed step-by-step (copy-paste friendly)

Source host = orcl.localdomain.com (ORCL)
Target host = clone.localdomain.com (CLONE)
Modify all paths, hostnames, SIDs and environment variables to match your infrastructure.

SOURCE: copy password file and create PFILE

  1. Copy the password file from source to target (so RMAN can connect to the auxiliary instance as SYS):
# on SOURCE as oracle OS user
scp $ORACLE_HOME/dbs/orapworcl oracle@clone:$ORACLE_HOME/dbs/orapwclone
  1. Create a PFILE from the source SPFILE (so you can edit DB_NAME and file name convert entries for the target):
-- on SOURCE as SYS
SQL> SHOW PARAMETER spfile;
SQL> CREATE PFILE FROM SPFILE;
-- copy the created init<orcl>.ora to the target and rename to initclone.ora
scp $ORACLE_HOME/dbs/initorcl.ora oracle@clone:$ORACLE_HOME/dbs/initclone.ora

TARGET: prepare directories, pfile and environment

  1. Create required directories on the target:
# on TARGET as oracle
mkdir -p /oradb/app/oracle/admin/clone/adump
mkdir -p /oradb/app/oracle/oradata/clone
mkdir -p /oradb/app/oracle/oradata/clone/controlfile
mkdir -p /oradb/app/oracle/oradata/clone/onlinelog
mkdir -p /oradb/app/oracle/oradata/clone/datafile
  1. Edit initclone.ora (PFILE) — change db_name, and add convert parameters:
# initclone.ora (example entries to add/change)
*.audit_file_dest='/oradb/app/oracle/admin/clone/adump'
*.db_file_name_convert='/oradb/app/oracle/oradata/orcl','/oradb/app/oracle/oradata/clone'
*.log_file_name_convert='/oradb/app/oracle/oradata/orcl','/oradb/app/oracle/oradata/clone'
*.control_files='/oradb/app/oracle/oradata/clone/control01.ctl','/oradb/app/oracle/oradata/clone/control02.ctl'
*.db_name='clone'
  1. Configure target Oracle environment (example function to source in shell):
# set environment for CLONE (example)
export ORACLE_HOME=/oradb/app/oracle/product/19.0.0/db_1
export ORACLE_BASE=/oradb/app/oracle
export ORACLE_SID=clone
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:.
  1. Start the target instance in NOMOUNT using the modified PFILE:
# on TARGET as oracle
sqlplus / as sysdba
SQL> STARTUP PFILE='$ORACLE_HOME/dbs/initclone.ora' NOMOUNT;

NETWORK: listener and tnsnames configuration

  1. Ensure both source and target listeners are configured and running; ensure tnsnames.ora entries on both sides. Example entries:

listener.ora (on source and target — adjust HOST):

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = orcl.localdomain.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

tnsnames.ora example:

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

CLONE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = clone.localdomain.com)(PORT = 1521))
    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = clone.localdomain.com))
  )

Start/listen and verify tnsping from target to source.


RMAN: Active duplication (NOFILENAMECHECK and name conversion)

  1. From the target (clone) host, run RMAN and connect to both the source(target) and auxiliary (clone) instances:
# on TARGET
rman target sys/oracle@orcl auxiliary sys/oracle
  1. Execute the active duplicate command:
RMAN> DUPLICATE DATABASE TO 'clone' FROM ACTIVE DATABASE NOFILENAMECHECK;

Notes on parameters:

  • FROM ACTIVE DATABASE instructs RMAN to read the source’s datafiles over the network (no backup sets required).
  • NOFILENAMECHECK allows RMAN to retain file names; if environments are on different hosts you frequently need NOFILENAMECHECK.
  • Use DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT parameters in PFILE or SET NEWNAME RMAN commands to control target file names and locations.

Representative RMAN transcript (abridged)

RMAN will: create an SPFILE on clone from memory, restart the clone instance, restore a control file from the source, mount the clone, set NEWNAME for each datafile, restore datafiles, restore archived logs, recover to a SCN or until current, create controlfile for CLONE, switch datafile copies, and open the database RESETLOGS. Example transcript excerpts (abridged) from a lab run are included inline in the previous section of this article—retain for auditing.


Post-duplicate verification

Run these checks on the clone:

-- On CLONE
SQL> SELECT name, open_mode FROM v$database;
-- Verify controlfile and datafiles
SQL> SELECT name FROM v$controlfile;
SQL> SELECT file_name, tablespace_name FROM dba_data_files;
-- Check that services and listeners are correct
lsnrctl status
-- Check alert log for completion messages and any errors
tail -100 $ORACLE_BASE/diag/rdbms/clone/trace/alert_clone.log

Sample expected output:

NAME   OPEN_MODE
-----  ----------
CLONE  READ WRITE

Cleanup & mandatory actions

  1. Reset DB_NAME & DB_UNIQUE_NAME: RMAN duplicates typically adjust these during the process. Confirm DB_NAME and DB_UNIQUE_NAME are correct for CLONE.
  2. Listener/TNS: ensure CLONE listener is active and service registered.
  3. Archive / FRA: verify archive destinations, FRA size and config on clone.
  4. Backups: take a full RMAN backup of the clone after duplication and before putting clone into production.
  5. Network/security: rotate any passwords or keys if needed and remove copied password files if not required.
  6. Database identifiers: update any monitoring, backups, or management tooling to reference the new clone SID and DB_UNIQUE_NAME.

Troubleshooting common issues

  • RMAN cannot connect to source service: verify tnsnames.ora, listener services, and network reachability (ping, tnsping).
  • Insufficient disk space: duplication will fail if target file systems are full — validate free space prior to running.
  • Permissions errors when creating files: ensure Oracle OS user owns target directories and permissions allow Oracle to create files.
  • Controlfile restore failures: if RMAN cannot restore controlfile from service, ensure source is reachable and that SYS credentials are valid.
  • Mismatched character sets or endian issues: duplication across platforms of differing endian or incompatible charsets requires additional considerations — review Oracle documentation before cross-platform duplicates.
  • NOFILENAMECHECK misuse: be cautious — NOFILENAMECHECK can cause unintended overwrites if target and source share storage paths; validate db_file_name_convert carefully.

Best practices & recommendations

  • Test the duplicate procedure in a non-production environment before first run.
  • Maintain adequate network throughput between source and target (active duplication is network intensive).
  • Keep password file and PFILE/SPFILE handling secure — do not leave copies with weak permissions.
  • Automate pre-checks (space, listener status, tnsnames) as part of a duplication script to reduce human error.
  • Immediately backup the cloned database (RMAN backup) after duplication to establish a recovery baseline.
  • Document the clone operation (timestamp, RMAN commands used, any special parameters, and post-checks).

Short checklist (run before executing)

  • Confirm source DB is fully available and stable.
  • Copy password file to target.
  • Create & edit PFILE for clone (db_name, file convert parameters).
  • Create directories and verify permissions on target.
  • Ensure listeners and network connectivity are validated.
  • Confirm sufficient free space on target.
  • Prepare RMAN credentials for source and auxiliary.
  • Schedule maintenance window (if required).

Oracle DBA

Experienced OCM-certified Oracle Database Administrator with over 18 years of expertise in designing, implementing, and managing complex database solutions. My expertise spans performance optimization, security, and high-stakes solution implementation. Adept at managing complex environments with precision.

No Comments

    Leave a Message

    Your email address will not be published. All fields are mandatory. **