天萃荷净
记录关于Oracle外部表的创建、删除、管理等操作,并使用Oracle外部表管理alert日志文件的案例
1.创建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')
);
2.使用Oracle外部表管理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-%';
--------------------------------------ORACLE-DBA----------------------------------------
最权威、专业的Oracle案例资源汇总之学习笔记:Oracle外部表 创建、管理外部表 使用外部表管理alert文件