傳輸表空間(從Linux到Windows)

hooca發表於2015-01-29
DB:11.2.0.4
OS:Oracle Linux 5.8 -> Windows Server 2003 (64bit)

參考文件:243304.1

整理步驟(2016/2/16)

Source
Destination
1 依賴性檢查

2 表空間只讀

3 expdp

4 convert tablespace … to

5 將上2步生成的檔案複製到Dest

6
convert datafile … from … to
7
impdp
8 表空間可寫(可選)





源端:

1. 檢查表空間依賴關係

點選(此處)摺疊或開啟

  1. execute sys.dbms_tts.transport_set_check('soe', true);
  2. select * from sys.transport_set_violations;

2. 設定表空間為只讀

點選(此處)摺疊或開啟

  1. alter tablespace SOE read only;
3. 用expdp匯出表空間後設資料(注意,反斜槓“\”一定要保留)

點選(此處)摺疊或開啟

  1. [oracle@oltp ~]$ expdp \"/ as sysdba\" dumpfile=tts1_dp.dmp logfile=tts.log transport_tablespaces=soe transport_full_check=y

  2. Export: Release 11.2.0.4.0 - Production on Thu Jan 29 15:47:25 2015

  3. Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

  4. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  5. With the Partitioning, Oracle Label Security, OLAP, Data Mining,
  6. Oracle Database Vault and Real Application Testing options
  7. Starting \"SYS\".\"SYS_EXPORT_TRANSPORTABLE_01\": \"/******** AS SYSDBA\" dumpfile=tts1_dp.dmp logfile=tts.log transport_tablespaces=soe transport_full_check=y
  8. Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
  9. Processing object type TRANSPORTABLE_EXPORT/TABLE
  10. Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
  11. Processing object type TRANSPORTABLE_EXPORT/INDEX/FUNCTIONAL_INDEX/INDEX
  12. Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
  13. Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
  14. Processing object type TRANSPORTABLE_EXPORT/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS
  15. Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
  16. Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
  17. Processing object type TRANSPORTABLE_EXPORT/USER_PREF_STATISTICS
  18. Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
  19. Master table \"SYS\".\"SYS_EXPORT_TRANSPORTABLE_01\" successfully loaded/unloaded
  20. ******************************************************************************
  21. Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
  22.   /u01/app/oracle/admin/oltp/dpdump/tts1_dp.dmp
  23. ******************************************************************************
  24. Datafiles required for transportable tablespace SOE:
  25.   /oradata/OLTP/datafile/o1_mf_soe_bdgpq551_.dbf
  26. Job \"SYS\".\"SYS_EXPORT_TRANSPORTABLE_01\" successfully completed at Thu Jan 29 15:48:09 2015 elapsed 0 00:00:39
到指定路徑找到匯出的檔案,和表空間資料檔案一道傳到目標伺服器上。

4. 在目標伺服器上,將匯出檔案tts1_dp.dmp放到一個資料夾(例如:E:\trans)下,併為之在資料庫建立direcotory物件

點選(此處)摺疊或開啟

  1. CREATE DIRECTORY tts_imp AS 'E:\trans';
5.在目標伺服器上,將表空間資料檔案o1_mf_soe_bdgpq551_.dbf放到資料檔案目錄E:\oradata\olap\DATAFILE

6. 匯入表空間(注意,表空間物件的owner必須已經提前建立,並賦予許可權!)

點選(此處)摺疊或開啟

  1. impdp \"/ as sysdba\" directory=tts_imp dumpfile=tts_sh_dp.dmp logfile=tts_sh.log transport_datafiles='E:\oradata\olap\DATAFILE\o1_mf_sh_bdoyy7os_.dbf'


7. 如有必要,設定相關使用者的預設表空間。

點選(此處)摺疊或開啟

  1. alter user soe default tablespace soe;
8. 將表空間設定為線上,當前應該是read only;(包括源資料庫的表空間)

點選(此處)摺疊或開啟

  1. alter tablespace soe read write;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22621861/viewspace-1419810/,如需轉載,請註明出處,否則將追究法律責任。

相關文章