Forum Stats

  • 3,824,917 Users
  • 2,260,439 Discussions
  • 7,896,346 Comments

Discussions

issue writing to directory on different drive in XE 21c Windows

We are experienceing an issue with Oracle 21c XE for Windows where we are unable to write to a file that is on a different drive than where Oracle XE is installed. We get the following error:

ORA-29283: invalid file operation: nonexistent file or path [29434]

For example XE is installed on C:\ I can write to that but I can not write to my D:\ drive.

I have found this other thread (here) that is for 21c on Windows and it was suggested to open an SR. That topic is 10 months old and no update if a SR or bug was filed and I can not find anything on Oracle Support related to this issue. Anyone come across this issue?

Here is my code to replicate the issue

alter session set container=XEPDB1;

CREATE OR REPLACE DIRECTORY DIR_C AS 'c:\temp';
CREATE OR REPLACE DIRECTORY DIR_D AS 'd:\temp';

--Writing to C where Oracle XE is installed
DECLARE
  f utl_file.file_type;
begin
  f := utl_file.fopen ('DIR_C', 'test.txt', 'w');
  utl_file.put_line(f, to_char(sysdate, 'YYYY.MM.HH24.MI.SS'));
  utl_file.fclose(f);
end;
/

--Write to another drive
DECLARE
  f utl_file.file_type;
begin
  f := utl_file.fopen ('DIR_D', 'test.txt', 'w');
  utl_file.put_line(f, to_char(sysdate, 'YYYY.MM.HH24.MI.SS'));
  utl_file.fclose(f);
end;
/

First one runs without error. Second statement fails with

ERROR at line 1:
ORA-29283: invalid file operation: nonexistent file or path [29434]
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-06512: at "SYS.UTL_FILE", line 41
ORA-06512: at "SYS.UTL_FILE", line 478
ORA-06512: at line 4```

Answers

  • FrankGordon
    FrankGordon Member Posts: 32 Blue Ribbon

    Hello,


    Did the D:\TEMP directory exist before you last restarted the XE instance?

    Does the Oracle operating system user have permissions to write to the D:\TEMP directory?

    Does d:\temp exist?

    Did you try re-creating the Oracle directory object as 'D:\TEMP' rather than 'd:\temp'?


    Regards,

    Frank

  • Jeff Chirco
    Jeff Chirco Member Posts: 171 Bronze Badge

    Yes D:\TEMP existed after I restarted the XE instance and yes it has OS permission to that folder. I've tried both upper and lower case in the directory object, no luck.

  • FrankGordon
    FrankGordon Member Posts: 32 Blue Ribbon

    Hello,


    Thats odd.

    Try creating a dummy tablespace in d:\temp, something like

    CREATE TABLESPACE dummy1 DATAFILE 'd:\temp\dummy01.dbf' size 10m;

    What kind of errors does that show?


    Regards,

    Frank

  • Jeff Chirco
    Jeff Chirco Member Posts: 171 Bronze Badge
    edited Jun 16, 2022 2:14PM

    The tablespace was created successfully.

    C:\ORACLEXE\PRODUCT\21C\ORADATA\XE\XEPDB1\SYSTEM01.DBF
    C:\ORACLEXE\PRODUCT\21C\ORADATA\XE\XEPDB1\SYSAUX01.DBF
    C:\ORACLEXE\PRODUCT\21C\ORADATA\XE\XEPDB1\UNDOTBS01.DBF
    C:\ORACLEXE\PRODUCT\21C\ORADATA\XE\XEPDB1\USERS01.DBF
    D:\TEMP\DUMMY01.DBF
    
  • FrankGordon
    FrankGordon Member Posts: 32 Blue Ribbon

    Hello,


    So the database can see the D:\TEMP directory.

    try

    1. GRANT READ, WRITE ON DIRECTORY DIR_D TO <username_runing_the_script>;
    2. run the script
    3. stop and start the listener
    4. run the script

    Does that get you any further?

    How does the D:\ drive differ from the C:\ drive?

    Is the D:\ a share?


    Regards,

    Frank

  • Jeff Chirco
    Jeff Chirco Member Posts: 171 Bronze Badge

    Hi Frank. I am running this script as SYS so shouldn't be a need to grant directory privileges. I did however stop and start the listener but no changes.

    The D drive is just another physical hard drive on my computer, nothing special.