Let's clone a 12.1.0.2 database.

 

Copy the init file of the source database to the target machine.  Then edit that new init file so as to adapt the names and paths to the target machine.  Create any missing path.

vi initRMP2FD.ora

 

On the target machine, add a static entry for your future clone database

vi listener.ora

then reload the listener

lsnrctl reload

In the tnsnames.ora of the target machine, add an alias for the target database

vi tnsnames.ora

Test that the new alias works

tnsping RMP2FD

 

SQL> startup nomount pfile=initRMP2FD.ora

ORACLE instance started.

 

05-07 15:50 RMP2FD SYS AS SYSDBA> alter system register;

System altered.

 

On the target machine,create a password file for your newdatabase

orapwd file=orapwRMP2FD entries=5 sysbackup=y

 

On the target machine, add a new entry in oratab for your target database

vi /etc/oratab

 

Add some parallelism on the RMAN TARGET (that is, the source database):

rman TARGET sys@RMP2 AUXILIARY sys@RMP2FD

Recovery Manager: Release 12.1.0.2.0 - Production on Fri Jul 5 16:40:07 2019

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

target database Password:

connected to target database: RMP2 (DBID=2787549961)

auxiliary database Password:

connected to auxiliary database: RMP2FD (not mounted)

 

RMAN> configure device type disk parallelism 4 backup type to backupset ;

using target database control file instead of recovery catalog

old RMAN configuration parameters:

CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;

new RMAN configuration parameters:

CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;

new RMAN configuration parameters are successfully stored

 

 

On the source machine, add an entry for your target database in tnsnames.ora:

 

RMP2FD =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = targethost)(PORT = 1568))

    )

    (CONNECT_DATA =

      (SID = RMP2FD)

    )

  )

 

Then, on the target machine, make sure your target instance is started with a pfile and the database is not mounted:

SQL> startup nomount pfile='initRMP2FD.ora';

 

Then, on the target machine, launch RMAN connecting to both the source (TARGET) database and the target (AUXILIARY) database:

rman TARGET sys@RMP2 AUXILIARY sys@RMP2FD

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jul 10 12:43:08 2019

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

target database Password:

connected to target database: RMP2 (DBID=2787549961)

auxiliary database Password:

connected to auxiliary database: RMP2FD (not mounted)

 

Then, run your RMAN "DUPLICATE DATABASE FROM ACTIVE USING COMPRESSED BACKUPSET" command:

DUPLICATE DATABASE TO RMP2FD FROM ACTIVE DATABASE USING COMPRESSED BACKUPSET SPFILE

    parameter_value_convert ('RMP2','RMP2FD')

    set db_file_name_convert='/data/xp32/ora1/RMP2/','/data/xs04/ora1/RMP2FD/','/data/lxpa0032/ora2/RMP2/','/data/xs04/ora2/RMP2FD/','/data/lxpa0032/ora3/RMP2/','/data/xs04/ora3/RMP2FD/'

    set log_file_name_convert='/data/lxpa0032/orared01/RMP2/','/data/xs04/orared01/RMP2FD','/data/lxpa0032/orared02/RMP2/','/data/xs04/orared02/RMP2FD'

    set audit_file_dest='/app/xs04/oracle/adm/RMP2FD/audit'

    set core_dump_dest='/app/xs04/oracle/diag/rdbms/unknown/RMP2FD/cdump'

    set control_files='/data/xs04/ora1/RMP2FD/ctl/control01.ctl','/data/xs04/ora1/RMP2FD/ctl/control02.ctl','/data/xs04/ora1/RMP2FD/ctl/control03.ctl'

    set db_name='RMP2FD'

    set diagnostic_dest='/app/xs04/oracle/'

    set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=xs04)(PORT=36080))'

    set log_archive_dest_1='location=/data/xs04/ora10/RMP2FD/arch'

    set log_archive_dest_2='location=/data/xs04/ora11/RMP2FD/arch'

    set utl_file_dir='/app/xs04/oracle/adm/RMP2FD/log'

      NOFILENAMECHECK;

Make sure your various "set" commands convert all the paths that must be converted (have a look at all the paths mentioned in your source database init file).

 

Then, watch RMAN do its magic:

Starting Duplicate Db at 10-JUL-19

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=12 device type=DISK

current log archived

contents of Memory Script:

{

   restore clone from service  'RMP2' using compressed backupset

   spfile to  '/app/lxsora04/oracle/product/12.1.0/dbs/spfileRMP2FD.ora';

   sql clone "alter system set spfile= ''/app/lxsora04/oracle/product/12.1.0/dbs/spfileRMP2FD.ora''";

}

executing Memory Script

Starting restore at 10-JUL-19

using channel ORA_AUX_DISK_1

 

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: using compressed network backup set from service RMP2

channel ORA_AUX_DISK_1: restoring SPFILE

...

 

I got one error only:

Executing: alter database enable block change tracking using file '/data/xp32/dump1/oracle/RMP2/save/RMAN/trackRMP2'

ORACLE error from auxiliary database: ORA-19751: could not create the change tracking file

ORA-19750: change tracking file: '/data/xp32/dump1/oracle/RMP2/save/RMAN/trackRMP2'

ORA-27040: file create error, unable to create file

Linux-x86_64 Error: 2: No such file or directory

because I had not entered a "set db_file_name_convert" for the path of the block change tracking file.  Fortunately, RMAN ignored that error and continued:

Ignoring error, reattempt command after duplicate finishes

contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script

database opened

Finished Duplicate Db at 10-JUL-19

 

My target database is now a clone of my source database: