Oracle 傳輸資料表空間遷移資料總結

來源:互聯網
上載者:User

Oracle 傳輸資料表空間遷移資料總結

注意:遷移資料表空間之前必需先建立相對應的使用者,要不然會遷移不成功的。

有時,我們需要把比較大的資料進行跨平台(10G支援跨平台)的遷移,使用EXP/IMP等方法很慢,可以通過傳輸資料表空間快速安全的實現。此操作需要在SYSDBA的許可權下進行,具體步驟如下:

1.檢查所要遷移的資料表空間是否自包含(就是檢測是否符合傳輸資料表空間的基本條件)
 exec sys.dbms_tts.transport_set_check('tablespace_name',true);
 select * from sys.transport_set_violations;
 如果無記錄返回,則說明符合傳輸資料表空間的條件,如果有記錄返回則不符合。

2.設定所要傳輸的資料表空間為唯讀
alter tablespace tablespace_name read only;

3.使用exp工具匯出所要傳輸資料表空間的中繼資料(metadata)
exp userid=\'sys/lclsys2008 as sysdba\' file=/opt/test.dmp log=/opt/test.log transport_tablespace=y tablespaces=tablespace_name
注意:這裡使用SYSDBA時需要逸出字元,在LINUX下用\',WINDOWS下使用單引號就可以

4.使用RMAN轉換所要傳輸的資料表空間的資料檔案頭為目標系統檔案
 登陸RMAN: rman target /
 rman>convert tablespace "TABLESPACE_NAME" to platform 'Linux IA (32-bit)' format 'D:\xxx.dbf'
 注意:TABLESPACE_NAME為傳輸資料表空間的名稱,需要使用雙引號且大寫,Linux IA (32-bit)為目標平台的名稱,可以在目標平台資料庫中通過select platform_name form v$database來查詢。

5.複製資料表空間轉換後的資料檔案及匯出檔案到目標平台

6.使用IMP工具載入資料庫檔案到目標平台

 imp userid=\'sys/ad as sysdba\' file=expdat.dmp transport_tablespace=y datafiles=('D:\xx.dbf') tablespaces=tablespace_name
 注意:在使用IMP和EXP時盡量使用相同的版本,以避免操作失敗。

補充一點,在piner的書提到,就是seq,function,proc,view等中繼資料並沒有遷移過來,需要再執行一次遷移。
就是執行一次exp ...  rows=n
再imp匯入才行。

  • 1
  • 2
  • 3
  • 4
  • 下一頁

相關文章

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.