Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

The action can't be completed because the file is open in OracleService

3367443Jan 16 2017 — edited Jan 19 2017

Hi,

I'm making a project that involves a generating a file then downloading it for the user. After the file is downloaded I want to delete it. The issue is that when I call fremove I get ORA-29291: file remove operation failed, if I try to delete it through explorer I get "The action can't be completed because the file is open in OracleService". Now if I generate the file but don't download it I can then delete it (cause is obvious). Here's my download code:

create or replace PROCEDURE PR_DOWNLOAD_LOG_FILE(p_file IN Number) IS

    v_length    NUMBER;

    v_file_name VARCHAR2(2000);

    Lob_loc     BFILE;

 

BEGIN

    SELECT FILENAME

    INTO v_file_name

    FROM FILE_TABLE

    WHERE ID = p_file;

   

    v_file_name := SUBSTR(v_file_name, INSTR(v_file_name, '/') + 1);

    v_file_name := SUBSTR(v_file_name, 0, (length(v_file_name) -4)) || '.log';

    Lob_loc  := bfilename('LOG_CACHE', v_file_name);

    v_length := dbms_lob.getlength(Lob_loc);

 

    owa_util.mime_header('text/plain', FALSE);

    htp.p('Content-length: ' || v_length);

    htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');

    owa_util.http_header_close;

    wpg_docload.download_file(Lob_loc);

  

END PR_DOWNLOAD_LOG_FILE;

I've tried looking for a solution but I couldn't find any. Clearly I'm not freeing the file where I should, but I'm not sure where.

This post has been answered by 3367443 on Jan 19 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2017
Added on Jan 16 2017
1 comment
600 views