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实现 LeetCode 347 前 K 个高频元素

    347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素. 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输 ...

  2. java实现第五届蓝桥杯信号匹配

    信号匹配 从X星球接收了一个数字信号序列. 现有一个已知的样板序列.需要在信号序列中查找它首次出现的位置.这类似于串的匹配操作. 如果信号序列较长,样板序列中重复数字较多,就应当注意比较的策略了.可以 ...

  3. Linux目录结构与功能

    在Linux中,一切皆文件.所以,Linux和Windows目录有很大的不同,它没有明确的盘符,它的目录就像一棵大树一样,顶层目录就是根目录:/ ,然后下面又有很多个分支,分支可以再分,从而形成一个庞 ...

  4. git提交拉取远程仓库

    https://gitee.com/ ---- 国内服务器 https:/github.com/ ---- 国外服务器 git init  ---- 初始化(创建主分支)仓库 git clone 拉取 ...

  5. pip常出问题的操作

    pip 是一个 Python 包安装与管理工具. 以pip安装yaml为主: 1.更新pip 打开cmd命令,安装yaml包,输入pip install pyyaml,提示pip已过期 更新pip版本 ...

  6. profile(/etc/profile)和bash_profile的区别

    profile(/etc/profile)和bash_profile的区别 profile(/etc/profile),用于设置系统级的环境变量和启动程序,在这个文件下配置会对所有用户生效.当用户登录 ...

  7. apt用法详解

    目录 1. 常规操作 2. apt-cache 3. 配置apt-get的缓存路径 4. 常用工具集 4.1. 开发工具 4.2. 系统辅助 1. 常规操作 更新仓库 sudo apt-get upd ...

  8. (七)MySQL常见的数据类型、约束和标识列

    一.MySQL常见数据类型 1.数值型: ①整型:tinyint.smllint.mediumint.int/integer.bigint 图源:尚硅谷李玉婷 案例1:关键表格teacher,分别添加 ...

  9. PAT 1043 Is It a Binary Search Tree (25分) 由前序遍历得到二叉搜索树的后序遍历

    题目 A Binary Search Tree (BST) is recursively defined as a binary tree which has the following proper ...

  10. ca69a.cpp_c++_函数匹配(重载确定)

    /*ca69a.cpp_c++_函数匹配(重载确定)#重载确定的三个步骤1.候选函数2.选择可行函数3.寻找最佳匹配(如果有的话)#含有多个形参的重载确定 void f1();void f1(int) ...