utl_file.fremove erros out when Oracle Grants are present for user (Linux)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have created oracle directory (SIMPLEDIR) and it points to a physical location on the disk. Oracle version is 12C.



The user has 'CREATE ANY DIRECTORY' and 'DROP ANY DIRECTORY' grants as confirmed by using query



            SELECT 'DIR' gtype, PRIVILEGE
FROM sys.dba_sys_privs
WHERE grantee = 'MY_TEST_USER1';


Can also confirm that the use has rights to create and read files.



            SELECT * 
FROM all_tab_privs
WHERE table_name = 'SIMPLEDIR';


Now I use the following block to create a file on disk



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
fHandle := UTL_FILE.FOPEN('SIMPLEDIR', 'my_test_1.txt', 'w');

UTL_FILE.PUT_LINE(fHandle, 'This is the first line');
UTL_FILE.PUT_LINE(fHandle, 'This is the second line');
UTL_FILE.PUT_LINE(fHandle, 'This is the third line');

UTL_FILE.FCLOSE(fHandle);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


This works fine and can confirm the file is now on the disk and I can also read the file using a simillar script as above.
However when I try to delete the file using the below script I get an error.



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
utl_file.fremove('SIMPLEDIR', 'my_test_1.txt');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


The error message is as follows



            Error report:
ORA-29291: file remove operation failed
ORA-06512: at line 8
29291. 00000 - "file remove operation failed"
*Cause: A file deletion attempt was refused by the operating system.
*Action: Verify that the file exists and delete privileges granted on
the directory and the file.


It is not a file lock issue since if I create a file and copy to the same location manually, still it fails to delete. How can I get more detail on the exact cause of the error.



To me it looks like a OS level issue since the error message has 'A file deletion attempt was refused by the operating system.'.



This works fine in internal systems where DB is hosted in windows server, but fails on customer where the DB is hosted on Linux.










share|improve this question

























  • What are the permissions on the file on disk? Who's the owner? What logon is being used by the DB? Group memberships? Etc?

    – Bob Jarvis
    Nov 27 '18 at 0:46











  • The files has read, write, execute grants for owner and group (-rwxrwxr-x). We can create dummy files in the said directory, however cannot delete those generated dummy files. Strange...

    – user3505441
    Nov 28 '18 at 22:43













  • Parent directories did not have write privileges. Thanks

    – user3505441
    Dec 11 '18 at 11:14


















0















I have created oracle directory (SIMPLEDIR) and it points to a physical location on the disk. Oracle version is 12C.



The user has 'CREATE ANY DIRECTORY' and 'DROP ANY DIRECTORY' grants as confirmed by using query



            SELECT 'DIR' gtype, PRIVILEGE
FROM sys.dba_sys_privs
WHERE grantee = 'MY_TEST_USER1';


Can also confirm that the use has rights to create and read files.



            SELECT * 
FROM all_tab_privs
WHERE table_name = 'SIMPLEDIR';


Now I use the following block to create a file on disk



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
fHandle := UTL_FILE.FOPEN('SIMPLEDIR', 'my_test_1.txt', 'w');

UTL_FILE.PUT_LINE(fHandle, 'This is the first line');
UTL_FILE.PUT_LINE(fHandle, 'This is the second line');
UTL_FILE.PUT_LINE(fHandle, 'This is the third line');

UTL_FILE.FCLOSE(fHandle);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


This works fine and can confirm the file is now on the disk and I can also read the file using a simillar script as above.
However when I try to delete the file using the below script I get an error.



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
utl_file.fremove('SIMPLEDIR', 'my_test_1.txt');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


The error message is as follows



            Error report:
ORA-29291: file remove operation failed
ORA-06512: at line 8
29291. 00000 - "file remove operation failed"
*Cause: A file deletion attempt was refused by the operating system.
*Action: Verify that the file exists and delete privileges granted on
the directory and the file.


It is not a file lock issue since if I create a file and copy to the same location manually, still it fails to delete. How can I get more detail on the exact cause of the error.



To me it looks like a OS level issue since the error message has 'A file deletion attempt was refused by the operating system.'.



This works fine in internal systems where DB is hosted in windows server, but fails on customer where the DB is hosted on Linux.










share|improve this question

























  • What are the permissions on the file on disk? Who's the owner? What logon is being used by the DB? Group memberships? Etc?

    – Bob Jarvis
    Nov 27 '18 at 0:46











  • The files has read, write, execute grants for owner and group (-rwxrwxr-x). We can create dummy files in the said directory, however cannot delete those generated dummy files. Strange...

    – user3505441
    Nov 28 '18 at 22:43













  • Parent directories did not have write privileges. Thanks

    – user3505441
    Dec 11 '18 at 11:14














0












0








0








I have created oracle directory (SIMPLEDIR) and it points to a physical location on the disk. Oracle version is 12C.



The user has 'CREATE ANY DIRECTORY' and 'DROP ANY DIRECTORY' grants as confirmed by using query



            SELECT 'DIR' gtype, PRIVILEGE
FROM sys.dba_sys_privs
WHERE grantee = 'MY_TEST_USER1';


Can also confirm that the use has rights to create and read files.



            SELECT * 
FROM all_tab_privs
WHERE table_name = 'SIMPLEDIR';


Now I use the following block to create a file on disk



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
fHandle := UTL_FILE.FOPEN('SIMPLEDIR', 'my_test_1.txt', 'w');

UTL_FILE.PUT_LINE(fHandle, 'This is the first line');
UTL_FILE.PUT_LINE(fHandle, 'This is the second line');
UTL_FILE.PUT_LINE(fHandle, 'This is the third line');

UTL_FILE.FCLOSE(fHandle);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


This works fine and can confirm the file is now on the disk and I can also read the file using a simillar script as above.
However when I try to delete the file using the below script I get an error.



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
utl_file.fremove('SIMPLEDIR', 'my_test_1.txt');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


The error message is as follows



            Error report:
ORA-29291: file remove operation failed
ORA-06512: at line 8
29291. 00000 - "file remove operation failed"
*Cause: A file deletion attempt was refused by the operating system.
*Action: Verify that the file exists and delete privileges granted on
the directory and the file.


It is not a file lock issue since if I create a file and copy to the same location manually, still it fails to delete. How can I get more detail on the exact cause of the error.



To me it looks like a OS level issue since the error message has 'A file deletion attempt was refused by the operating system.'.



This works fine in internal systems where DB is hosted in windows server, but fails on customer where the DB is hosted on Linux.










share|improve this question
















I have created oracle directory (SIMPLEDIR) and it points to a physical location on the disk. Oracle version is 12C.



The user has 'CREATE ANY DIRECTORY' and 'DROP ANY DIRECTORY' grants as confirmed by using query



            SELECT 'DIR' gtype, PRIVILEGE
FROM sys.dba_sys_privs
WHERE grantee = 'MY_TEST_USER1';


Can also confirm that the use has rights to create and read files.



            SELECT * 
FROM all_tab_privs
WHERE table_name = 'SIMPLEDIR';


Now I use the following block to create a file on disk



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
fHandle := UTL_FILE.FOPEN('SIMPLEDIR', 'my_test_1.txt', 'w');

UTL_FILE.PUT_LINE(fHandle, 'This is the first line');
UTL_FILE.PUT_LINE(fHandle, 'This is the second line');
UTL_FILE.PUT_LINE(fHandle, 'This is the third line');

UTL_FILE.FCLOSE(fHandle);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


This works fine and can confirm the file is now on the disk and I can also read the file using a simillar script as above.
However when I try to delete the file using the below script I get an error.



            declare 
fHandle UTL_FILE.FILE_TYPE;
begin
utl_file.fremove('SIMPLEDIR', 'my_test_1.txt');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;


The error message is as follows



            Error report:
ORA-29291: file remove operation failed
ORA-06512: at line 8
29291. 00000 - "file remove operation failed"
*Cause: A file deletion attempt was refused by the operating system.
*Action: Verify that the file exists and delete privileges granted on
the directory and the file.


It is not a file lock issue since if I create a file and copy to the same location manually, still it fails to delete. How can I get more detail on the exact cause of the error.



To me it looks like a OS level issue since the error message has 'A file deletion attempt was refused by the operating system.'.



This works fine in internal systems where DB is hosted in windows server, but fails on customer where the DB is hosted on Linux.







linux database oracle delete-file






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 22:42







user3505441

















asked Nov 26 '18 at 23:59









user3505441user3505441

97110




97110













  • What are the permissions on the file on disk? Who's the owner? What logon is being used by the DB? Group memberships? Etc?

    – Bob Jarvis
    Nov 27 '18 at 0:46











  • The files has read, write, execute grants for owner and group (-rwxrwxr-x). We can create dummy files in the said directory, however cannot delete those generated dummy files. Strange...

    – user3505441
    Nov 28 '18 at 22:43













  • Parent directories did not have write privileges. Thanks

    – user3505441
    Dec 11 '18 at 11:14



















  • What are the permissions on the file on disk? Who's the owner? What logon is being used by the DB? Group memberships? Etc?

    – Bob Jarvis
    Nov 27 '18 at 0:46











  • The files has read, write, execute grants for owner and group (-rwxrwxr-x). We can create dummy files in the said directory, however cannot delete those generated dummy files. Strange...

    – user3505441
    Nov 28 '18 at 22:43













  • Parent directories did not have write privileges. Thanks

    – user3505441
    Dec 11 '18 at 11:14

















What are the permissions on the file on disk? Who's the owner? What logon is being used by the DB? Group memberships? Etc?

– Bob Jarvis
Nov 27 '18 at 0:46





What are the permissions on the file on disk? Who's the owner? What logon is being used by the DB? Group memberships? Etc?

– Bob Jarvis
Nov 27 '18 at 0:46













The files has read, write, execute grants for owner and group (-rwxrwxr-x). We can create dummy files in the said directory, however cannot delete those generated dummy files. Strange...

– user3505441
Nov 28 '18 at 22:43







The files has read, write, execute grants for owner and group (-rwxrwxr-x). We can create dummy files in the said directory, however cannot delete those generated dummy files. Strange...

– user3505441
Nov 28 '18 at 22:43















Parent directories did not have write privileges. Thanks

– user3505441
Dec 11 '18 at 11:14





Parent directories did not have write privileges. Thanks

– user3505441
Dec 11 '18 at 11:14












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490874%2futl-file-fremove-erros-out-when-oracle-grants-are-present-for-user-linux%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490874%2futl-file-fremove-erros-out-when-oracle-grants-are-present-for-user-linux%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen