• 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"

  • 相关阅读:
    BZOJ3065(替罪羊树套线段树)
    BZOJ3052(树上带修莫队)
    BZOJ1095(动态点分治+堆)
    NOIWC颓废记
    BZOJ2125 最短路
    Simpson积分(BZOJ2178)
    BZOJ4555 [Tjoi2016&Heoi2016]求和
    NTT+多项式求逆+多项式开方(BZOJ3625)
    Miller-Rabin,Pollard-Rho(BZOJ3667)
    单纯形求解线性规划(BZOJ1061)
  • 原文地址:https://www.cnblogs.com/Leo-Cjh/p/13398984.html
Copyright © 2020-2023  润新知