SQL * Loader有时会永远挂起

时间:2012-02-17 17:53:37

标签: oracle11g sql-loader oracle11gr2

我有一个SQL * Loader脚本我正在运行11g数据库 我正在使用11g版本的SQL * Loader。

我遇到的问题是,在插入最后一条记录之后,但在将最终提交计数打印到命令窗口之前和打印到日志文件之前,SQL * Loader会挂起。

这似乎可以在我们局域网本地的数据库上正常工作,但在局域网外的数据库上运行时会挂起。

如果我手动终止进程,所有记录都会成功加载到数据库中。

在.BAT FIle:

sqlldr CONTROL='SOME_TABLE.ctl' log='logs/SOME_TABLE.log' bad='bad/SOME_TABLE.bad' skip=1

在.CTL文件中:

OPTIONS(direct=true, rows=20000)
load data 
infile 'data/SOME_TABLE.csv'
append
into table SOME_TABLE
fields terminated by ','
OPTIONALLY ENCLOSED BY '"' AND '"'
trailing nullcols (
    FIELD01     CHAR(38),
    FIELD02     CHAR(500),
    FIELD03     CHAR(34),
    FIELD04     CHAR(1),
    FIELD05     CHAR(1),
    FIELD06     CHAR(10),
    FIELD07     CHAR(2),
    FIELD08     CHAR(5),
    FIELD09     CHAR(2),
    FIELD10     CHAR(5),
    FIELD11     CHAR(5),
    FIELD12     CHAR(4),
    FIELD13     CHAR(2),
    FIELD14     CHAR(9),
    FIELD15     CHAR(9),
    FIELD16     TIMESTAMP      "YYYY-MM-DD HH24:MI:SS.FF6",
    FIELD17     TIMESTAMP      "YYYY-MM-DD HH24:MI:SS.FF6",
    FIELD18     CHAR(38),
    FIELD19     CHAR(2),
    FIELD20     TIMESTAMP      "YYYY-MM-DD HH24:MI:SS.FF6",
    FIELD21     CHAR(2),
    FIELD22     CHAR(38),
    FIELD23     DATE           "MM/DD/YYYY",
    FIELD24     CHAR(15),
    FIELD25     DATE           "MM/DD/YYYY",
    FIELD26     CHAR(15),
    FIELD27     CHAR(3),
    FIELD28     CHAR(5),
    FIELD29     CHAR(4),
    FIELD30     CHAR(10),
    FIELD31     CHAR(10),
    FIELD32     CHAR(1),
    FIELD33     CHAR(4),
    FIELD34     CHAR(1),
    FIELD35     CHAR(1),
    FIELD36     CHAR(1)
)

表DDL:

--------------------------------------------------------
--  DDL for Table SOME_TABLE
--------------------------------------------------------
CREATE TABLE SOME_TABLE (
    FIELD01      NUMBER(*,0)         NOT NULL,
    FIELD02      FLOAT(126)          NOT NULL,
    FIELD03      VARCHAR2(34)            NULL,
    FIELD04      CHAR(1)                 NULL,
    FIELD05      CHAR(1)                 NULL,
    FIELD06      CHAR(10)                NULL,
    FIELD07      CHAR(2)                 NULL,
    FIELD08      CHAR(5)                 NULL,
    FIELD09      CHAR(2)                 NULL,
    FIELD10      CHAR(5)                 NULL,
    FIELD11      CHAR(5)                 NULL,
    FIELD12      CHAR(4)                 NULL,
    FIELD13      CHAR(2)                 NULL,
    FIELD14      CHAR(9)                 NULL,
    FIELD15      CHAR(9)                 NULL,
    FIELD16      TIMESTAMP(6)        NOT NULL,
    FIELD17      TIMESTAMP(6)        NOT NULL,
    FIELD18      NUMBER(*,0)             NULL,
    FIELD19      CHAR(2)                 NULL,
    FIELD20      TIMESTAMP(6)            NULL,
    FIELD21      CHAR(2)                 NULL,
    FIELD22      NUMBER(*,0)             NULL,
    FIELD23      DATE                    NULL,
    FIELD24      VARCHAR(15)             NULL,
    FIELD25      DATE                    NULL,
    FIELD26      VARCHAR(15)             NULL,
    FIELD27      CHAR(3)                 NULL,
    FIELD28      CHAR(5)                 NULL,
    FIELD29      CHAR(4)                 NULL,
    FIELD30      VARCHAR2(10)            NULL,
    FIELD31      VARCHAR2(10)            NULL,
    FIELD32      CHAR(1)                 NULL,
    FIELD33      CHAR(4)                 NULL,
    FIELD34      CHAR(1)                 NULL,
    FIELD35      CHAR(1)                 NULL,
    FIELD36      CHAR(1)                 NULL
)
    NOLOGGING
    NOCOMPRESS
    TABLESPACE RAW_DATA_01_TS
    PCTFREE    10
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                BUFFER_POOL      DEFAULT
               )
PARTITION BY RANGE(FIELD16) INTERVAL(NUMTODSINTERVAL(10, 'MINUTE')) (
    PARTITION SOME_TABLE_201001010000 VALUES LESS THAN (TO_DATE('2010-01-01 00:00', 'YYYY-MM-DD HH24:MI'))
);

预期:

SQL*Loader: Release 11.2.0.1.0 - Production on Fri Feb 17 10:36:14 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Load completed - logical record count 252593.

实际值:

SQL*Loader: Release 11.2.0.1.0 - Production on Fri Feb 17 10:36:14 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

1 个答案:

答案 0 :(得分:0)

我怀疑这与DIRECT=TRUE有关。 Oracle必须在流程结束时重新验证索引和约束。如果你的桌子很大,这可能会很长。