网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

Oracle11gexpdp中query参数的使用-创新互联

expdp中提供了query参数,可以在需要按条件导出表中部分数据时使用,它的使用就像是在select语句中的where条件使用一样。

创新互联建站于2013年开始,是专业互联网技术服务公司,拥有项目网站设计、成都网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元澄城做网站,已为上家服务,为澄城各地企业和个人服务,联系电话:13518219792

数据库版本

zx@ORCL>select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production PL/SQL Release 11.2.0.4.0 - Production CORE11.2.0.4.0Production TNS for Linux: Version 11.2.0.4.0 - Production NLSRTL Version 11.2.0.4.0 - Production

创建测试表

zx@ORCL>create table e1 (id number,name varchar2(20)); Table created. zx@ORCL>create table e2 (id number,birthday date); Table created.

插入测试数据

zx@ORCL>insert into e1 select level,lpad(level,20,'*') from dual connect by level <= 100; 100 rows created. zx@ORCL>commit; Commit complete. zx@ORCL>insert into e2 select level,sysdate-50+level from dual connect by level <= 100; 100 rows created. zx@ORCL>commit; Commit complete.

创建目录

zx@ORCL>create directory dir as '/home/oracle/'; Directory created. zx@ORCL>host

测试使用query导出

注意:如果query条件在parfile中则不需要用'\'进行转义

[oracle@rhel6 ~]$ expdp zx/zx directory=dir dumpfile=e1.dmp tables=zx.e1 query=zx.e1:\"where id<=50\" bash: =50": No such file or directory Export: Release 11.2.0.4.0 - Production on Thu Jul 21 14:23:11 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "ZX"."SYS_EXPORT_TABLE_01":  zx/******** directory=dir dumpfile=e1.dmp tables=zx.e1 query=zx.e1:"where id<=50"  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 "ZX"."E1"                                   6.757 KB      50 rows Master table "ZX"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for ZX.SYS_EXPORT_TABLE_01 is:   /home/oracle/e1.dmp Job "ZX"."SYS_EXPORT_TABLE_01" successfully completed at Thu Jul 21 14:23:26 2016 elapsed 0 00:00:11 exit

查询scn号

zx@ORCL>select dbms_flashback.get_system_change_number from dual; GET_SYSTEM_CHANGE_NUMBER ------------------------  2179047 zx@ORCL>select count(*) from e1;   COUNT(*) ----------        100

删除部分数据

zx@ORCL>delete from e1 where id<20; 19 rows deleted. zx@ORCL>commit; Commit complete. zx@ORCL>host

测试query及flashback_scn

[oracle@rhel6 ~]$ expdp zx/zx directory=dir dumpfile=e1_1.dmp tables=zx.e1 query=zx.e1:\"where id\<=50\" flashback_scn=2179047 Export: Release 11.2.0.4.0 - Production on Thu Jul 21 14:25:41 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "ZX"."SYS_EXPORT_TABLE_01":  zx/******** directory=dir dumpfile=e1_1.dmp tables=zx.e1 query=zx.e1:"where id<=50" flashback_scn=2179047  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 "ZX"."E1"                                   6.757 KB      50 rows Master table "ZX"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for ZX.SYS_EXPORT_TABLE_01 is:   /home/oracle/e1_1.dmp Job "ZX"."SYS_EXPORT_TABLE_01" successfully completed at Thu Jul 21 14:25:49 2016 elapsed 0 00:00:06 [oracle@rhel6 ~]$ exit exit

测试复杂query导出

zx@ORCL>select count(*) from e1 where id in( select id from e2 where birthdayhost

测试复杂query及flashback_scn导出

[oracle@rhel6 ~]$ expdp zx/zx directory=dir dumpfile=e1_3.dmp tables=zx.e1 query=zx.e1:\"where id in \( select id from e2 where birthday\

删除e2部分数据

zx@ORCL>delete from e2 where id>25 and id<30; 4 rows deleted. zx@ORCL>commit; Commit complete. zx@ORCL>select count(*) from e1 where id in( select id from e2 where birthday

测试query及flashback_scn,结果只是对e1应用flashback_snc,e2没有应用

zx@ORCL>host [oracle@rhel6 ~]$ expdp zx/zx directory=dir dumpfile=e1_4.dmp tables=zx.e1 query=zx.e1:\"where id in \( select id from e2 where birthday\

使e1和e2都应用flashback_scn

zx@ORCL>select count(*) from e1 where id in( select id from e2 as of scn 2179047 where birthdayhost [oracle@rhel6 ~]$ expdp zx/zx directory=dir dumpfile=e1_5.dmp tables=zx.e1 query=zx.e1:\"where id in \( select id from e2  as of scn 2179047  where birthday\

多个表使用query条件则使用','分开

[oracle@rhel6 ~]$ expdp system/123456 directory=dump dumpfile=query.dmp tables=zx.abc,zx.abce query=zx.abc:\"where id \< 4\",zx.abce:\"where id \< 4\" Export: Release 11.2.0.4.0 - Production on Fri Dec 9 16:13:41 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options FLASHBACK automatically enabled to preserve database integrity. Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/******** directory=dump dumpfile=query.dmp tables=zx.abc,zx.abce query=zx.abc:"where id < 4",zx.abce:"where id < 4"  Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 384 KB Processing object type TABLE_EXPORT/TABLE/TABLE . . exported "ZX"."ABC"                                  5.898 KB       2 rows . . exported "ZX"."ABCE"                                 5.898 KB       2 rows Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:   /home/oracle/query.dmp Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at Fri Dec 9 16:14:04 2016 elapsed 0 00:00:19

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前题目:Oracle11gexpdp中query参数的使用-创新互联
网址分享:http://bjjierui.cn/article/hcoph.html

其他资讯