Thursday, August 27, 2009

Transportable tablespace export/Import on same endian platforms

Transportable tablespaces export is manageable across platforms and only Meta data will be exported. In Cross platform transportable tablespace the data movement is simpler and faster.

This mode requires that you have the EXP_FULL_DATABASE role.

Please note that
1. Source and target database must use the same character/national char set
2. You cannot transport a tablespace to a target database which already exists.
3. Transportable tablespace exports cannot be restarted once stopped
4. Target database must at same or higher release level as the source database.

For example, if you want to transport a tablespace “test_user_tbs” from a Linux 64 bit(Little endian) machine TESTLINUX to Microsoft Windows 64 bit (Little endian) machine TESTWIN. Both the source and target platforms are of LITTLE endian type. The data file for the tablespace “test_user_tbs” is “test_user_tbs01.dbff.

Follow the below steps

Step1: Find the Operating system byte order on Source and Target Database
SQL > select * from v$transportable_platform order by platform_id;
----------------- ----- -------------------------- ---------------------
1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
3 HP-UX (64-bit) Big
4 HP-UX IA (64-bit) Big
5 HP Tru64 UNIX Little
6 AIX-Based Systems (64-bit) Big
7 Microsoft Windows IA (32-bit) Little
8 Microsoft Windows IA (64-bit) Little
9 IBM zSeries Based Linux Big
10 Linux IA (32-bit) Little
11 Linux IA (64-bit) Little
12 Microsoft Windows 64-bit for AMD Little

Step 2: Make the tablespace “READ ONLY”
SQL> alter tablespace test_user_tbs read only;

Step3: Export metadata
(i) Using export utility
$ exp testuser/test123 tablespaces=test_user_tbs transport_tablespace=y file=exp_test_user_tbs.dmp log=exp_test_user_tbs.log

(ii) Using data pump export utility
$ expdp system/password transport_tablespaces=test_user_tbs transport_full_check=y directory=export_dir dumpfile=expdp_test_user_tbs.dmp logfile= expdp_test_user_tbs.log

TRANSPORT_FULL_CHECK= Y Specifies that check for dependencies between those objects inside the transportable Tablespace and those outside the transportable Tablespace.

The file “exp_test_user_tbs.dmp” or ““expdp_test_user_tbs.dmp” contains only metadata.

Step 4: Copy the files to Target system
If you are using FTP use binary option.

Step5: Run the below import command to plug the tablespace into the database.

Click here to see the Instructions to create Directory and grant privileges.

(i) Using import utility
$ imp test_user/test123 tablespaces=test_user_tbs transport_tablespace=y file=exp_test_user_tbs.dmp datafiles='test_user_tbs01.dbf' log=imp_test_user_tbs.log

(ii) Using data pump import utility
$ impdp test_user/test123 transport_datafiles='test_user_tbs01.dbf' directory=import_dir dumpfile=expdp_test_user_tbs.dmp log= impdp_test_user_tbs.

logYou can use REMAP_SCHEMA=(source:target), if you want to import into another schema.

Step7: Put the tablespace in read/write mode.

Now the database has a tablespace named “test_user_tbs” and the objects of the tablespace will be available.

Please see the Data pump Export/Import related documents:
Click here for Data Pump Export modes and Interfaces.
Click here for Data Pump Export/Import with Examples.
Click here for Transportable Tablespace across different endian Platforms.

Satishbabu Gunukula