No. 21525

10G: TRANSPORTABLE TABLESPACES ACROSS DIFFERENT PLATFORMS

=============================================================



Purpose
-------
이 자료에서는 서로 다른 Platform 으로 Tablespaces 를 transport 하는 방법에 대해
설명하고자 한다.



Explanation
-----------
10g 에서는 서로 다른 platform 으로 tablespace 를 transport 할 수 있으며
transport 가능한 platform 정보는 다음과 같다.


SQL> select * from v$transportable_platform;

PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ------------------------------ --------------
1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
7 Microsoft Windows NT Little
10 Linux IA (32-bit) Little
6 AIX-Based Systems (64-bit) Big
3 HP-UX (64-bit) Big
5 HP Tru64 UNIX Little
4 HP-UX IA (64-bit) Big
11 Linux IA (64-bit) Little
15 HP Open VMS Little
8 Microsoft Windows IA (64-bit) Little
9 IBM zSeries Based Linux Big
13 Linux 64-bit for AMD Little
16 Apple Mac OS Big
12 Microsoft Windows 64-bit for AMD Little


10g 이전 version 까지는 동일한 platform 에 대해서만 지원하였으며 10g 에서는
서로 다른 platform 에서도 tablespace 이동이 가능하도록 지원하고 있다.

Transportable Tablespaces 가 사용되어지는 사례는 다음과 같다.

1. 다른 platform 으로 database 를 migration 하고자 할때
2. 서로 다른 platform 의 DW 환경에서 Distribute data 를 data marts 로 이동을 원할 경우
3. Publish structured data 를 기존과 다른 platforms 으로 통합하고자 할 경우 등 입니다.

Transportable Tablespaces 를 위단 Step 은 다음과 같습니다.

1. Tablespace 를 READ ONLY 상태로 변경한다.

SQL> alter tablespace REPOSIT read only;
Tablespace altered.


2. Metadata 를 다음 과 같이 export 한다.

$ exp userid=\'/ as sysdba\' transport_tablespace=y
tablespaces=reposit
file=tts.dmp log=exp_tts.log
statistics=none

Export: Release 10.1.0.1.0 - Beta on Mon Nov 24 11:49:49 2003
...

Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace REPOSIT ...
. exporting cluster definitions
. exporting table definitions
. . exporting table MTG_COL_DEP_CHG
. . exporting table MTG_DATABASES
....
. . exporting table SYBASE11_SYSUSERS
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.


3. 이동하고자 하는 target database platform 의 ENDIAN_FORMAT 정보를 확인한다.
Case 1 의 경우는 query 결과 ENDIAN_FORMAT 이 같은 상태로 conversion 필요 없이
Tablespaces 이동이 가능하고 Case 2 의 경우에는 ENDIAN_FORMAT 이 다른 경우로
ENDIAN_FORMAT conversion 을 위해 RMAN 을 이용하여 아래와 같이 추가적인 작업이 필요하다.

Case 1
------
The source platform is Sun SPARC Solaris: endianness Big
The target platform is HP-UX (64-bit): endianness Big

SQL> select PLATFORM_ID , PLATFORM_NAME from v$database;

PLATFORM_ID PLATFORM_NAME
----------- ------------------------------
3 HP-UX (64-bit)


No conversion needed.


Case 2
------
The source platform is Microsoft WIndows NT: endianness Little
The target platform is HP-UX (64-bit): endianness Big

다음과 같이 endian format 이 다른 상태에서 작업시 다음과 같이 에러가 발생한다.

. importing SYS's objects into SYS
IMP-00017: following statement failed with ORACLE error 1565:
"BEGIN sys.dbms_plugts.beginImpTablespace('TBS_TTS',37,'SYS',1,0,8192,2,57"
"54175,1,2147483645,8,128,8,0,1,0,8,462754339,1,1,5754124,NULL,0,0,NULL,NULL"
"); END;"
IMP-00003: ORACLE error 1565 encountered
ORA-01565: error in identifying file '/database/db101b2/V101B2/datafile/reposit01.dbf'
ORA-27047: unable to read the header block of file
HP-UX Error: 2: No such file or directory
Additional information: 2
ORA-06512: at "SYS.DBMS_PLUGTS", line 1540
ORA-06512: at line 1
IMP-00000: Import terminated unsuccessfully

결국, Tablespace import 를 하기전에 RMAN 을 통해 files convert 작업이 필요하다.

$ rman target=/

Recovery Manager: Release 10.1.0.1.0 - 64bit Beta
connected to target database: V101B2 (DBID=3287908659)

RMAN> convert tablespace 'REPOSIT'
2> to platform="Linux IA (32-bit)"
3> db_file_name_convert='/database/db101b2/V101B2/datafile/reposit01.dbf',
4> '/tmp/reposit01.dbf';

Starting backup at 24-NOV-03
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=8 devtype=DISK
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00006 name=/database/db101b2/V101B2/datafile/reposit01.dbf
converted datafile=/tmp/reposit01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished backup at 24-NOV-03

Convert 된 files 은 /tmp 디렉토리에 존재하게 되고 이를 target server 에 copy 한다.


4. Datafile 과 export dump file 을 ftp 를 이용하여 move 한다.

$ftp tts.dmp
+
/database/db101b2/V101B2/datafile/reposit01.dbf (no conversion)
or
/tmp/reposit01.dbf (converted file if conversion had been required)


5. Metadata 를 import 한다.

$ imp userid=\'/ as sysdba\' TRANSPORT_TABLESPACE=Y
datafiles=/database/db101b2/V101B2/datafile/reposit01.dbf
(or /tmp/reposit01.dbf )
file=tts.dmp log=imp_tts.log

Import: Release 10.1.0.1.0 - Beta on Mon Nov 24 03:37:20 2003

Export file created by EXPORT:V10.01.00 via conventional path
About to import transportable tablespace(s) metadata...
...
. importing SYS's objects into SYS
. importing OMWB's objects into OMWB
. . importing table "MTG_COL_DEP_CHG"
...
. . importing table "SYBASE11_SYSUSERS"
Import terminated successfully without warnings.


6. Import 가 성공적으로 끝나면 tablespace 를 READ WRITE 상태로 변경한다.

SQL> alter tablespace reposit read write;
Tablespace altered.



Example
-------
none

2009/03/19 14:43 2009/03/19 14:43

트랙백 주소 :: http://thinkit.or.kr/database/trackback/963