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. Java实现 洛谷 P1028 数的计算

    import java.util.Scanner; import java.util.Arrays; public class Main { private static Scanner cin; p ...

  2. java实现第七届蓝桥杯方格填数

    方格填数 题目描述 如下的10个格子 +--+--+--+ | | | | +--+--+--+--+ | | | | | +--+--+--+--+ | | | | +--+--+--+ (如果显示 ...

  3. HashMap源码解析(java1.8.0)

    1.1 背景知识 1.1.1 红黑树 二叉查找树可能因为多次插入新节点导致失去平衡,使得查找效率低,查找的复杂度甚至可能会出现线性的,为了解决因为新节点的插入而导致查找树不平衡,此时就出现了红黑树. ...

  4. tensorflow2.0学习笔记第一章第三节

    1.3鸢尾花数据读入 # 从sklearn包datasets读入数据 from sklearn import datasets from pandas import DataFrame import ...

  5. Rust异步之Future

    对异步的学习,我们先从Future开始,学习异步的实现原理.等理解了异步是怎么实现的后,再学习Rust异步编程涉及的2个库(futures.tokio)的时候就容易理解多了. Future rust中 ...

  6. HashMap(一)之源码分析基本功

    1. 位运算 参考 java中位运算^,&,<<,>>,<<<,>>>总结 2. 关键字 transient 理解一下这个关键字,顺 ...

  7. router路由配置

    vue项目中router路由配置   介绍 路由:控制组件之间的跳转,不会实现请求.不用页面刷新,直接跳转-切换组件>>> 安装 本地环境安装路由插件vue-router:    c ...

  8. 关于宝塔面板ftp+sublime

    如果sublime通过ftp上传文件传不上去,我的问题在于应该把sftp-config.json中"remote_path": "/",设置成这样.一下午.哎呀 ...

  9. cnpm的安装(超级详细版)

    1. 安装node 打开黑窗口   安装node 网上教程很多,我就不加上了 2.node -v  查看node是否已安装 3.安装淘宝镜像 npm install -g cnpm -registry ...

  10. <WP8开发学习笔记>ApplicationBar(任务栏)的切换以及“黑条问题”

    ApplicationBar(以下简称AppBar)是WP应用相当常见的控件,也很方便.常见的做法是pivot或者panorama的页面切换的时候,AppBar跟随切换对应的按钮或者不显示按钮,如下图 ...