oracle的expdpde query参数可以只将满足where条件的数据导出,有两种方式实现query的用法,下面逐一介绍。
(1)expdp后直接接query参数,需要注意query后面的转义字符
expdp \'sys/5\!Mon0em\? as sysdba\' directory=BI_DIR dumpfile=BI_DIR.dmp tables=SCOTT.ORACLE_TEST query=SCOTT.ORACLE_TEST:\"WHERE pub_date\>to_date\(\'2019-08-23 00:00:00\',\'yyyy-mm-dd hh24:mi:ss\'\)\" logfile=BI_DIR.log
(2)使用参数文件
more test.par
DUMPFILE=test.dmp
DIRECTORY=BI_DIR
TABLES=
(
SCOTT.dy_total_users,
SCOTT.dy_recharge_dist ,
SCOTT.dy_region_analysis_dd,
SCOTT.dy_return_analysis_dd,
SCOTT.dy_return_level_analysis_dd
)
QUERY=
(
SCOTT.dy_total_users:"where stat_date>to_date('2019-08-23 00:00:00','yyyy-mm-dd hh24:mi:ss')",
SCOTT.dy_recharge_dist:"where stat_date>to_date('2019-08-23 00:00:00','yyyy-mm-dd hh24:mi:ss')",
SCOTT.dy_region_analysis_dd:"where stat_time>to_date('2019-08-23 00:00:00','yyyy-mm-dd hh24:mi:ss')",
SCOTT.dy_return_analysis_dd:"where stat_time>to_date('2019-08-23 00:00:00','yyyy-mm-dd hh24:mi:ss')",
SCOTT.dy_return_level_analysis_dd:"where stat_time>to_date('2019-08-23 00:00:00','yyyy-mm-dd hh24:mi:ss')"
)
导出命令;
expdp \'sys/5\!Mon0em\? as sysdba\' parfile=test.par