資料泵expdp中query的使用及注意事項

來源:互聯網
上載者:User

在用資料泵匯出資料的時候,有時候我們需要按條件過濾掉一些不需要匯出的資料,這時候就需要用到參數query。下面是一個簡單使用query的小例子,在這個例子中我們也可以看出資料泵的一個缺陷,就是query參數和estimate參數是衝突的,當我們使用query參數的時候,資料泵estimate資料量會忽略query參數的過濾,使的estimate值異常。

 

 

expdp systemparfile=bi_20131203.par

Export: Release11.2.0.3.0 - Production on Tue Dec 3 18:51:04 2013

Copyright (c) 1982,2011, Oracle and/or its affiliates. Allrights reserved.

Password:

Connected to: OracleDatabase 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With thePartitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and RealApplication Testing options

Starting"SYSTEM"."SYS_EXPORT_TABLE_01": system/******** parfile=bi_20131203.par

Estimate in progressusing BLOCKS method...

Processing objecttype TABLE_EXPORT/TABLE/TABLE_DATA

Total estimationusing BLOCKS method: 61.75 GB

Processing objecttype TABLE_EXPORT/TABLE/TABLE

Processing objecttype TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT

 

 

查看下參數檔案more bi_20131203.par

 

directory=dump_bi

tables=bi_dw.DW_MID_CONTRACT

cluster=n filesize=4G

dumpfile=expdp_bi_ods_tables_20131203_%U.dmp

query=bi_dw.DW_MID_CONTRACT:"where data_date in(to_date('2013-11-13','yyyy-mm-dd'),to_date('2013-11-14','yyyy-mm-dd'),to_date('2013-8-13','yyyy-mm-dd'),to_date('2013-8-14','yyyy-mm-dd'))"

nologfile=y

 

 

通過資料庫查看到DW_MID_CONTRACT這張表有1.6億的資料量,該表的segment達到了60G,然而過濾後的資料只有2639086 rows,然而expdp計算的值

Total estimationusing BLOCKS method: 61.75 GB

 

最終,我們匯出的檔案僅僅只有873M expdp_bi_ods_tables_20131203_01.dmp

 

另外在資料泵導資料的過程中,我們可以expdp system ATTACH=SYS_EXPORT_TABLE_01到該任務。

job的名字可以通過job參數指定,也可以走預設,dba_datapump_jobs中記載了正在執行的資料泵任務。

select * from dba_datapump_jobs;

SYS_EXPORT_TABLE_01

GoldenGate不使用資料泵完成Oracle-Oracle的雙向複製

使用GoldenGate的資料泵進行Oracle-Oracle的單向複製

如何對 Oracle 資料泵(expdp/impdp) 進行 debug

Oracle 資料庫匯出資料泵(EXPDP)檔案存放的位置

Oracle 10g 資料泵分區表的匯出

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.