Sunday, May 24, 2009

File transfers for database cloning

Hi,
There are lot of ways in which files are copied from one database to the other during database cloning or transporting tablespaces. File transfers can be done using oracle package called "DBMS_FILE_TRANSFER".

Let us assume we need to transfer a file x.dbf from database SOURCE_DB to database DEST_DB.
Do the following :

AT SOURCE_DB:
==============
1)Create directory source_dir as '/u01/dbdata';

2)Create database link remote_db connect to system identified by manager
using 'remmote_db';

Make sure to add this entry in TNSNAMES.ORA file.
Check if the database link works by
select count(1) from dba_tables@remote_db;

AT DEST_DB:
============
create directory dest_dir as '/u02/dbdata';
Now back to SOURCE_DB:
exec dbms_file_transfer.put_file('SOURCE_DIR','x.dbf','DEST_DIR','x.dbf','REMOTE_DB'); Now the file is copied from SOURCE_DB to DEST_DB.

This package also has get_file and copy_file (for local copy). try this and it is faster too.

regards,
Vijay kaushik

No comments: