Copying file between mount points between different servers is straight forward and can be done using scp or ftp command. But transfering file between asm diskgroups of different servers  will be a tricky one.

There are two methods to do it.

1. Using cp command of asmcmd

2. Using DBMS_FILE_TRANSFER package

 

1. Using cp command of asmcmd

SYNTAX:

asmcmd cp <SOURCE_FILE_NAME>  USERNAME/PASSWORD@TARGET_SERVER_IP:<TARGET_ASM_INSTANCE>:<TARGET_FILE_LOCATION>
connect to local asm instance(source-host)

export ORACLE_HOME=/crsapp/app/oracle/product/grid12c
export ORACLE_SID=+ASM1

asmcmd cp +B2CWMARC/EXPDUMP/test.dmp sys/oracle@target-host.+ASM1:+NEWTST/TESTDB2/TEMPFILE/test1.dbf

You can specify the asm port also:

NOTE:

If you are getting error like ASMCMD-8201: (Bad argc for RDBMS:ASMCMD-8201) , then enable trace to find the exact error.

ASMCMD> cp +B2CWMARC/EXPDUMP/test.dmp sys/oracle123@172.21.46.133.+ASM1:+NEWTST/TESTDB2/TEMPFILE/test1.dbf
ASMCMD-8201: (Bad argc for RDBMS:ASMCMD-8201)

Enable trace as below:

$export DBI_TRACE=1

Now run the cp command

From the trace, find error and fix it and then retry the operation

2. Using DBMS_FILE_TRANSFER package

In the below example, we will try to copy a file test.dmp from asm diskgroup of source-host to asm diskgroup of target-host.

Create directory on source db:(where file is present)

Create directory on target db(where file need to be copied)

Create database link on target db ( pointing to source db)

Below is the syntax for dbms_file_transfer get function.(which need to be run on target db)
set timing on
BEGIN
DBMS_FILE_TRANSFER.GET_FILE (
source_directory_object IN VARCHAR2,
source_file_name IN VARCHAR2,
source_database IN VARCHAR2,
destination_directory_object IN VARCHAR2,
destination_file_name IN VARCHAR2);
END;
/

 

On target db:

Now check whether file has copied or not