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

  • 相关阅读:
    Git 简要教程
    SDK更新失败问题解决
    常用安卓操作
    MongoDB本地安装与启用(windows 7/10)
    windows 快捷键收集
    windows 常用命令
    Lambda Expression Introduction
    对 load_breast_cancer 进行 SVM 分类
    Support Vector Machine
    使用 ID3 对 Titanic 进行决策树分类
  • 原文地址:https://www.cnblogs.com/Leo-Cjh/p/13398984.html
Copyright © 2020-2023  润新知