ORA-29913: 将 csv 插入 oracle 时执行 ODCIEXTTABLEOPEN 标注时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27230879/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 00:41:23  来源:igfitidea点击:

ORA-29913: error in executing ODCIEXTTABLEOPEN callout when inserting csv into oracle

oraclecsvplsql

提问by Nikita Buriak

I'm trying to execute this code in PL/SQL:

我正在尝试在 PL/SQL 中执行此代码:

create or replace directory ext_tab_dir as 'C:/mydir';
GRANT READ,WRITE ON DIRECTORY ext_tab_dir TO PUBLIC;
DROP TABLE emp_load;
CREATE TABLE emp_load (v1 VARCHAR2(4000), 
                        v2 VARCHAR2(4000) 
                        )
   ORGANIZATION EXTERNAL (
     TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir
     ACCESS PARAMETERS (
     RECORDS DELIMITED BY NEWLINE
     BADFILE ext_tab_dir:'bad.bad'
     LOGFILE ext_tab_dir:'log.log'
     FIELDS TERMINATED BY ','         
     )
     LOCATION ('testfile.csv')
   ); 
--   INSERT INTO tablename(v1,v2)
   SELECT * From emp_load    

and then getting next errors:

然后得到下一个错误:

ORA-29913: error in executing ODCIEXTTABLEOPEN callout    
ORA-29400: data cartridge error error opening file C:/mydir/log.log

I do get that it has to do something with permissions, but I'm the one who created that directory, so how do I grant priveleges to myself if it is set like this by default? Is there any way to perform that sort of operation from PL/SQL?

我确实知道它必须做一些具有权限的事情,但我是创建该目录的人,所以如果默认设置为这样,我如何向自己授予特权?有没有办法从 PL/SQL 执行这种操作?

回答by Rose

Try something like this.

尝试这样的事情。

GRANT SELECT, INSERT, UPDATE, DELETE ON emp_load TO NikitaBuriak;

Replace 'NikitaBuriak' with the ID you used when you created the table..

将“NikitaBuriak”替换为您在创建表时使用的 ID。

回答by PrinceKayastha

You should grant all the privileges to the directories and files in the location pointing to the file you are trying to access.

您应该向指向您尝试访问的文件的位置中的目录和文件授予所有权限。

eg : if the file you are trying to excess is in /home/dummy_folder/new_folder/file.txtthen you should grant all the administrative privileges to dummy_folder, new folder and file.txt as well

例如:如果您尝试多余的文件在,/home/dummy_folder/new_folder/file.txt那么您还应该将所有管理权限授予 dummy_folder、新文件夹和 file.txt