ITPub博客

首页 > 数据库 > Oracle > 带where查询条件的expdp/impdp

带where查询条件的expdp/impdp

原创 Oracle 作者:DBA_每日记 时间:2019-11-11 10:41:29 0 删除 编辑

测试

expdp

1> 建表

create table test5 ecology.test5 (id int);


2> 插入5条数据

insert into ecology.test5 vaules (1);

insert into ecology.test5 vaules (2);

insert into ecology.test5 vaules (3);

insert into ecology.test5 vaules (4);

insert into ecology.test5 vaules (5);

commit;


3> 创建directory 

create ditectory mydata as '/data1/expdp';

grant read,write on directory mydata to ecology;


4> 导出id为1的数据

[oracle@oracle expdp]$ expdp ecology/ecology directory=mydata dumpfile=test5.dmp tables=test5 query='test5:"where id =1"'


Export: Release 11.2.0.1.0 - Production on Mon Nov 11 02:26:08 2019


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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting "ECOLOGY"."SYS_EXPORT_TABLE_01":  ecology/******** directory=mydata dumpfile=test5.dmp tables=test5 query=test5:"where id =1" 

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

. . exported "ECOLOGY"."TEST5"                           5.023 KB       1 rows

Master table "ECOLOGY"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

******************************************************************************

Dump file set for ECOLOGY.SYS_EXPORT_TABLE_01 is:

  /data1/expdp/test5.dmp

Job "ECOLOGY"."SYS_EXPORT_TABLE_01" successfully completed at 02:26:19



impdp

首先导出test5的全部数据(省略)

以下为导出命令

[oracle@oracle expdp]$ impdp ecology/ecology directory=mydata dumpfile=test5-1.dmp tables=test5 content=data_only query='test5:"where id=1"'


Import: Release 11.2.0.1.0 - Production on Mon Nov 11 02:38:29 2019


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


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table "ECOLOGY"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded

Starting "ECOLOGY"."SYS_IMPORT_TABLE_01":  ecology/******** directory=mydata dumpfile=test5-1.dmp tables=test5 content=data_only query=test5:"where id=1" 

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

. . imported "ECOLOGY"."TEST5"                           5.054 KB       1 out of 5 rows

Job "ECOLOGY"."SYS_IMPORT_TABLE_01" successfully completed at 02:38:31


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69950231/viewspace-2663441/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
聚焦人文和技术,分享干货,共同成长

注册时间:2019-10-09

  • 博文量
    177
  • 访问量
    238545