expdp/impdp导入导出测试

    第一阶段测试。目标:只导入数据,不包含表结构、索引等

expdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=exptest.log 

exclude=sequence,index,function,procedure tables=t1,t2;

impdp ttt/ttt@sidb directory=test dumpfile=test.dmp logfile=imptest.log table_exists_action=append 

tables=t1,t2;

首次导入,由于用户不同,报错ORA-39154。因此增加参数 remap_schema

impdp ttt/ttt@sidb directory=test dumpfile=test.dmp logfile=imptest.log table_exists_action=append 

remap_schema=xxxx:ttt tables=t1,t2;

再次执行,仍报错。再次修改。

impdp ttt/ttt@sidb directory=test dumpfile=test.dmp logfile=imptest.log table_exists_action=append 

remimpdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log tables=xxxx.t1,xxxx.t2;

导入成功。

第二次传输数据,使用参数content。该参数有三个数值 all/data_only/metadata_only

分别表示:all:导出所有(默认);data_only:仅导出数据;metadata_only:仅导出表定义(包含表结构、索引、函数、序列等)

expdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log content=data_only tables=t1,t2;

impdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log tables=t1,t2;

此次是同库测试,使用相同的用户,导入成功。

第三次测试,增加query参数

expdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log content=data_only tables=t1,t2 

query="where id in (select id from test)";

impdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log tables=t1,t2;

完成。再次导入另一部分数据

expdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log content=data_only tables=t1,t2 

query="where id not in (select id from test)";

impdp xxxx/xxxx@sida directory=test dumpfile=test.dmp logfile=test.log tables=t1,t2;

此次并未使用table_exists_action来定义对已存在表的处理方式(该参数默认值为skip:跳过),但数据库中数据量全部导入,相当于此次数据为追加导入(table_exists_action:append)。

并未找到该状况出现原因,因此暂不做分析,在正式脚本里,我仍增加了table_exists_action:append,进行追加导入


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值