Skip to Main Content
  • Questions
  • ORA-29283: invalid file operation on Windows server 2012

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, kk.

Asked: May 17, 2016 - 4:42 pm UTC

Last updated: November 26, 2018 - 9:52 am UTC

Version: 12c

Viewed 10K+ times! This question is

You Asked

Hi All

I am running in probably some corner case or not seeing something obvious. Appreciate any help to resolve this.


We are running Oracle database standard edition on windows server 2012. We are trying to write a file output of a function to the directory on this windows box. However we are getting following errors. When I tested the same code on my local laptop (oracle 11g express) I do not get this error.

Function:

create or replace FUNCTION "F_FOOTER2" RETURN CLOB AS
PS_FOOTER2 CLOB;
BEGIN

SELECT '<groupList/>
<reservationList/>'
INTO PS_FOOTER2
FROM NLS_DATABASE_PARAMETERS
WHERE PARAMETER = 'NLS_CHARACTERSET'
;


DBMS_XSLPROCESSOR.CLOB2FILE(PS_FOOTER2, 'OUTPUT_INT_XML', 'footer2.xml');

return PS_FOOTER2;
END F_FOOTER2;






Error:

ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 121
ORA-06512: at "PS_TMP.F_FOOTER2", line 13
ORA-06512: at line 5



Things we have tried/validated:

1. OUTPUT_INT_XML Directory has been defined and the actual directory exist in the windows drive. (this is not a shared drive but a local drive)

2. This directory in Database is defined under SYS, but the schema/user running above code has been granted read, write privileges to this directory

3. On windows server the schema user has been defined as a user with full access(read, write, execute) to the windows directory where we create the output file.

4. We bounced the database after defining all this parameters/directories etc

5. we are able to load data from this directories into the database, so we know the 'read' part is working

and Connor said...

OK, a basic test shows the *potential* for this to work :-)

<code>
SQL> create or replace procedure f_xsl AS
2 PS_FOOTER2 CLOB;
3 BEGIN
4 SELECT '<groupList/>
5 <reservationList/>'
6 INTO PS_FOOTER2
7 FROM dual;
8
9 DBMS_XSLPROCESSOR.CLOB2FILE(PS_FOOTER2, 'TEMP', 'footer2.xml');
10
11 END;
12 /

Procedure created.

SQL> exec f_xsl

PL/SQL procedure successfully completed.
<code>

so I'm going on the assumption its something local to your environment.

Fire up Services, and check which account the database is running under (could be Local System, or could be something else). This will be the (windows) account that will be doing the file creation. So that (windows) account needs appropriate OS privileges on the folder you're writing to.

An alternative way to validate this theory is temporarily change that folder to "Everyone-Full Control" and then see if the database can write to it.

Hope this helps.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Worked for me

Jeannette Vincent, November 08, 2016 - 3:33 pm UTC

This solved my problem why a proc created and working in an Oracle 10g instance was not working in my Oracle 12c instance.

Thank you Tom.

ORA-29283: invalid file operation

Jeff Steinfeldt, November 22, 2018 - 4:32 pm UTC

Awesome answer!
I just spent several hours trying to get beyond this error while trying to extract BLOBs and write them to a local (Windows PC) folder. In a very short span you had me moving forward again.

Connor McDonald
November 26, 2018 - 9:52 am UTC

Glad we could help.

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here