【问题标题】:External table creation in oracle using csv from ftp location使用来自 ftp 位置的 csv 在 oracle 中创建外部表
【发布时间】:2014-03-04 13:07:54
【问题描述】:

为此我尝试将 csv 文件数据加载到 external_tables 中

  create table ext_table_csv (
      i   Number,
      n   Varchar2(20),
      m   Varchar2(20)
    )
    organization external (
      type              oracle_loader
      default directory ext_dir
      access parameters (
        records delimited  by newline
        fields  terminated by ','
        missing field values are null
      )
      location ('f

ile.csv')
)
reject limit unlimited;

但我得到了错误

Error starting at line 8 in command:

    create table ext_table_csv (
      i   Number,
      n   Varchar2(20),
      m   Varchar2(20)
    )
    organization external (
      type              oracle_loader
      default directory ext_dir
      access parameters (
        records delimited  by newline
        fields  terminated by ','
        missing field values are null
      )
      location ('f

ile.csv')
)
reject limit unlimited


Error at Command Line:15 Column:23
Error report:

    SQL Error: ORA-06564: object DATA_DIR does not exist
    06564. 00000 -  "object %s does not exist"
    *Cause:    The named object could not be found.  Either it does not exist
               or you do not have permission to access it.
    *Action:   Create the object or get permission to access it.

我要做的是我想从 ftp 位置读取 csv 文件。有什么办法可以实现吗?

【问题讨论】:

  • 为什么create语句有default directory ext_dir但错误是default directory data_dir?您是否在创建外部表之前创建了 Oracle 目录?

标签: sql oracle csv external-tables


【解决方案1】:

您可能需要指定文件的位置。

 location (FTP_DIRECTORY:'emp.dat')

其中 FTP_DIRECTORY 是一个 Oracle Directory 对象,指向您放置的位置 文件。

【讨论】:

  • 我在客户端没有权限在服务器端创建目录意味着我应该给我的目录路径 C:/temp
  • @jackyesind - 目录必须是服务器端的。您不能有一个文件对 Oracle 服务器不可见的外部表(在本地或远程安装的文件系统上)。如果您无法将文件移动到服务器,您可以从客户端使用 SQL*Loader,将其加载到普通表中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-31
  • 1970-01-01
  • 2020-10-30
相关资源
最近更新 更多