expdp where子句错误

时间:2018-07-26 17:10:31

标签: oracle where clause expdp

我正在尝试基于查询子句进行导出转储。该表包含23.7亿行,我需要转储其中的一部分。这是我的文件

DIRECTORY=EXPSOURCE
DUMPFILE=obs_fact_%u.dmp
PARALLEL=4
TABLES=schema1.observation_fact
QUERY='schema1.observation_fact:"WHERE concept_cd < ''ICD10CM:N93.0'';"'

这会产生以下错误

ORA-31693: Table data object "SCHEMA1"."OBSERVATION_FACT" failed to load/unload and is being skipped due to error:
ORA-00933: SQL command not properly ended

我厌倦了将concept_cd代码用引号引起来,而不是使用double',但是收到了相同的错误。我已经研究了一段时间,没有任何进展。

Oracle Database 12c企业版12.1.0.2.0版-64位生产

1 个答案:

答案 0 :(得分:0)

QUERY子句是错误的,因为:

  • 您不要将其用单引号引起来
  • 您不必在字符串周围使用两个单引号
  • 您不会用分号终止WHERE子句

这意味着这样的事情应该起作用:

QUERY=schema1.observation_fact:"WHERE concept_cd < 'ICD10CM:N93.0'"

这是一个基于Scott的架构的示例:参数文件(看起来与您的文件相似;我在11gXE上无法使用PARALLEL选项):

directory=ext_dir
dumpfile=obs_fact_%u.dmp

tables=dept
query=dept:"where dname < 'VANCOUVER:N93.0'"

执行:

c:\Temp>expdp scott/tiger@xe  parfile=parfile_01.txt

Export: Release 11.2.0.2.0 - Production on ╚et Srp 26 22:15:41 2018

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

Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Starting "SCOTT"."SYS_EXPORT_TABLE_01":  scott/********@xe parfile=parfile_01.txt
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/TRIGGER
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT"                              5.929 KB       4 rows
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
  C:\TEMP\OBS_FACT_01.DMP
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 22:15:44


c:\Temp>