关于expdp 中query用法小结
发表于:2024-09-26 作者:千家信息网编辑
千家信息网最后更新 2024年09月26日,今天看到群里有人问到关于在使用expdp导出数据中使用query参数报错的解决方法,自己也出于好奇心瞎折腾了一把,现记录如下1.第一次尝试的时候[oracle@DB ~]$ expdp scott/s
千家信息网最后更新 2024年09月26日关于expdp 中query用法小结
今天看到群里有人问到关于在使用expdp导出数据中使用query参数报错的解决方法,自己也出于好奇心瞎折腾了一把,现记录如下
1.第一次尝试的时候
[oracle@DB ~]$ expdp scott/scott tables=emp1 dumpfile=emp1.dmp logfile=emp1.log query=emp1:"where rownum < 5" Export: Release 11.2.0.4.0 - Production on 星期日 6月 18 01:06:05 2017 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 ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsORA-39001: 参数值无效ORA-39035: 已经指定了数据过滤器 SUBQUERY。
ORA-39001: 参数值无效ORA-39035: 已经指定了数据过滤器 SUBQUERY。
上述错误说明query语法写的有问题
正确写法要用\转义引号
于是再次编写了一下,执行,OK!
[oracle@DB ~]$ expdp scott/scott tables=emp1 dumpfile=emp1.dmp logfile=emp1.log query=\"where rownum \< 5\" Export: Release 11.2.0.4.0 - Production on 星期日 6月 18 01:18:52 2017 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 ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options启动 "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** tables=emp1 dumpfile=emp1.dmp logfile=emp1.log query="where rownum < 5" 正在使用 BLOCKS 方法进行估计...处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA使用 BLOCKS 方法的总估计: 64 KB处理对象类型 TABLE_EXPORT/TABLE/TABLE. . 导出了 "SCOTT"."EMP1" 8.179 KB 4 行已成功加载/卸载了主表 "SCOTT"."SYS_EXPORT_TABLE_01" ******************************************************************************SCOTT.SYS_EXPORT_TABLE_01 的转储文件集为: /u01/app/oracle/admin/orcl/dpdump/emp1.dmp作业 "SCOTT"."SYS_EXPORT_TABLE_01" 已于 星期日 6月 18 01:19:03 2017 elapsed 0 00:00:10 成功完成
通过上面截图可以看到:1中双引号和小于号前面都要加上反斜线\转义,在实际oracle中会把这些反斜线去掉来执行,注意观察2处。
当然结果是OK的,把原表备份一下然后删除,导入验证一下,如下:
2.答主突发奇想又测试了一种情况,就是当query条件中有大于号的情况。如下:
[oracle@DB ~]$ expdp scott/scott tables=emp1 dumpfile=emp1_2.dmp logfile=emp1.log query=\"where hiredate > to_date\(\'1982/01/02\',\'yyyy/mm/dd\'\)\"-bash: to_date('1982/01/02','yyyy/mm/dd')": No such file or directory
看到结果没,如果条件中有大于号而又没有加反斜线,系统把这种大于号默认是重定义符号。如下所示这种:
更改一下,再次执行,就OK了。童鞋们请重点观察下图中标注的1、2处。
[oracle@DB ~]$ expdp scott/scott tables=emp1 dumpfile=emp1_2.dmp logfile=emp1.log query=\"where hiredate \> to_date\(\'1982/01/02\',\'yyyy/mm/dd\'\)\" Export: Release 11.2.0.4.0 - Production on 星期日 6月 18 01:59:56 2017 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 ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options启动 "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** tables=emp1 dumpfile=emp1_2.dmp logfile=emp1.log query="where hiredate > to_date('1982/01/02','yyyy/mm/dd')" 正在使用 BLOCKS 方法进行估计...处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA使用 BLOCKS 方法的总估计: 64 KB处理对象类型 TABLE_EXPORT/TABLE/TABLE. . 导出了 "SCOTT"."EMP1" 8.125 KB 3 行已成功加载/卸载了主表 "SCOTT"."SYS_EXPORT_TABLE_01" ******************************************************************************SCOTT.SYS_EXPORT_TABLE_01 的转储文件集为: /u01/app/oracle/admin/orcl/dpdump/emp1_2.dmp作业 "SCOTT"."SYS_EXPORT_TABLE_01" 已于 星期日 6月 18 02:00:01 2017 elapsed 0 00:00:04 成功完成
3.如果有童鞋想一下子导出多张表时,需如下定义:
expdp scott/scott tables=emp1,emp2 dumpfile=emp.dmp logfile=emp1.log query=emp1:\"where rownum<5\",emp2:\"where rownum<5\"
方法
星期
成功
对象
类型
处理
参数
数据
斜线
再次
引号
情况
文件
条件
正在
童鞋
结果
转义
过滤器
作业
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
大华服务器型号e28s
关于网络安全教育的节目
数据库大概有哪些内容
大芒果单机数据库怎么打开
网络安全行业内部的联系
国家部门管理网络安全
陷门是否属于网络安全漏洞
常山软件开发项目管理
网络安全专业对数理化和英语要求
软件开发费是否包含维护费
web服务器制作数据库
在日本怎么打车软件开发
腾讯云服务器能做游戏服务器吗
网络安全哪个基金
5G产品软件开发
无线网络技术随机时延
天津精英网络技术咨询联系人
低电压cpu 软件开发
福建软件开发费用明细
工作中遇到哪些数据库故障的例子
网络安全的呼吁
描述文件无法安装连接不到服务器
怎么ip服务器连接数据库
浙江融合网络技术
河北泰始达互联网科技
5G产品软件开发
伤害世界服务器架设视频
湖南gps同步数显钟服务器
福建软件开发费用明细
数据库变更兼容老数据