Easy way to perform Transportable tablespace across platforms.
Transportable Tablespace feature was introduced in Oracle 8i to transfer large amount of data between the oracle databases.
In Oracle 10g this useful feature was enhanced with cross-platform support which allowed a tablespace, or set of tablespaces, to be transported between databases deployed on different hardware platforms .
Even we can perform T-Ts which platforms have different Endian format.
This article will help you to perform T-Ts from RHEL 7.5 to Windows 7 operating system and Vice Versa.
Source database server details :
Operating Version : RHEL 7.5 -64 bit
Database version : Oracle 12cR1
Type of DB : Container DB
ENDIAN FORMAT : Little
target database server details :
Operating Version : Windows 7 x86-64 bit
Database version : Oracle 12cR1
Type of DB : Non –Container DB
ENDIAN FORMAT : Little
Check the source database(LINUX) information.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
SYS>>select banner from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production PL/SQL Release 12.1.0.2.0 - Production CORE 12.1.0.2.0 Production TNS for Linux: Version 12.1.0.2.0 - Production NLSRTL Version 12.1.0.2.0 - Production SYS>>select name||' - '||instance_name||'@'||host_name||' - '||DB_UNIQUE_NAME||' - '||version||' - '||open_mode||' - '||to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') || ' - '|| database_role||'-'||CDB from v$database, v$instance; NAME||'-'||INSTANCE_NAME||'@'||HOST_NAME||'-'||DB_UNIQUE_NAME||'-'||VERSION||'-'||OPEN_MODE||'-'||TO_CHAR(STARTUP_TIME,'DD-MON-YYYYHH24:MI:SS')||'-'||DATABASE_ROLE||'-'||CDB ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- MICROCDB - microcdb@dba20.ord.com - microcdb - 12.1.0.2.0 - READ WRITE - 12-JUL-2018 19:52:53 - PRIMARY-YES SYS>>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ----------------------- ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PLUG4 MOUNTED 4 PLUG2 READ WRITE NO 5 PLUG5 MOUNTED |
Here Plug2 pluggable database is in READ WRITE mode.
Now connect to plug2 PDB and create a new tablespace.
1 2 3 4 5 6 7 8 |
SYS>> alter session set container=plug2 Session altered. SYS>>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 PLUG2 READ WRITE NO SYS>>create tablespace trans_cp_ts datafile '/u01/oradata/microcdb/plug2/trans_cp_ts.dbf' size 10m; Tablespace created. |
Create a schema with required privileges and assign the user to above created tablespace.
1 2 3 4 |
SYS>>grant dba to trans_cp_us identified by trans_cp_us; Grant succeeded. SYS>>alter user trans_cp_us default tablespace trans_cp_ts; User altered. |
Connect to Schema and create a table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
SYS>>conn trans_cp_us/trans_cp_us@to_plug2 Connected. TRANS_CP_US>>create table xxtag (sno number); Table created. TRANS_CP_US>>insert into xxtag values(&sno); Enter value for sno: 10 old 1: insert into xxtag values(&sno) new 1: insert into xxtag values(10) 1 row created. TRANS_CP_US>>/ Enter value for sno: 20 old 1: insert into xxtag values(&sno) new 1: insert into xxtag values(20) 1 row created. TRANS_CP_US>>/ Enter value for sno: 30 old 1: insert into xxtag values(&sno) new 1: insert into xxtag values(30) 1 row created. TRANS_CP_US>>/ Enter value for sno: 40 old 1: insert into xxtag values(&sno) new 1: insert into xxtag values(40) 1 row created. TRANS_CP_US>>/ Enter value for sno: 50 old 1: insert into xxtag values(&sno) new 1: insert into xxtag values(50) 1 row created. TRANS_CP_US>>commit; Commit complete. |
Connect to admin user SYS in plug2 database and create directory object to perform datapump operations.
1 2 3 4 |
TRANS_CP_US>>conn sys/sys@to_plug2 as sysdba Connected. SYS>>CREATE directory dir_plug2 as '/u01/oradata/microcdb/plug2/dir_plug2'; Directory created. |
check the tablespace dependencies using below PL*SQL package.
1 2 3 4 |
SYS>>exec dbms_tts.transport_set_check('trans_cp_ts',true); PL/SQL procedure successfully completed. SYS>>select * from transport_set_violations; no rows selected |
In Above query result shows no rows selected,In case if it shows any lines we should solve it.
The tablespace(s) to transport must be made read-only before Export operations.
1 2 |
SYS>>alter tablespace trans_cp_ts read only; Tablespace altered. |
Perform export operation using transport_tablepsace parameter.
In case If we are transferring large amount of data then using parallel option while exporting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[oracle@dba20 ~]$ expdp directory=dir_plug2 dumpfile=trans_ts.dmp logfile=trans_ts.log transport_tablespaces=trans_cp_ts Export: Release 12.1.0.2.0 - Production on Thu Jul 12 19:33:25 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: sys/sys@to_plug2 as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Starting "SYS"."SYS_EXPORT_TRANSPORTABLE_01": sys/********@to_plug2 AS SYSDBA directory=dir_plug2 dumpfile=trans_ts.dmp logfile=trans_ts.log transport_tablespaces=trans_cp_ts Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK Processing object type TRANSPORTABLE_EXPORT/TABLE Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK Master table "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is: /u01/oradata/microcdb/plug2/dir_plug2/trans_ts.dmp ****************************************************************************** Datafiles required for transportable tablespace TRANS_CP_TS: /u01/oradata/microcdb/plug2/trans_cp_ts.dbf Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at Thu Jul 12 19:35:17 2018 elapsed 0 00:01:18 |
Check the datafile header information in a tablespace
1 2 3 4 |
SYS>>select tablespace_name, name from v$datafile_header where tablespace_name='TRANS_CP_TS'; TABLESPACE_NAME NAME ------------------ -------------------------------------------------------------- TRANS_CP_TS /u01/oradata/microcdb/plug2/trans_cp_ts.dbf |
Will see from Linux to which platforms we can transport data to:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
SYS>>select platform_id, platform_name, endian_format from v$transportable_platform order by platform_id; PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT ----------- ------------------------------ -------------- 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 PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT ----------- ------------------------------ -------------- 12 Microsoft Windows x86 64-bit Little 13 Linux x86 64-bit Little 15 HP Open VMS Little 16 Apple Mac OS Big 17 Solaris Operating System (x86) Little 18 IBM Power Based Linux Big 19 HP IA Open VMS Little 20 Solaris Operating System (x86- Little 21 Apple Mac OS (x86-64) Little |
In above result will see Linux support to transfer the data to Microsoft Windows x86 64-bit.
Connect to RMAN prompt and convert the tablespace to support windows operating systems.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[oracle@dba20 ~]$ rman target sys/sys@to_plug2 Recovery Manager: Release 12.1.0.2.0 - Production on Thu Jul 12 20:35:21 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: MICROCDB (DBID=2253696659) RMAN> convert tablespace trans_cp_ts to platform 'Microsoft Windows x86 64-bit' db_file_name_convert '/u01/oradata/microcdb/plug2' '/home/oracle'; Starting conversion at source at 12-JUL-18 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=51 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=48 device type=DISK channel ORA_DISK_1: starting datafile conversion input datafile file number=00023 name=/u01/oradata/microcdb/plug2/trans_cp_ts.dbf converted datafile=/home/oracle/trans_cp_ts.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:04 Finished conversion at source at 12-JUL-18 |
In /home/oracle location a new datafile will be created by rman to support windows o/s.
Copy the metadata file and actual data file to target server location(windows) using Winscp.
In Target sever :
Check the information of database;
1 2 3 4 5 6 7 8 9 10 11 12 13 |
SQL> select banner from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production PL/SQL Release 12.1.0.2.0 - Production CORE 12.1.0.2.0 Production TNS for 64-bit Windows: Version 12.1.0.2.0 - Production NLSRTL Version 12.1.0.2.0 - Production SQL> select name,open_mode,cdb from v$database; NAME OPEN_MODE CDB --------- ------------- --------- ORD READ WRITE NO |
Check the directory object to perform import operations.
1 2 3 4 |
SQL> select directory_name,directory_path from dba_directories where directory_name='DATA_PUMP'; DIRECTORY_NAME DIRECTORY_PATH ----------------------------- --------------------------------------------------- DATA_PUMP E:\APP\AJAY\ORADATA\ORD\data_pump |
Create the required schema in the database,
1 2 |
SQL> grant dba to trans_cp_us identified by trans_cp_us; user created. |
Import the dumpfile along the datafile using below parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
C:\Users\AJAY>impdp directory=data_pump dumpfile=trans_ts.dmp transport_tablespace=y datafiles='E:\APP\AJAY\ORADATA\ORD\data_pump\trans_cp_ts.dbf' Import: Release 12.1.0.2.0 - Production on Thu Jul 12 09:07:04 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: / as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Legacy Mode Active due to the following parameters: Legacy Mode Parameter: "datafiles=E:\APP\AJAY\ORADATA\ORD\data_pump\trans_cp_ts. dbf" Location: Command Line, Replaced with: "transport_datafiles=E:\APP\AJAY\ORA DATA\ORD\data_pump\trans_cp_ts.dbf" Database Directory Object "DATA_PUMP" has been added to file specification: "E:\ APP\AJAY\ORADATA\ORD\data_pump\trans_cp_ts.dbf". Legacy Mode Parameter: "transport_tablespace=TRUE" Location: Command Line, ignored. Master table "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded Source time zone is +05:30 and target time zone is +00:00. import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set export done in US7ASCII character set and AL16UTF16 NCHAR character set Starting "SYS"."SYS_IMPORT_TRANSPORTABLE_01": /******** AS SYSDBA directory=dat a_pump dumpfile=trans_ts.dmp transport_datafiles=E:\APP\AJAY\ORADATA\ORD\data_pump\trans_cp_ts.dbf Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK Processing object type TRANSPORTABLE_EXPORT/TABLE Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK Job "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Thu Jul 12 09:08:42 2018 elapsed 0 00:01:34 |
Now connect to schema and see the rows .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
C:\Users\AJAY>sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Thu Jul 12 09:09:02 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> conn trans_cp_us/trans_cp_us Connected. SQL> select * from tab; TNAME -------------------------------------------------------------------------------- TABTYPE CLUSTERID ------- ---------- XXTAG TABLE SQL> select * from xxtag; SNO ---------- 10 20 30 40 50 |
To check the tablespace is migrated from another database use below command
the plugged_in status of trans_cp_ts will show as YES, Because it is migrated from another database.
1 2 3 4 5 6 7 8 9 10 11 |
SQL> select tablespace_name,status,plugged_in from dba_tablespaces; TABLESPACE_NAME status PLUGGED_IN ------------------ ---------- ----------- SYSTEM ONLINE NO SYSAUX ONLINE NO UNDOTBS1 ONLINE NO TEMP ONLINE NO USERS ONLINE NO EXAMPLE ONLINE NO TRANS_CP_TS READ ONLY YES |
Make the tablespace as read write .
1 2 |
SQL> alter tablespace trans_cp_ts read write; Tablespace altered. |
The above steps are same to transfer the data from windows to Linux , but only rman convert command only changed.
1 2 3 |
RMAN> convert datafile 'c:\test\tbs_lin.dbf' 2> to platform 'microsoft windows ia (32-bit)' 3> format 'c:\tmp\file_%U'; |
Thank you for reading my article ,Please mention your valuable comments.
Ajay Kumar
While importing i have faced this below error
impdp directory=data_pump dumpfile=trans_ts.dmp transport_datafiles=’E:\APP\AJAY\ORADATA\ORD\data_pump\trans_cp_ts.dbf’
ORA-39352: Wrong number of TRANSPORT_DATAFILES specified: expected 1, received 2
Then i used different import command.
impdp directory=data_pump dumpfile=trans_ts.dmp transport_tablespaces=y
datafiles=’E:\APP\AJAY\ORADATA\ORD\data_pump\trans_cp_ts.dbf’
Kumar
Nice article.
Ajay Kumar
Transporting the Tablespace across Different Platforms
Sun, Jul 15, 2018 6:30 AM – 8:30 AM PDT / 7 PM IST
Agenda
1. Transporting the Tablespace across Different Platforms
a.Linux to Windows
b.Windows to linux
2.How to make database link b/w two pluggable databases.
3.What is the use of network_link paramter in DATAPUMP.
4.How to use network_link parameter while exporting and importing.
Please join my meeting from your computer, tablet or smartphone.
https://global.gotomeeting.com/join/142827749
You can also dial in using your phone.
United States: +1 (872) 240-3212
Access Code: 142-827-749
Please go through the article before session
https://www.ktexperts.com/easy-way-to-perform-transportable-tablespace-across-platforms/
Time Zone Converter :
https://www.timeanddate.com/worldclock/converter.html?iso=20180715T133000&p1=176&p2=137&p3=236&p4=136&p5=179&p6=240
Vinod
Hello Everyone,
Great response to the session on Transporting the Tablespace across Different Platforms.
Please check Vimeo video link.:
https://vimeo.com/280081435/66b6afc94c