Solved

external directory error in oracle

Posted on 2013-01-28
12
468 Views
Last Modified: 2013-01-28
I have created a procedure

CREATE OR REPLACE PROCEDURE Load_BLOB_From_File_Image IS
tmpVar NUMBER;
dest_loc  BLOB;
src_loc   BFILE := BFILENAME('CONTRACTS', '2011 HeartlandEmployeeReferralCard.pdf');

BEGIN
   
   
    -- +-------------------------------------------------------------+
    -- | INSERT INITIAL BLOB VALUE (an image file) INTO THE TABLE    |
    -- +-------------------------------------------------------------+
    INSERT INTO test_blob (id, file_name, image, timestamp)
        VALUES (1001, '2011 HeartlandEmployeeReferralCard.pdf', empty_blob(), sysdate)
        RETURNING image INTO dest_loc;

    -- +-------------------------------------------------------------+
    -- | OPENING THE SOURCE BFILE IS MANDATORY                       |
    -- +-------------------------------------------------------------+
    DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);

    -- +-------------------------------------------------------------+
    -- | OPENING THE LOB IS OPTIONAL                                 |
    -- +-------------------------------------------------------------+
    DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);

    -- +-------------------------------------------------------------+
    -- | SIMPLY CALL "loadfromfile" TO LOAD FILES INTO A LOB COLUMN  |
    -- +-------------------------------------------------------------+
    DBMS_LOB.LOADFROMFILE(
          dest_lob => dest_loc
        , src_lob  => src_loc
        , amount   => DBMS_LOB.getLength(src_loc));

    -- +-------------------------------------------------------------+
    -- | CLOSING ANY LOB IS MANDATORY IF YOU HAVE OPENED IT          |
    -- +-------------------------------------------------------------+
    DBMS_LOB.CLOSE(dest_loc);
    DBMS_LOB.CLOSE(src_loc);

    COMMIT;
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       -- Consider logging the error and then re-raise
       RAISE;
END Load_BLOB_From_File_Image;

When I run this procedure I get an error.


ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "HBC_DATA.LOAD_BLOB_FROM_FILE_IMAGE", line 65
ORA-06512: at line 3
ext-dir.JPG
0
Comment
Question by:anumoses
  • 7
  • 5
12 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
Post the results of the following two commands:
ls -al /home/hbc_data/ldon1
and
ls -al /home/hbc_data/ldon1/contracts
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
$ ls -al /home/hbc_data/ldon1
/home/hbc_data/ldon1 not found
$ ls -al /home/hbc_data/ldon1/contracts
/home/hbc_data/ldon1/contracts not found
pwd

/ldon1/contracts

when I log to heart1
 and do pwd its /home/hbc_data
then I do cd one space /ldon1
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
Did I typo the folder wrong from the image you posted?

The folder must exist on the database server and the oracle unix uer needs read access to the folder.
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
$ cd home
$ pwd
/home
$ cd hbc_data
$ pwd
/home/hbc_data
$ cd /ldon1
$ cd contracts
$
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
$ cd home/hbc_data /ldon1/contracts
sh: cd: The specified substitution is not valid for this command.
$
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
>>cd /ldon1

This is cd'ing into a root folder.

>>sh: cd: The specified substitution is not valid for this command.

This has a space in it.  Does the folder contain a space?

Post the results of:
ls -al /home/hbc_data
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Author Comment

by:anumoses
Comment Utility
I am attaching
dir.txt
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
I don't see any folder resembling ldon1.  That is the reason for your "ORA-22288: file or LOB operation FILEOPEN failed No such file or directory" error.

The image you posted for the creation of the CONTACTS directory, looks like you are trying to reference an ldon1 folder and it doesn't appear to exist where you specified it in the create directory syntax.
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
$ pwd
/home/hbc_data
$ cd /ldon1/contracts
$ pwd
/ldon1/contracts
$ ls
2011 HeartlandEmployeeReferralCard.pdf
$
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
Comment Utility
>>/ldon1/contracts

Then this needs to be the oracle directory.  Look at the original image you uploaded.  It has /home/hbc_data in front of /ldon1/contracts:

create or replace directory contracts as '/ldon1/contracts';
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
0
 
LVL 6

Author Closing Comment

by:anumoses
Comment Utility
thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now