码迷,mamicode.com
首页 > 数据库 > 详细

oracle 外部表(一)生成外部表脚本

时间:2017-10-18 18:25:12      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:ext   cte   parameter   tin   limited   size   count   ini   parallel   

-------------demo.ctl
LOAD DATA
INFILE *
INTO TABLE DEPT
APPEND
FIELDS TERMINATED BY ,
(
   DEPTNO,
   DNAME,
   LOC,
   LAST_UPDATA
)
BEGINDATA
10,Sales,Virginia,2015-01-01
20,Accounting,Virginia,2016-01-01
使用external_table=generate_only会在日志文件中生成对应的脚本
sqlldr userid=scott/dcjet control=d:\tmp\demo.ctl log=d:\tmp\demo.log parallel=y  external_table=generate_only
启用并行 DML: ALTER SESSION ENABLE PARALLEL DML


用于外部表的 CREATE TABLE 语句:
------------------------------------------------------------------------
CREATE TABLE "SYS_SQLLDR_X_EXT_DEPT2" 
(
  "DEPTNO" NUMBER(38),
  "DNAME" VARCHAR2(100),
  "LOC" VARCHAR2(100),
  "LAST_UPDATA" DATE
)
ORGANIZATION external 
(
  TYPE oracle_loader
  DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
  ACCESS PARAMETERS 
  (
    RECORDS DELIMITED BY NEWLINE CHARACTERSET ZHS16GBK
    BADFILE SYS_SQLLDR_XT_TMPDIR_00000:demo.bad
    LOGFILE SYS_SQLLDR_XT_TMPDIR_00000:demo.log_xt
    READSIZE 1048576
    SKIP 12
    FIELDS TERMINATED BY "," LDRTRIM 
    REJECT ROWS WITH ALL NULL FIELDS 
    (
      "DEPTNO" CHAR(255)
        TERMINATED BY ",",
      "DNAME" CHAR(255)
        TERMINATED BY ",",
      "LOC" CHAR(255)
        TERMINATED BY ",",
      "LAST_UPDATA" CHAR(255)
        TERMINATED BY ","
        DATE_FORMAT DATE MASK yyyy-mm-dd
    )
  )
  location 
  (
    demo.ctl
  )
)REJECT LIMIT UNLIMITED


用于加载内部表的 INSERT 语句:
------------------------------------------------------------------------
INSERT /*+ append */ INTO DEPT2 
(
  DEPTNO,
  DNAME,
  LOC,
  LAST_UPDATA
)
SELECT 
  "DEPTNO",
  "DNAME",
  "LOC",
  "LAST_UPDATA"
FROM "SYS_SQLLDR_X_EXT_DEPT2"


用于清除由以前的语句创建的对象的语句:
------------------------------------------------------------------------
DROP TABLE "SYS_SQLLDR_X_EXT_DEPT2"

 

oracle 外部表(一)生成外部表脚本

标签:ext   cte   parameter   tin   limited   size   count   ini   parallel   

原文地址:http://www.cnblogs.com/xuzhong86/p/7687841.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!