impdp匯入時將指定表更名(Remap_table、remap_tablespace、tables在impdp關於只導特定表的注意事項 )

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.