Oracle Transportable Tablespaces (TTS)

來源:互聯網
上載者:User

主要講一下關於Oracle線上傳輸資料表空間的一些注意事項,文中附有樣本。 

原理分析

使用copy 資料檔案+匯入metadata的方式遷移資料 

可以實現跨平台傳輸資料表空間

COLUMNPLATFORM_NAME FORMAT A36
SELECT * FROM V$TRANSPORTABLE_PLATFORM ORDER BY PLATFORM_NAME; 

如果發現源、目標資料庫的endian不相同,需要使用rman convert 轉換,否則不需要 

限制

源、目標資料庫必須擁有相容的字元集。

字元集相同

來源資料庫的字元集必須是目標資料庫的子集。(下面必須全部滿足)

(1) 來源資料庫版本必須大於10.1.0.3

(2) 表中的列不包含semantics的定義資訊,最大字元長度限制和目標資料庫相同。

(3) 不包含clob資料類型,或者兩個資料庫的字元集同為single-byte orboth multibyte. 

兩個資料庫必須擁有相容的國家字元集

必須滿足下面其中之一

(1)國家字元集相同

(2)source databaseis in version 10.1.0.3 or higher,並且沒有NCHAR, NVARCHAR2, or NCLOB類型的資料 

目標資料庫中不能有相同名稱的資料表空間。(傳輸之前rename一下) 

底層依賴的對象必須全部包含在資料表空間集合中。 

使用情境

1.tablespace+partition 

2. 備份資料到cd中

3. 拷貝唯讀表可能關鍵到多個資料庫

4. 歸檔曆史資料

5. 執行spitr 基於時間點的資料表空間恢複 

線上傳輸資料表空間的工作流程(processes) 

1. 檢查endian format,查看是否需要使用rman convert 轉化endian(如果是相同平台可以忽略這一步)。 

2. 選擇一個自包含的資料表空間集合。 

3. 在源庫端,將資料表空間置為read only模式,並且產生可傳輸的資料表空間集合。(export metadatawith transportable tablespace) 

4. 傳輸資料表空間集合(使用scp或者其他的傳輸方式將expdp匯出的中繼資料以及資料檔案發送到目標伺服器上) 

5.恢複資料表空間為read write模式(可選)

6.在目標端,匯入資料表空間結合(import metadata) 

樣本一 1、查看目標和源端的endian是否相同 

test@ORCL>

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 x8664-bit Little

test@ORCL>

SELECT * FROM V$TRANSPORTABLE_PLATFORM ORDER BYPLATFORM_NAME;

PLATFORM_IDPLATFORM_NAME ENDIAN_FORMAT
------------------------------------------------------------------------------------------------------------------------------
6 AIX-Based Systems(64-bit) Big
16 Apple MacOS Big
19 HP IA OpenVMS Little
15 HP OpenVMS Little
5 HP Tru64UNIX Little
3 HP-UX (64-bit) Big
4 HP-UX IA(64-bit) Big
18 IBM Power BasedLinux Big
9 IBM zSeries BasedLinux Big
10 Linux IA(32-bit) Little
11 Linux IA(64-bit) Little
13 Linux x8664-bit Little
7 Microsoft Windows IA(32-bit) Little
8 Microsoft Windows IA(64-bit) Little
12 Microsoft Windows x8664-bit Little
17 Solaris Operating System(x86) Little
20 Solaris Operating System(x86-64) Little
1 Solaris[tm] OE(32-bit) Big
2 Solaris[tm] OE(64-bit) Big

19 rows selected.

這裡都是用Linux x86 64-bit 都是little endian 所以不需要使用rman convert 轉換

(記得轉換前先設定 資料表空間 read only 狀態,保證資料檔案在一個一致性的狀態) 

2、選擇自包含的資料表空間 

test@ORCL>

select t.name , d.name from v$tablespace t,v$datafile d where t.ts#=d.ts# ;

NAME NAME
------------------------------------------------------------------------------------------------------------------------
SYSTEM /u01/apps/oracle/oradata/orcl/system01.dbf
UNDOTBS1 /u01/apps/oracle/oradata/orcl/undotbs01.dbf
SYSAUX /u01/apps/oracle/oradata/orcl/sysaux01.dbf
USERS /u01/apps/oracle/oradata/orcl/users01.dbf
EXAMPLE /u01/apps/oracle/oradata/orcl/example01.dbf
IOTTBS /u01/apps/oracle/oradata/orcl/iottbs01.dbf
IOTEXTBS /u01/apps/oracle/oradata/orcl/iotextbs01.dbf
UNDOTBS1 /u01/apps/oracle/oradata/orcl/undotbs02.dbf
DEXTBS /u01/apps/oracle/oradata/orcl/dextbs01.dbf
SQLTDBS /u01/apps/oracle/oradata/orcl/sqlttbs01.dbf

10 rows selected. 

傳輸iotextbs 資料表空間對應資料檔案

/u01/apps/oracle/oradata/orcl/iotextbs01.dbf 

如果沒有輸出,表示是自包含的資料表空間 

sys@ORCL> EXECUTEDBMS_TTS.TRANSPORT_SET_CHECK('iotextbs',true) ;

PL/SQL procedure successfully completed.

sys@ORCL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;

no rows selected

  • 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.