iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >oracle 11g expdp工具的query参数使用
  • 615
分享到

oracle 11g expdp工具的query参数使用

2024-04-02 19:04:59 615人浏览 安东尼
摘要

实际生产中导数据时可能会需要导部分数据到测试库上,expdp的query参数就可以完成这样的需求。数据库版本zx@ORCL>select * from v$version;BANNER---

实际生产中导数据时可能会需要导部分数据到测试库上,expdp的query参数就可以完成这样的需求。

数据库版本

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导出

[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 birthday<sysdate);

  COUNT(*)

----------

31

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

Export: Release 11.2.0.4.0 - Production on Thu Jul 21 14:31:04 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_2.dmp tables=zx.e1 query=zx.e1:"where id in ( select id from e2 where birthday<sysdate)" 

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.242 KB      31 rows

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

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

Dump file set for ZX.SYS_EXPORT_TABLE_01 is:

  /home/oracle/e1_2.dmp

Job "ZX"."SYS_EXPORT_TABLE_01" successfully completed at Thu Jul 21 14:31:12 2016 elapsed 0 00:00:06

[oracle@rhel6 ~]$ exit

exit

zx@ORCL>host

测试复杂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\<sysdate\)\"  flashback_scn=2179047

Export: Release 11.2.0.4.0 - Production on Thu Jul 21 14:32:07 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_3.dmp tables=zx.e1 query=zx.e1:"where id in ( select id from e2 where birthday<sysdate)" 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_3.dmp

Job "ZX"."SYS_EXPORT_TABLE_01" successfully completed at Thu Jul 21 14:32:14 2016 elapsed 0 00:00:06

[oracle@rhel6 ~]$ exit

exit

删除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<sysdate);

  COUNT(*)

----------

27

测试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\<sysdate\)\"  flashback_scn=2179047

Export: Release 11.2.0.4.0 - Production on Thu Jul 21 14:33:55 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_4.dmp tables=zx.e1 query=zx.e1:"where id in ( select id from e2 where birthday<sysdate)" 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.648 KB      46 rows

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

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

Dump file set for ZX.SYS_EXPORT_TABLE_01 is:

  /home/oracle/e1_4.dmp

Job "ZX"."SYS_EXPORT_TABLE_01" successfully completed at Thu Jul 21 14:34:03 2016 elapsed 0 00:00:06

[oracle@rhel6 ~]$ exit

exit

使e1和e2都应用flashback_scn

zx@ORCL>select count(*) from e1 where id in( select id from e2 as of scn 2179047 where birthday<sysdate);

  COUNT(*)

----------

31

zx@ORCL>host

[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\<sysdate\)\"  flashback_scn=2179047

Export: Release 11.2.0.4.0 - Production on Thu Jul 21 14:39:52 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_5.dmp tables=zx.e1 query=zx.e1:"where id in ( select id from e2 as of scn2179047 where birthday<sysdate)" 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

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


您可能感兴趣的文档:

--结束END--

本文标题: oracle 11g expdp工具的query参数使用

本文链接: https://www.lsjlt.com/news/44251.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • expdp之query、flashback_scn参数的使用
    实验环境 操作系统:CentOS 7.1 数据库:Oracle 11.2.0.4   在使用10g后的Oracle Data Pump导出数据时, expdp中提供了...
    99+
    2024-04-02
  • 使用oracle 11G自带sqldeveloper 工具
    工具:图形化工具vnc,oracle 11g步骤:1、启动vncserver服务2、查看hostname3、查看监控进程,以及SID4、以系统用户登录数据库 sqlplus / as sysdba,查看用户...
    99+
    2024-04-02
  • oracle 11g adrci 工具使用方法
    oracle 11g adrci  是11g 以后才能的新功能 [oracle@rac1 ~]$ adrci ADRCI: Release 11.2.0.4.0 - Production...
    99+
    2024-04-02
  • oracle 11g常用隐含参数
    ORACLE 11GR2常用参数(含隐含参数)设置如下: alter system set "_PX_use_large_pool" = true scope=spfile; alter system se...
    99+
    2024-04-02
  • Oracle 11G安装bbed工具的步骤
    这篇文章主要讲解了“Oracle 11G安装bbed工具的步骤”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Oracle 11G安装bbed工具的步骤”吧!...
    99+
    2024-04-02
  • 如何使用pt-query-digest工具
    这篇文章将为大家详细讲解有关如何使用pt-query-digest工具,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。 slow log 分析...
    99+
    2024-04-02
  • 【EXPDP】使用EXPDP备份数据时预估大小——ESTIMATE参数
    使用EXPDP在完成数据导出时,可以使用ESTIMATE参数评估待导出数据库对象的大小,简单演示一下,供参考。1.查看有关ESTIMATE参数的帮助信息1)查看命令行帮助信息ora10g@secDB /expdp$ expdp help=y...
    99+
    2023-06-06
  • MySQL中pt-query-digest工具怎么使用
    这篇文章主要介绍“实例分析MySQL中pt-query-digest工具的使用记录”,在日常操作中,相信很多人在实例分析MySQL中pt-query-digest工具的使用记录问题上存在疑惑,小编查阅了各式...
    99+
    2022-12-07
    mysql pt-query-digest
  • ORACLE工具之使用SQLPLUS
    SQL*Plus 是 ORACLE 数据库的命令行工具,它允许用户通过命令行界面与数据库进行交互,并执行 SQL 语句。以下是使用 ...
    99+
    2023-08-24
    oracle
  • Oracle 11g 使用RMAN备份数据库
    使用Oracle自带的备份恢复工具RMAN(Recovery Manager)具有以下几种优势:支持增量备份能自动管理备份文件自动化备份与恢复备份的文件有效性检查配置快闪恢复区(flash recovery...
    99+
    2024-04-02
  • HDFS Balancer工具主要调优参数怎么使用
    这篇“HDFS Balancer工具主要调优参数怎么使用”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“HDFS&n...
    99+
    2023-07-05
  • expdp/impdp如何使用version参数跨版本数据迁移
    小编给大家分享一下expdp/impdp如何使用version参数跨版本数据迁移,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧! ...
    99+
    2024-04-02
  • oracle中Parallel参数的使用
    在Oracle数据库中,Parallel参数用于控制并行查询和并行DML操作的行为。以下是一些常见的Parallel参数及其使用方法...
    99+
    2023-08-08
    oracle
  • Oracle官方工具SQLDeveloper的简单使用
    1、下载地址: https://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/ 下载解压后可直...
    99+
    2024-04-02
  • C++缺省参数的具体使用
    目录一、缺省参数概念二、缺省参数分类❗ 全缺省参数 ❕❗ 半缺省参数 ❕缺省参数的误区1.滥用缺省参数,损害代码的结构和可读性。2.多个缺省参数,可能引入逻辑含混的调用方式3.重载时...
    99+
    2024-04-02
  • 怎么使用Oracle数据库的逻辑备份工具
    这篇文章主要介绍“怎么使用Oracle数据库的逻辑备份工具”,在日常操作中,相信很多人在怎么使用Oracle数据库的逻辑备份工具问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”...
    99+
    2024-04-02
  • Python中的axis参数的具体使用
    目录一、axis简介二、不一样的axis对于axis=0三、总结补充:python中某些函数axis参数的理解 在我们使用Python中的Numpy和Pandas进行数据分析的时候,...
    99+
    2024-04-02
  • oracle数据库的impdp,expdp有什么作用
    本篇内容介绍了“oracle数据库的impdp,expdp有什么作用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学...
    99+
    2024-04-02
  • vue路由$router.push()使用query传参的实际开发使用
    目录前言一、vue-router是什么?二、router.push()方法三、vue-router传递的参数四.实际开发使用1.query传参使用案例(数据传递)2.读入数据补充:t...
    99+
    2022-11-16
    vue路由$router.push() vue 获取query传过来的参数 vue router query传参
  • 如何使用yum源安装oracle 11g数据库
    这篇文章主要介绍了如何使用yum源安装oracle 11g数据库,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。***************...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作