zoukankan      html  css  js  c++  java
  • 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"

  • 相关阅读:
    操作系统路径.islink在使用python的windows上
    Python shutil模块zz
    CMake 两种变量原理 ZZ
    cmake语法-函数和宏的定义
    cmake函数、宏和模块
    cmake函数、宏和模块
    CMake 常用宏分享
    设定cmake输出目录
    android layerlist 里面的rotate标签得到三角形原理详解
    abp(net core)+easyui+efcore实现仓储管理系统——出库管理之三(五十一)
  • 原文地址:https://www.cnblogs.com/Leo-Cjh/p/13398984.html
Copyright © 2011-2022 走看看