2.授予用户权限,并建立目录对象

  在此我们先建一个新用户


  create user test identified by “123” default tablespace test quota unlimited on test;

  用户授权


  SQL> grant create any directory to test;

  建立目录对象


  SQL> conn test / 123
  Connected.
  SQL> create directory ext as ‘/oracle/ext’;
  Directory created.

  3.建立外部表
SQL> create table exttable(
  id number,name varchar2(10),i number
  )organization external
  (type oracle_loader
  default directory ext
  access parameters
  (records delimited by newline
  fields terminated by ‘,’
  )location(‘ext.dat’)
  );

  4.测试


  SQL> select * from exttable;
  ID NAME                I
  ———- ———- ———-
  10 20                 30
  40 50                 60
  70 80                 90

  测试成功,可见在数据库中可以查询OS文件的数据

声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。