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
<span "="" style="word-wrap: break-word; color: rgb(102, 102, 102); font-family: 宋體, Arial; font-size: 10.5pt;"> 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_LOG remap_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