Oracle 数据泵备份 带过滤条件的 数据表
作者:互联网
需求: 备份一张表恢复至测试环境,但是得有过滤条件
思路:数据泵轻量级备份,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"
标签:null,备份,DJI,DETAIL,BLACKLIST,数据表,CHINA,Oracle,LEO 来源: https://www.cnblogs.com/Leo-Cjh/p/13398984.html