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文件的数据