Wednesday, October 5, 2011

Coping OS files using SQL

create source directory object

SQL> create directory soruce_dir as '/u01/app/oracle/source';

Directory created.

create target directory object

SQL> create directory target_dir as  '/u01/app/oracle/target';

Directory created.

Now use the copy_file procedure of dbms_file_transfer package as below

  dbms_file_transfer.copy_file (
  source_directory_object => 'source_dir',
  destination_directory_object => 'dest_dir',
  source_file_name => 'my_file_to_copied',
  destination_file_name => 'my_file_to_copied');

Note that the file that needs to be copied over can’t be larger than 2 terabytes and each file’s size has to be a multiple of 512 bytes.

No comments:

Post a Comment