联系:手机/微信(+86 17813235971) QQ(107644445)
标题:ORACLE 外部表
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
一、简单创建外部表
1、简单模拟外部文件
10,20,30
40,50,60
70,80,90
2、创建外部表用户名和授权
create user test identified by “123” default tablespace test quota unlimited on test; grant RESOURCE,create session,create any directory to test;
3、创建目录
conn test/"123" create directory ext as '/sdb/orcl/file';
4、创建外部表
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') );
二、使用外部表管理alert文件
create directory alert as 'create directory bdump as '/oracle/u01/app/oracle/admin/db2/bdump'; create table alert_log ( text varchar2(400) ) organization external ( type oracle_loader default directory alert access parameters ( records delimited by newline ) location('alert_orcl.log') ); --查找到ora错误记录 select * from alert_log where TEXT like 'ORA-%';