首页 > 数据库 > Oracle > 正文

ORACLE 报警日志如何查看?第1/2页

2020-07-26 14:34:27
字体:
来源:转载
供稿:网友
1.了解oracle外部表
  外部表定义:结构被存放在数据字典,而表数据被放在OS文件中的表
  作用:在数据库中查询OS文件的数据,还可以将OS文件数据装载到数据库中
  与其它表的区别:在外部表上不能执行DML操作,也不能在外部表上建索引,只能执行select操用
  2.建一个简单的外部表1.建一个OS上的文件
  因为外部表主要是查看OS上的文件,首先在OS上建一个文件
mkdir -p /oracle/ext
  vi /oracle/ext/ext.dat
  10,20,30
  40,50,60
  70,80,90

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

12下一页阅读全文
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表