Can't Read Files using External Tables or Write Files using UTL_FILE using PL/SQL Can't Read Files using External Tables or Write Files using UTL_FILE using PL/SQL unix unix

Can't Read Files using External Tables or Write Files using UTL_FILE using PL/SQL


You need to give all the rights to the directory chmod 755 DEV or change the owner of the directory chown oracle:appdev DEV.I repeated the situation and got the same error.I created a test environment.

user root

esmd:/opt/oracle # ls -l |grep DEVdrwxrwx--- 3 appdev appdev    4096 2019-06-25 07:17 DEVesmd:/opt/oracle/DEV # ls -ltotal 4drwxrwxrwx 2 oracle dba 4096 2019-06-25 07:22 SAMPLEesmd:/opt/oracle # cd DEV/SAMPLE/esmd:/opt/oracle/DEV/SAMPLE # ls -ltotal 4-rw-r--r-- 1 oracle dba 8 2019-06-25 07:14 test.txt

user oracle

oracle@esmd:~> more /opt/oracle/DEV/SAMPLE/test.txt/opt/oracle/DEV/SAMPLE/test.txt: Permission denied

user appdev

oracle@esmd:~> su appdevPassword:appdev@esmd:/opt/oracle> ls -l /opt/oracle/DEV/SAMPLE/test.txt-rw-r--r-- 1 oracle dba 8 2019-06-25 07:14 /opt/oracle/DEV/SAMPLE/test.txt

DB user system

CREATE OR REPLACE DIRECTORY EXT_TAB_DATA AS '/opt/oracle/DEV/SAMPLE';CREATE TABLE sample_ext( sample1 varchar(10) )organization external (  default directory EXT_TAB_DATA  location ('test.txt')  );select  *from    sample_ext;  07:34:14  line 1: ORA-29913: error in executing ODCIEXTTABLEOPEN callout07:34:14  ORA-29400: data cartridge error07:34:14  error opening file /opt/oracle/DEV/SAMPLE/SAMPLE_EXT_4977.log

I changed dir DEV chmod 757 DEV and All works!

appdev@esmd:/opt/oracle> ls -l /opt/oracle |grep DEVdrwxrwx--- 3 appdev appdev   4096 2019-06-25 07:17 DEVappdev@esmd:/opt/oracle> chmod 775 DEVappdev@esmd:/opt/oracle> ls -l /opt/oracle |grep DEVdrwxrwxr-x 3 appdev appdev   4096 2019-06-25 07:17 DEVselect  *from    sample_ext; SAMPLE1                                ---------------- 1                1                1                1                

I changed dir DEV chmod 775 DEV or chown oracle:appdev DEV and All works!

   oracle@esmd:~> suPassword:esmd:/opt/oracle # ls -l |grep DEVdrwxrwxr-x 3 appdev appdev    4096 2019-06-25 07:17 DEVesmd:/opt/oracle # chown oracle:appdev DEVesmd:/opt/oracle # ls -l |grep DEVdrwxrwxr-x 3 oracle appdev    4096 2019-06-25 07:17 DEVesmd:/opt/oracle # chmod 770 DEVesmd:/opt/oracle # ls -l |grep DEVdrwxrwx--- 3 oracle appdev    4096 2019-06-25 07:17 DEVesmd:/opt/oracle #select  *    from    sample_ext;     SAMPLE1                                    ----------------     1                    1                    1                    1