Oracle傳輸資料表空間總結

來源:互聯網
上載者:User

0、準備工作
--建立被傳輸的資料表空間
SQL> create tablespace tbs_single
datafile 'c:\Oracle\oradata\ora9i\tbs_single01.dbf' size 100M
extent management local;
--建立使用者,並將資料表空間作為預設資料表空間
SQL> create user tranp identified by oracle default tablespace tbs_single;
SQL> grant connect,resource to tranp;
 --在該資料表空間建立表,用於測試
SQL> create table tranp.t01 as select * from sys.dba_objects;
1、檢查源、目標平台Endianness
在來源資料庫平台上:
SQL> SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
  2       FROM V$TRANSPORTABLE_PLATFORM. tp, V$DATABASE d
  3       WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
PLATFORM_NAME                          ENDIAN_FORMAT
------------------------------------   --------------
Microsoft Windows IA (32-bit)                 Little
 
在目標資料庫平台上:
SQL> SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
     FROM V$TRANSPORTABLE_PLATFORM. tp, V$DATABASE d
     WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
PLATFORM_NAME                          ENDIAN_FORMAT
------------------------------------                    --------------
Linux IA (32-bit)                         Little
由於源和目標平台的Endianness一致,可以省去convert這一步。
2、檢查要資料表空間是否自包含
SQL> EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('TBS_SINGLE',true);
PL/SQL 過程已成功完成。
SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;
未選定行
說明資料表空間是自包含的。
3、產生傳輸資料表空間集
建立目錄對象
SQL> create DIRECTORY tranp_dir as 'c:\software';
目錄已建立。
SQL> grant read,write on DIRECTORY tranp_dir to public;
授權成功。
將資料表空間置為唯讀。
SQL> alter tablespace tbs_single read only;
 資料表空間已更改。
使用資料泵匯出傳輸資料表空間的中繼資料


 
註:如果Endianness不一致,還需要使用RMAN進行轉換資料表空間的資料檔案。
4、傳送資料表空間集
將資料表空間的資料檔案和匯出的DMP檔案,傳送到目標資料庫平台上。
5、匯入資料表空間
在目標資料庫中,建立相應的目錄對象和使用者。
SQL> create directory tranp_dir as '/home/oracle';
Directory created.
 
SQL> grant read,write on directory tranp_dir to public;
Grant succeeded.
 
SQL> create user tranp identified by oracle;
User created.
 
SQL> grant connect,resource to tranp;
Grant succeeded.
使用資料庫泵,匯入到目標資料庫中。
[oracle@ocmu ~]$ impdp system/oracle dumpfile=TBSINGLE.DMP directory=tranp_dir transport_datafiles=/u01/app/oracle/oradata/PROD/TBS_SINGLE01.DBF remap_schema=tranp:tranp
 
Import: Release 10.2.0.1.0 - Production on Thursday, 30 August, 2012 23:40:25
 
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":  system/******** dumpfile=TBSINGLE.DMP directory=tranp_dir transport_datafiles=/u01/app/oracle/oradata/PROD/TBS_SINGLE01.DBF remap_schema=tranp:tranp
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 23:40:29
將被匯入的資料表空間置為read write。
SQL> alter tablespace TBS_SINGLE read write;
Tablespace altered.

  • 1
  • 2
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.