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 |
測試成功,可見在數(shù)據(jù)庫中可以查詢OS文件的數(shù)據(jù)