ORA-29283: invalid file operation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhushanbagul
    New Member
    • Jun 2007
    • 16

    ORA-29283: invalid file operation

    Hi All,

    I m facing mentioned error while executing below code at line no 3.

    CREATE or REPLACE DIRECTORY MY_DIR AS '/outputs/EXTRACTS';
    GRANT READ,WRITE ON DIRECTORY MY_DIR TO public;
    fileID := UTL_FILE.FOPEN( 'MY_DIR', fileName,'W');

    I tried all the possibe ways but still not understood what is the problem there.
    Please give ur sugeetions guys so i can try.

    Thanks & Regards,
    Bhushan
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by bhushanbagul
    Hi All,

    I m facing mentioned error while executing below code at line no 3.

    CREATE or REPLACE DIRECTORY MY_DIR AS '/outputs/EXTRACTS';
    GRANT READ,WRITE ON DIRECTORY MY_DIR TO public;
    fileID := UTL_FILE.FOPEN( 'MY_DIR', fileName,'W');

    I tried all the possibe ways but still not understood what is the problem there.
    Please give ur sugeetions guys so i can try.

    Thanks & Regards,
    Bhushan
    ORA-29283

    ORA-29283: invalid file operation

    Cause: An attempt was made to read from a file or directory that does not exist, or file or directory access was denied by the operating system.

    Action: Verify file and directory access privileges on the file system, and if reading, verify that the file exists.

    Comment

    • bhushanbagul
      New Member
      • Jun 2007
      • 16

      #3
      Originally posted by amitpatel66
      ORA-29283

      ORA-29283: invalid file operation

      Cause: An attempt was made to read from a file or directory that does not exist, or file or directory access was denied by the operating system.

      Action: Verify file and directory access privileges on the file system, and if reading, verify that the file exists.
      thanks for the reply,

      But i had got the same reply on google when i searched, i need some other solution guys.

      Regds,
      Bhushan

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by bhushanbagul
        thanks for the reply,

        But i had got the same reply on google when i searched, i need some other solution guys.

        Regds,
        Bhushan
        Could you check if you have R,W,X permission on the directory ''/outputs/EXTRACTS''??

        And CREATE DIRECTORY only creates a references object to the directory that you specidiy and not the directory itself.

        Check whether the directory is present in the SERVER side and not Client Side and Oracle has permission ot write to it....

        Use below Code to create the direcotry that u r using in yur code:

        SQL> HOST MD'D:/tmp'

        Comment

        • bhushanbagul
          New Member
          • Jun 2007
          • 16

          #5
          Originally posted by amitpatel66
          Could you check if you have R,W,X permission on the directory ''/outputs/EXTRACTS''??

          And CREATE DIRECTORY only creates a references object to the directory that you specidiy and not the directory itself.

          Check whether the directory is present in the SERVER side and not Client Side and Oracle has permission ot write to it....

          Use below Code to create the direcotry that u r using in yur code:

          SQL> HOST MD'D:/tmp'
          Amit

          Everything is fine about RWX u told still i m facing the same problem, i don't understanding what could be the problem. Is there any other reason bcoz of that OS dening on access by oracle

          Regds,
          Bhushan

          Comment

          • amitpatel66
            Recognized Expert Top Contributor
            • Mar 2007
            • 2358

            #6
            Originally posted by bhushanbagul
            Amit

            Everything is fine about RWX u told still i m facing the same problem, i don't understanding what could be the problem. Is there any other reason bcoz of that OS dening on access by oracle

            Regds,
            Bhushan
            Hi,

            I tried the following steps which worked fine:

            [code=oracle]

            create or replace directory my_dir AS '/tmp'

            GRANT READ,WRITE ON DIRECTORY my_dir TO PUBLIC;

            DECLARE
            File UTL_FILE.FILE_T YPE;
            BEGIN
            File:= UTL_FILE.FOPEN( 'MY_DIR','a.txt ','W');
            UTL_FILE.PUT_LI NE(File,'I am writing to file');
            UTL_FILE.FCLOSE (File);
            END;
            /
            [/CODE]

            The file a.txt was created and the content was written to the file perfectly.

            When I tried creating directory to '/usr', and GRANT all required privileges. Then tried executing the above mentioned anonymous block. It failed, it said the same error as it is showing for your code. And I also tried ftp'ing a file to the folder '/usr' but permission denied. So the DBA have given privileges only to some USERS to make use of the folder '/usr' but '/tmp' can be accessed by anybody.

            Hope this helps!!

            Comment

            • jorj
              New Member
              • Mar 2008
              • 1

              #7
              Originally posted by amitpatel66
              Hi,

              I tried the following steps which worked fine:

              [code=oracle]

              create or replace directory my_dir AS '/tmp'

              GRANT READ,WRITE ON DIRECTORY my_dir TO PUBLIC;

              DECLARE
              File UTL_FILE.FILE_T YPE;
              BEGIN
              File:= UTL_FILE.FOPEN( 'MY_DIR','a.txt ','W');
              UTL_FILE.PUT_LI NE(File,'I am writing to file');
              UTL_FILE.FCLOSE (File);
              END;
              /
              [/CODE]

              The file a.txt was created and the content was written to the file perfectly.

              When I tried creating directory to '/usr', and GRANT all required privileges. Then tried executing the above mentioned anonymous block. It failed, it said the same error as it is showing for your code. And I also tried ftp'ing a file to the folder '/usr' but permission denied. So the DBA have given privileges only to some USERS to make use of the folder '/usr' but '/tmp' can be accessed by anybody.

              Hope this helps!!



              yep, this one works!
              thx for ur help, i've been searching for this for more that 5 hours!
              OPEN SOURCE ROCKSSSS!!!!!!

              Comment

              Working...