I have to access a remote file in a different computer using utl_file
.
This is what I did:
create a user with Adminstrator+Users+ora_db profile in the remote PC, the same user is created with the same role in my PC.
Run the Oracle Services using this administrator account
Map the remote directory under Windows
use the following command to configure and accesss the file:
create or replace directory REMOTE_LOG as '\\remote_shared_dir\log';
declare
f UTL_FILE.FILE_TYPE;
line VARCHAR2(32767) ;
begin
BEGIN
f := UTL_FILE.FOPEN('REMOTE_LOG','toto.txt','R',32764);
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('err '||sqlerrm);
END;
UTL_FILE.GET_LINE( f, line );
UTL_FILE.FCLOSE( f ) ;
end;
But it failed with:
[Error] Execution (7: 3): ORA-29282: invalid file ID
ORA-06512: at "SYS.UTL_FILE", line 735
ORA-06512: at line 13
When I remove the exception handler I instead see:
[Error] Execution (7: 3): ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at line 8
What am I doing wrong?