码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 数据泵备份 带过滤条件的 数据表

时间:2020-07-29 21:21:22      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:exp   success   ora   思路   dump   erro   ide   china   class   

需求: 备份一张表恢复至测试环境,但是得有过滤条件

思路:数据泵轻量级备份,query参数

expdp system@LEO directory=DATA_PUMP_DIR dumpfile=DJI_BLACKLIST_DETAIL.dmp logfile=DJI_BLACKLIST_DETAIL.log  tables=LEO.DJI_BLACKLIST_DETAIL query=‘LEO.DJI_BLACKLIST_DETAIL:" where upper(country_code) = ‘CHINA‘ and trim(dji_name) is not null and trim(dji_id_no) is not null"‘ 

 Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-31693: Table data object "LEO"."DJI_BLACKLIST_DETAIL" failed to load/unload and is being skipped due to error:
ORA-00904: "CHINA": invalid identifier
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

很明显,不太对劲,china 这个条件匹配不到,进行

‘ CHINA‘
"CHINA "
"‘ CHINA‘"
‘"CHINA "‘

 都试了一遍,不好使。

决定用 parifle 来解决这种问题

vi leo.par

query=‘LEO.DJI_BLACKLIST_DETAIL:" where upper(country_code) = ‘CHINA‘ and trim(dji_name) is not null and trim(dji_id_no) is not null"‘

expdp system@LEO directory=DATA_PUMP_DIR dumpfile=DJI_BLACKLIST_DETAIL.dmp logfile=DJI_BLACKLIST_DETAIL.log  tables=LEO.DJI_BLACKLIST_DETAIL parfile=leo.par

 LRM-00111: no closing quote for value ‘null"‘

LRM-00113: error when processing file ‘leo.par‘

淦!!!

 

解决:

去掉了leo.par中的表的单引号。

前:

query=‘LEO.DJI_BLACKLIST_DETAIL:" where upper(country_code) = ‘CHINA‘ and trim(dji_name) is not null and trim(dji_id_no) is not null"‘

后:

query=LEO.DJI_BLACKLIST_DETAIL:" where upper(country_code) = ‘CHINA‘ and trim(dji_name) is not null and trim(dji_id_no) is not null"

 

Oracle 数据泵备份 带过滤条件的 数据表

标签:exp   success   ora   思路   dump   erro   ide   china   class   

原文地址:https://www.cnblogs.com/Leo-Cjh/p/13398984.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!