The
dbms_file_transfer package,
available in 10g and later,
supports copying via the local
file system or an ASM (Automated Storage
Management) disk group as both the source and
target for a binary file transfer between
databases servers. An example of using this
package would be to copy BFILE objects across
databases. Remember, the database stores just
the BFILE attributes – the data resides outside
the database. So use
dbms_file_transfer to copy the
actual BFILE data and not just the attributes
held within the database. However, there are
some limitations:
The process is very simple. First create a
database directory to read from on the source
and another one on the target for the write.
Then make sure that both databases have grants
on the directories and the
dbms_file_transfer package for the
schemas used to perform the task. Then use one
of the following three procedures.
Copy_file
reads a file from the local database directory
and copies it to another local database
directory. The DBA is able to copy any type file
when working with local file systems, but ASM
supports only moving database files since that
is all that can be held within ASM.
|
Argument
|
Type
|
In / Out
|
Default Value
|
|
SOURCE_DIRECTORY_OBJECT
|
VARCHAR2
|
IN
|
|
|
SOURCE_FILE_NAME
|
VARCHAR2
|
IN
|
|
|
DESTINATION_ DIRECTORY_OBJECT
|
VARCHAR2
|
IN
|
|
|
DESTINATION_FILE_NAME
|
VARCHAR2
|
IN
|
|
Table 6.136:
Copy_file Parameters
Get_file
reads a file from the remote database directory
and copies it to the source local database
directory. The DBA can copy any type file when
working with local file systems, but ASM
supports only moving database files since that
is all that can be held within ASM.
|
Argument
|
Type
|
In / Out
|
Default Value
|
|
SOURCE_DIRECTORY_OBJECT
|
VARCHAR2
|
IN
|
|
|
SOURCE_FILE_NAME
|
VARCHAR2
|
IN
|
|
|
SOURCE_DATABASE
|
VARCHAR2
|
IN
|
|
|
DESTINATION_ DIRECTORY_OBJECT
|
VARCHAR2
|
IN
|
|
|
DESTINATION_FILE_NAME
|
VARCHAR2
|
IN
|
|
Table 6.137:
Get_file Parameters
Put_file
reads a file from the local database directory
and copies it to the target remote database
directory.
|
Argument
|
Type
|
In / Out
|
Default Value
|
|
SOURCE_DIRECTORY_OBJECT
|
VARCHAR2
|
IN
|
|
|
SOURCE_FILE_NAME
|
VARCHAR2
|
IN
|
|
|
DESTINATION_ DIRECTORY_OBJECT
|
VARCHAR2
|
IN
|
|
|
DESTINATION_FILE_NAME
|
VARCHAR2
|
IN
|
|
|
DESTINATION_DATABASE
|
VARCHAR2
|
IN
|
|
Table 6.138:
Put_file Parameters