ITPub博客

首页 > 数据库 > Oracle > Remap_table、remap_tablespace、tables在impdp关于只导特定表的注意事项

Remap_table、remap_tablespace、tables在impdp关于只导特定表的注意事项

原创 Oracle 作者:lusklusklusk 时间:2015-12-30 11:34:33 0 删除 编辑

remap_table、remap_tablespace多组对象转换的话,每组对象之间用逗号隔开

tables多张表时,每张表之间用逗号隔开

 

Remap_tablespace如果需要转换多个表空间,如A1转换成B1,A2转换成B1,有如下两种方式

remap_tablespace=A1:B1 remap_tablespace=A2:B1

remap_tablespace= A1:B1, A2:B1

 

Remap_table如果需要转换多个表名

同一个schema的情况下,如A1转换成B1,A2转换成B1,有如下两种方式

remap_table=A1:B1 remap_table=A2:B1

remap_table= A1:B1, A2:B1

 

 

impdp关于tables和remap_tables的一些注意事项

1.       expdp时写上tables=(表)表示导出某些表;impdp时不写tables条件表示导入dumpfile中的所有表,impdp时写tables=(表)条件表示只导入指定的表,当然如果tables=(dumpfile中的所有表)也就是导入dumpfile中的所有表;且如果用system执行impdp时则tables=(表)时必须加上schema.表名,否则会默认是为system下面的表,会导致报错

 

2.       remap_table如果在同一个schema下进行,虽然不要加remap_schema,但是remap_table冒号前面的表名一定要带schema信息,冒号后面的表名一定不能带schema信息

 

3.       remap_table如果在不同schema的情况下进行,如user1.A1转换成user2.B1,user1.A2转换成user2.B1,必须加remap_schema,且remap_table冒号前面的表名一定要带schema信息,冒号后面的表名一定不能带schema信息

有如下两种方式

remap_table= user1.A1:B1 remap_table= user1.A2:B1 remap_schema= user1: user2

remap_table= user1. A1:B1, user1.A2:B1 remap_schema= user1: user2

 

 

跨schema只导出导入表并重命名的标准方式如下

expdp时tables写上schema.表名并用逗号隔开

impdp时需要remap_schema, tables可写可不写,remap_table冒号前面的表名加上schema,冒号后面的表名不加schema

expdp system/123456 tables=t01.test101,t01.test102,t01.test103 directory=DATA_PUMP_DIR dumpfile=t011.dbf

 

impdp system/123456 remap_schema=t01:t_101 tables=t01.test101,t01.test102,t01.test103  remap_table=t01.test101:test10101,t01.test102:test102,t01.test103:test103 directory=DATA_PUMP_DIR dumpfile=t011.dbf


一个案例
A服务器导出用户ESB的一张分区表ESB_LOG
expdp system/123456 directory=DATA_PUMP_DIR dumpfile=ESB_LOG.dmp logfile=ESB_LOG.log tables=ESB.ESB_LOG

导入到B服务器的part用户,变成ESB_LOG(没有加tables=ESB.ESB_LOG,其实加不加无所谓,反正ESB_LOG.dm就是只有一张表ESB.ESB_LOG)
impdp system/123456 directory=DATA_PUMP_DIR dumpfile=ESB_LOG.dmp logfile=ESB_LOG.log remap_schema=ESB:part remap_tablespace=ESB07:part,ESB08:part,ESB09:part,ESB10:part,ESB11:part,ESB12:part,ESB:part

导入到B服务器的part用户,表名改为ESB_LOG2(加了tables=ESB.ESB_LOG,其实加不加无所谓,反正ESB_LOG.dm就是只有一张表ESB.ESB_LOG)
impdp system/123456 directory=DATA_PUMP_DIR dumpfile=ESB_LOG.dmp logfile=ESB_LOG2.log tables=ESB.ESB_LOGremap_schema=ESB:part remap_tablespace=ESB07:part,ESB08:part,ESB09:part,ESB10:part,ESB11:part,ESB12:part,ESB:part remap_table=ESB.ESB_LOG:ESB_LOG2

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30126024/viewspace-1967693/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Welcome to Lukes DB HOME。 Oracle OCM、Mysql OCP, 10年DBA工作经验,博客仅记录自己的一个学习过程,不代表完全准确,如有需要,欢迎转载。

注册时间:2015-02-02

  • 博文量
    348
  • 访问量
    1174932