You are on page 1of 14

Cross Platform Transportable Tablespaces Into ASM Storage

Alejandro Vargas Oracle Support Israel Principal Support Consultant

Description of the test ......................................................................................................................................................................... 2 The test environment .......................................................................................................................................................................... 2 List of Steps ........................................................................................................................................................................................ 2 Implementation step by step ............................................................................................................................................................... 3 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Check endianess on source and target servers....................................................................................................................... 3 Create reference data on the tablespace to be transported .................................................................................................... 5 Check that the tablespace is self contained............................................................................................................................. 8 Set the tablespaces to be transported read-only ..................................................................................................................... 8 Create a directory for data pump exporting the tablespace set metadata ............................................................................... 9 Export the tablespace set metadata ........................................................................................................................................ 9 Transfer the metadata export and tablespace set datafiles to the target server .................................................................... 10 Convert the transportable tablespace set on the target server .............................................................................................. 10 Create a data pump directory on the target server ................................................................................................................ 11 Import the metadata on the target database .......................................................................................................................... 12 Check the control data on the plugged tablespace ................................................................................................................ 13 Restrictions on convert tablespace and convert datafile........................................................................................................ 14

References ........................................................................................................................................................................................ 14 End of the Procedure ................................................................................................................................................................. 14

Description of the test


This test is intended to define the steps required to migrate a database from one endian platform to another and into ASM storage. Migration from one endian format to another does require using the 10g Cross Platform Transportable Tablespaces feature, XTTS. XTTS combined with Rmans convert command make possible the migration from one platform to the other and into ASM in a simple and efficient way. This document describes, step by step how to achieve this objective

The test environment


The source is a 10.2.0.3 Database based on a Solaris 5.8, 64 bit server; the target is a 10.2.0.3 Database based on Oracle Enterprise Linux 5, 32 bits, with 11g ASM Storage. This is a small database, in this test I would like only to show the concept and commands required to complete the task.

List of Steps
1. Check endianess on source and target servers 2. Create reference data on the Tablespaces to be transported 3. Check that the tablespace is self-contained 4. Set the Tablespaces to be transported read-only 5. Create a directory for data pump exporting the tablespace set metadata 6. Export the tablespace set metadata

7. Transfer the metadata export and tablespace set datafiles to the target server 8. Convert the transportable tablespace set on the target server 9. Create a data pump directory on the target server 10. Import the metadata on the target database 11. Check the control data on the plugged tablespace 12. Restrictions on convert tablespace and convert datafile

Implementation step by step


1. Check endianess on source and target servers
We need to check which is the endian format on the source and target servers to assure they are compatible. V$transportable_platform has the full list of convertible endian formats. Both the source and target must be contained on it to be able to transport the tablespace set. On the Source Server > uname -a SunOS srvdb 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-15000 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 ---------------------------------------- -------------Solaris[tm] OE (64-bit) Big On the Target Server > uname -a Linux pollux.com 2.6.18-8.el5xen #1 SMP Wed Jun 6 00:05:22 EDT 2007 i686 i686 i386 GNU/Linux 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

SQL> select platform_id, platform_name, endian_format from v$transportable_platform order by endian_format, platform_id;

PLATFORM_ID ----------1 2

PLATFORM_NAME ---------------------------------------Solaris[tm] OE (32-bit) Solaris[tm] OE (64-bit)

ENDIAN_FORMAT -------------Big Big <<<< Source

3 4 6 9 16 18 5 7 8 10 11 12 13 15 17 19 20

HP-UX (64-bit) HP-UX IA (64-bit) AIX-Based Systems (64-bit) IBM zSeries Based Linux Apple Mac OS IBM Power Based Linux HP Tru64 UNIX Microsoft Windows IA (32-bit) Microsoft Windows IA (64-bit) Linux IA (32-bit) Linux IA (64-bit) Microsoft Windows 64-bit for AMD Linux 64-bit for AMD HP Open VMS Solaris Operating System (x86) HP IA Open VMS Solaris Operating System (AMD64)

Big Big Big Big Big Big Little Little Little Little Little Little Little Little Little Little Little

<<<< Target

19 rows selected.

2. Create reference data on the tablespace to be transported


On this step we will create a set of reference data on the big endian database, we will use this set later to check the tablespace plugged on the target database. <oracle> /srvdb/app01/oracle/oradata/AVTST/datafile > sqlplus / as sysdba SQL*Plus: Release 10.2.0.3.0 - Production on Wed Dec 26 12:07:53 2007 Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 1610612736 bytes Fixed Size 2030456 bytes Variable Size 385877128 bytes Database Buffers 1207959552 bytes Redo Buffers 14745600 bytes Database mounted. Database opened. SQL> create user avargas identified by oracle default tablespace users temporary tablespace temp; User created. SQL> grant dba to avargas; Grant succeeded. SQL> conn avargas/oracle Connected. SQL> create table myusers as select * from dba_users;

Table created. SQL> insert into myusers select * from myusers; 8 rows created. SQL> / 16 rows created. SQL> / 32 rows created. SQL> / 64 rows created. SQL> / 128 rows created. SQL> commit; Commit complete. SQL> select count(*) from myusers; COUNT(*)

---------256

3. Check that the tablespace is self contained


To be able to transport a tablespace or tablespace set it must be self-contained, the meaning of this is that no object dependencies can exist outside the tablespace or tablespace set to be transported. To assure that the tablespace is self-contained we use the dbms_tts.transport_set_check package. SQL> execute sys.dbms_tts.transport_set_check('users',true); PL/SQL procedure successfully completed. In the case that there are violations to the transportable set detail about them are inserted into the sys.transport_set_violations SQL> select * from sys.transport_set_violations; no rows selected

4. Set the tablespaces to be transported read-only


To be able to transport a tablespace or tablespace set we need to set the tablespaces read only SQL> alter tablespace users read only;

Tablespace altered.

5. Create a directory for data pump exporting the tablespace set metadata
SQL> create or replace directory expmetadata as '/srvdb/app01/oracle/oradata/AVTST/dpexp'; Directory created.

6. Export the tablespace set metadata


Use the export data pump utility to create the metadata dump file <oracle> > setenv NLS_LANG AMERICAN_AMERICA.WE8ISO8859P1 <oracle> > expdp system/oracle DUMPFILE=tts_users.dmp DIRECTORY=expmetadata TRANSPORT_TABLESPACES =users Export: Release 10.2.0.3.0 - 64bit Production on Wednesday, 26 December, 2007 16:32:49 Copyright (c) 2003, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production With the Partitioning and Data Mining options Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01": system/******** DUMPFILE=tts_users.dmp DIRECTORY=expmetadata TRANSPORT_TABLESPACES =users Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK Processing object type TRANSPORTABLE_EXPORT/TABLE

Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK Master table "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is: /srvdb/app01/oracle/oradata/AVTST/dpexp/tts_users.dmp Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 16:33:23

7. Transfer the metadata export and tablespace set datafiles to the target server
Use ftp, scp, dbms_file_transfer or other mean to move your data to the target serve. An ASM diskgroup cannot be used to move data from one platform to other.

8. Convert the transportable tablespace set on the target server


Having the metadata export and datafiles on the target server we can execute the convert command. You have the option to execute the convert both on the source or target server. You may choose on which server to execute the convert based on the strength of the machine; i.e. if you have more CPUs on the target, and you have several datafiles to convert, you may prefer to execute the convert in the target using as many Rman channels as CPUs you have on this server.

RMAN> convert datafile '/oradisk/app01/oracle/readwrite/o1_mf_users_3pw634w4_.dbf' 2> from platform 'Solaris[tm] OE (64-bit)' 3> db_file_name_convert '/oradisk/app01/oracle/readwrite','+DB1DATADG/redx/datafile' 4> ; Starting backup at 30/12/2007 01:03:03 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=154 devtype=DISK channel ORA_DISK_1: starting datafile conversion input filename=/oradisk/app01/oracle/readwrite/o1_mf_users_3pw634w4_.dbf converted datafile=+DB1DATADG/redx/datafile/o1_mf_users_3pw634w4_.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:09 Finished backup at 30/12/2007 01:03:18 Note that there are some restrictions related to convert tablespace and convert datafile

9. Create a data pump directory on the target server


Before importing the metadata on the source server we need to create a directory SQL> create directory metadataimp as /oradisk/app01/oracle/readonly; Directory created. SQL> grant read, write on directory metadataimp to avargas;

Grant succeeded.

10. Import the metadata on the target database


On this step we will plug into the target database the metadata we exported on our source database. {oracle} /oradisk/app01/oracle/readonly [pollux.com] > impdp system/oracle dumpfile=tts_users.dmp directory=metadataimp transport_datafiles='+DB1DATADG/redx/datafile/o1_mf_users_3pw634w4_.dbf' Import: Release 10.2.0.3.0 - Production on Sunday, 30 December, 2007 5:38:27 Copyright (c) 2003, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.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=tts_users.dmp directory=metadataimp transport_datafiles=+DB1DATADG/redx/datafile/o1_mf_users_3pw634w4_.dbf 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 05:39:01

11. Check the control data on the plugged tablespace


Once the datafiles are plugged in we can check the reference data, we prepared on step 2. SQL> select tablespace_name from dba_tablespaces; TABLESPACE_NAME -----------------------------SYSTEM UNDOTBS1 SYSAUX TEMP USERS 6 rows selected. SQL> conn avargas/oracle Connected. SQL> select segment_name, tablespace_name from user_segments; SEGMENT_NAME TABLESPACE_NAME ------------------- ----------------------------MYUSERS USERS SQL> select count(*) from myusers; COUNT(*) ---------256

12. Restrictions on convert tablespace and convert datafile


There are some restrictions to the capabilities of cross platform transportable tablespace, they can be found on the Oracle Database Backup and Recovery Advanced User's Guide, 10g Release 2 (10.2): Cross-Platform Transportable Tablespace: CONVERT DATAFILE or TABLESPACE In addition please note that an ASM diskgroup cannot be moved from one platform to another, XTTS must be used in this case also.

References
Oracle Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2) Chapter 15 RMAN Cross-Platform Transportable Databases and Tablespaces Other Documents OTN Oracle Database Cross Platform Transportable Tablespace Minimizing Data Migration Time, Using Cross-Platform Transportable Tablespace

End of the Procedure

You might also like