Home » SQL & PL/SQL » SQL & PL/SQL » ORA-27046 when transfer files (oracle DB, 10.2, windows)
ORA-27046 when transfer files [message #288259] Sun, 16 December 2007 14:24 Go to next message
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 #288260 is a reply to message #288259] Sun, 16 December 2007 14:32 Go to previous messageGo to next message
Michel Cadot
Messages: 68704
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:

ORA-27046: file size is not a multiple of logical block size
Cause: file size as indicated by stat is not correct, additional information indicates which function encountered the error
Action: verify that the file has not been overwritten or truncated

Regards
Michel
Re: ORA-27046 when transfer files [message #288261 is a reply to message #288259] Sun, 16 December 2007 14:43 Go to previous messageGo to next message
RAY_HT
Messages: 155
Registered: May 2005
Location: Giza
Senior Member
the file is exist .

filesize is 86kb.

i have just create it;


how can i solve this error?
Re: ORA-27046 when transfer files [message #288262 is a reply to message #288261] Sun, 16 December 2007 15:45 Go to previous message
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> 
 

Previous Topic: check date
Next Topic: NO DATA Exception
Goto Forum:
  


Current Time: Sun Nov 03 06:33:41 CST 2024