Question

I wanted to create an external table, but did not have the CREATE ANY DIRECTORY permission (and could not have it granted). Fair enough, I asked the DBAs to run the following:

CREATE OR REPLACE DIRECTORY ext_data_files AS '/data/ext_data_files';
GRANT ALL ON DIRECTORY ext_data_files TO MYAPPUSER;

They did, and the final object has the following script:

CREATE OR REPLACE DIRECTORY 
EXT_DATA_FILES AS 
'/data/ext_data_files';
GRANT READ, WRITE ON DIRECTORY SYS.EXT_DATA_FILES TO MYAPPUSER;

(I got that from asking a desc with Toad)

I was then hoping to use this directory to create my external table with the script as follows:

CREATE TABLE MYAPPUSER.MY_EXT_TABLE
(
  ID                VARCHAR2(100 BYTE),
  LOGIN             VARCHAR2(100 BYTE),
  CODE              VARCHAR2(100 BYTE),
  CREATED_AT        VARCHAR2(100 BYTE)
)
ORGANIZATION EXTERNAL
  (  TYPE ORACLE_LOADER
     DEFAULT DIRECTORY SYS.EXT_DATA_FILES
     ACCESS PARAMETERS 
       ( RECORDS DELIMITED BY NEWLINE
    NOBADFILE
    NOLOGFILE
    FIELDS TERMINATED BY ';'
    MISSING FIELD VALUES ARE NULL
    ( ID, LOGIN, CODE, CREATED_AT) )
     LOCATION (SYS.EXT_DATA_FILES:'the_external_file.txt')
  )
REJECT LIMIT 0
PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )
NOMONITORING;

but then when I SELECT * FROM MY_EXT_TABLE, the result is the infamous

ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file the_external_file.txt in EXT_DATA_FILES not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19

(which has quite a few hits on google, but none seem related)

I'm confident of the syntax since this is the exact same script used in our DEV environment. Also, the permissions of all files and directories involved were checked and there is nothing lower than 775.

The only difference I have here from DEV (where it works) is that the directory EXT_DATA_FILES was not created by MYAPPUSER. I tried to create a synonym for it.. but had no effect.

Maybe worth mentioning, it is Oracle 10g we are talking about.

Am I missing something obvious? Is this allowed?

Was it helpful?

Solution

All directories are in fact owned by SYS. That's why there is no CREATE DIRECTORY privilege, only CREATE ANY DIRECTORY.

So try the command without prefixing the directory name with the SYS schema and see what happens.

OTHER TIPS

The error message reads: "file the_external_file.txt in EXT_DATA_FILES not found"

Are you sure it's there?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top