Oracle expdp导出分区表,query条件带有rownum

前言

在做数据脱敏的时候,对一张刚好是分区表的表做导出,为了只取出部分数据看是否数据可以正常脱敏,在query中带上rownum。

结果发现是每个分区都取出了rownum的限定行数。

比如:rownum<=5,正常去查询表的话是只会有5行的结果,

但是expdp导出分区表,带rownum<=5,则是每个分区都取出符合条件的5行。

这应该算BUG吧?

环境模拟

构造分区表

create table scott.t_partition_range (id number)
partition by range(id)(
partition p1 values less than (10),
partition p2 values less than (20),
partition p3 values less than (30),
partition pmax values less than (maxvalue)
);

模板复制

SYS@zkm> create table scott.t_partition_range (id number)
2 partition by range(id)(
3 partition p1 values less than (10),
4 partition p2 values less than (20),
5 partition p3 values less than (30),
6 partition pmax values less than (maxvalue)
7 ); Table created.

插入数据

begin
for i in 1..50 loop
insert into scott.t_partition_range values(i);
end loop;
commit;
end;
/

模板复制

SYS@zkm> begin
2 for i in 1..50 loop
3 insert into scott.t_partition_range values(i);
4 end loop;
5 commit;
6 end;
7 / PL/SQL procedure successfully completed.

查询数据示例

SYS@zkm> select * from scott.t_partition_range partition(p1);

        ID
----------
1
2
3
4
5
6
7
8
9 9 rows selected. SYS@zkm> select * from scott.t_partition_range partition(p2); ID
----------
10
11
12
13
14
15
16
17
18
19 10 rows selected. SYS@zkm> select * from scott.t_partition_range partition(pmax); ID
----------
30
31
32
33
34
35
36
37
38
39
40 ID
----------
41
42
43
44
45
46
47
48
49
50 21 rows selected. SYS@zkm> select * from scott.t_partition_range where rownum<=5; ID
----------
1
2
3
4
5

数据泵导出

[oracle@oracle ~]$ expdp \' / as sysdba \' directory=dir dumpfile=test.dmp logfile=test.log reuse_dumpfiles=y cluster=n tables=scott.t_partition_range query=scott.t_partition_range:\"where rownum\<=5\" 

Export: Release 11.2.0.4. - Production on Thu May  :: 

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4. - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLE_01": "/******** AS SYSDBA" directory=dir dumpfile=test.dmp logfile=test.log reuse_dumpfiles=y cluster=n tables=scott.t_partition_range query=scott.t_partition_range:"where rownum<=5"
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: MB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "SCOTT"."T_PARTITION_RANGE":"P1" 5.046 KB rows
. . exported "SCOTT"."T_PARTITION_RANGE":"P2" 5.046 KB rows
. . exported "SCOTT"."T_PARTITION_RANGE":"P3" 5.046 KB rows
. . exported "SCOTT"."T_PARTITION_RANGE":"PMAX" 5.046 KB rows
Master table "SYS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TABLE_01 is:
/home/oracle/test.dmp
Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at Thu May :: elapsed ::

可以看出,每个区分都导出了5行。

这...应该是BUG吧?

Oracle expdp导出分区表,query条件带有rownum的更多相关文章

  1. Oracle EXPDP导出数据

    Oracle expdp导出表数据(带条件): expdp student/123456@orcl dumpfile=student_1.dmp logfile=student_1.log table ...

  2. oracle expdp导出时报 ora-39070:无法打开日志文件

    在通过expdp导出命令导出某个用户的对象时出现以下截图错误: ORA-39002:操作无效 ORA-39070:无法打开日志文件 ORA-39087:目录名<directory>无效 该 ...

  3. oracle expdp导出远程数据到本地

    1.本地数据库新建一个用户test,并授予以下基本权限(尽量不要多授权,如本地权限大于远程,会导致导出失败,郁闷!): grant connect to test;grant resource to ...

  4. oracle exp导出加上过滤条件

    exp username/password@dbname   file='d:\hehe.dmp' tables=(%) query="""where UPDATE_DT ...

  5. Oracle expdp导出多表或表中的部分数据

    http://blog.itpub.net/16582684/viewspace-755072/

  6. oracle EXP导出一张表时使用query参数指定where条件

    oracle exp 导出一个表的部分内容,使用query参数可加上SQL的where条件进行过滤 注意:如果需要使用到日期字符串格式等单引号,需要使用双引号将where条件括起来,而且双引号要用\做 ...

  7. Oracle expdp/impdp导出导入命令及数据库备份

    使用EXPDP和IMPDP时应该注意的事项: EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用. EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用, ...

  8. Oracle expdp/impdp导出导入命令及数据库备份(转)

    使用EXPDP和IMPDP时应该注意的事项: EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用. EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用, ...

  9. oracle expdp impdp 导入导出备份

    数据库导入导出: 使用EXPDP和IMPDP时应该注意的事项: EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用. EXPDP和IMPDP是服务端的工具程序,他们只能在ORA ...

随机推荐

  1. 【Mysql】使用一条sql查询出库表结构信息

    1.新建查询 将以下脚本粘贴进去 脚本如下: SELECT TABLE_SCHEMA 库名, TABLE_NAME 表名, COLUMN_NAME 列名, COLUMN_TYPE 数据类型, DATA ...

  2. 【Spring注解驱动开发】组件注册-@ComponentScan-自动扫描组件&指定扫描规则

    写在前面 在实际项目中,我们更多的是使用Spring的包扫描功能对项目中的包进行扫描,凡是在指定的包或子包中的类上标注了@Repository.@Service.@Controller.@Compon ...

  3. iOS-NSString常见方法

    </pre><pre name="code" class="html">#import <Foundation/Foundatio ...

  4. 关于"touchstart与click同时触发"问题

    点击事件可以分解成多个事件: 在移动端,手指点击一个元素,会经过:touchstart --> touchmove -> touchend -->  click 由于移动设备能够同时 ...

  5. @loj - 2106@ 「JLOI2015」有意义的字符串

    目录 @description@ @solution@ @accepted code@ @details@ @description@ B 君有两个好朋友,他们叫宁宁和冉冉.有一天,冉冉遇到了一个有趣 ...

  6. Ubuntu18.04 安装QQ、Tim、微信与win无差异

    一.安装deepin-wine环境: 桌面下打开终端,依次输入以下命令 git clone https://gitee.com/wszqkzqk/deepin-wine-for-ubuntu.git ...

  7. Chosen by god【组合数打表】

    Chosen by god 题目链接(点击) Everyone knows there is a computer game names "hearth stone", recen ...

  8. Brainman(规律题)【数学思想】

    Brainman 题目链接(点击) Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 12942   Accepted: 650 ...

  9. 安装Zabbix5.0

    目录 概述 支持的平台 安全相关 支持TimescaleDB agent升级 垂直菜单 部署 安装要求 数据库要求 前端要求 服务端要求 Agent 2 Java gateway 安装 配置镜像源 安 ...

  10. windows下Python版本切换使用方法

    由于历史原因,Python有两个大的版本分支,Python2和Python3,又由于一些库只支持某个版本分支,所以需要在电脑上同时安装Python2和Python3,因此如何让两个版本的Python兼 ...