ORA-27046 when transfer files [message #288259] |
Sun, 16 December 2007 14:24 |
RAY_HT
Messages: 155 Registered: May 2005 Location: Giza
|
Senior Member |
|
|
dear experts
i'm trying to use DBMS_FILE_TRANSFER.copy_file
KEY_DIR , daywork_dir has been created useing "create directory statment"
when i'm trying to execute this statment :
begin
DBMS_FILE_TRANSFER.copy_file('KEY_DIR','valid.key','DAYWORK_DIR','NEWVALID.KEY');
end ;
ORA-27046 returns !!!!
the file is exist, filesize is 86 kb .
why this error returned? and what can i do to solve this problem ?
note : should i control of filesize??!!!
|
|
|
|
|
Re: ORA-27046 when transfer files [message #288262 is a reply to message #288261] |
Sun, 16 December 2007 15:45 |
|
Barbara Boehmer
Messages: 9099 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
The dbms_file_transfer.copy_file requires that the file size be a multiple of 512 bytes, because it is intended for a specific purpose, where it expects to be copying data files containing blocks of data. For what you are doing, you should be using utl_file.fcopy. Please see the demonstration below that reproduces your problem with dbms_file_transfer.copy_file, then solves it with utl_file.fcopy.
SYSTEM@orcl_11g> HOST DEL newvalid.key
SYSTEM@orcl_11g> CREATE OR REPLACE DIRECTORY key_dir AS 'c:\oracle11g'
2 /
Directory created.
SYSTEM@orcl_11g> GRANT READ ON DIRECTORY key_dir TO scott
2 /
Grant succeeded.
SYSTEM@orcl_11g> CREATE OR REPLACE DIRECTORY daywork_dir AS 'c:\oracle11g'
2 /
Directory created.
SYSTEM@orcl_11g> GRANT WRITE ON DIRECTORY daywork_dir TO scott
2 /
Grant succeeded.
SYSTEM@orcl_11g> CONNECT scott/tiger
Connected.
SCOTT@orcl_11g>
SCOTT@orcl_11g> begin
2 DBMS_FILE_TRANSFER.copy_file ('KEY_DIR', 'valid.key', 'DAYWORK_DIR', 'NEWVALID.KEY');
3 end;
4 /
begin
*
ERROR at line 1:
ORA-19505: failed to identify file "c:\oracle11g\valid.key"
ORA-27046: file size is not a multiple of logical block size
OSD-04012: file size mismatch (OS 44)
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 84
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 193
ORA-06512: at line 2
SCOTT@orcl_11g>
SCOTT@orcl_11g> begin
2 UTL_FILE.FCOPY ('KEY_DIR', 'valid.key', 'DAYWORK_DIR', 'NEWVALID.KEY');
3 end;
4 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11g>
|
|
|