 |
|
Oracle
Transporting Tablespaces Across Platforms
Oracle Tips by Burleson Consulting |
This
is an excerpt from "Oracle 10g New Features for Administrators" by
Ahmed Baraka.
Introduction to Transportable Tablespaces
In Oracle Database 10g, you can transport
tablespaces between different platforms.
Transportable tablespaces are a good way to migrate
a database between different platforms.
You must be using the Enterprise Edition of Oracle8i
or higher to generate a transportable tablespace set. However, you
can use any edition of Oracle8i or higher to plug a transportable
tablespace set into an Oracle Database on the same platform.
To plug a transportable tablespace set into an
Oracle Database on a different platform, both databases must have
compatibility set to at least 10.0.
Many, but not all, platforms are supported for
cross-platform tablespace transport. You can query the
V$TRANSPORTABLE_PLATFORM view to see the platforms that are
supported.
Limitations on Transportable Tablespace Use
• The source and target database must use the same
character set and national set.
• Objects with underlying objects (such as
materialized views) or contained objects (such as partitioned
tables) are not transportable unless all of the underlying or
contained objects are in the tablespace set.
• You cannot transport the SYSTEM tablespace or
objects owned by the user SYS.
Transporting Tablespaces Between Databases
1. Check endian format of both platforms. For
cross-platform transport, check the endian
format of both platforms by querying the V$TRANSPORTABLE_PLATFORM
view.
You can find out your own platform name:
select
platform_name from v$database
2. Pick a self-contained set of tablespaces.
The following statement can be used to determine
whether tablespaces sales_1 and sales_2 are selfcontained, with
referential integrity constraints taken into consideration:
DBMS_TTS.TRANSPORT_SET_CHECK( TS_LIST
=>'sales_1,sales_2', INCL_CONSTRAINTS =>TRUE,
FULL_CHECK =>TRUE)
Note: You must have been granted the
EXECUTE_CATALOG_ROLE role (initially signed to SYS) to execute this
procedure.
You can see all violations by selecting from the
TRANSPORT_SET_VIOLATIONS view. If the set of tablespaces is
self-contained, this view is empty.
3. Generate a transportable tablespace set.
3.1. Make all tablespaces in the set you are
copying read-only.
3.2. Export the metadata describing the objects in
the tablespace(s)
EXPDP system/password
DUMPFILE=expdat.dmp DIRECTORY=dpump_dir
TRANSPORT_TABLESPACES = sales_1,sales_2
TRANSPORT_FULL_CHECK=Y
3.3. If you want to convert the tablespaces in the
source database, use the RMAN
RMAN TARGET /
CONVERT TABLESPACE sales_1,sales_2
TO PLATFORM 'Microsoft Windows NT'
FORMAT '/temp/%U'
4. Transport the tablespace set.
Transport both the datafiles and the export file of
the tablespaces to a place accessible to the target database.
5. Convert tablespace set, if required, in the
destination database.
Use RMAN as follows:
RMAN> CONVERT
DATAFILE
'/hq/finance/work/tru/tbs_31.f',
'/hq/finance/work/tru/tbs_32.f',
'/hq/finance/work/tru/tbs_41.f'
TO PLATFORM="Solaris[tm] OE (32-bit)"
FROM PLATFORM="HP TRu64 UNIX"
DBFILE_NAME_CONVERT=
"/hq/finance/work/tru/",
"/hq/finance/dbs/tru"
PARALLELISM=5
Note: The source and destination platforms are
optional.
Note: By default, Oracle places the converted
files in the Flash Recovery Area, without changing the datafile
names.
Note: If you have CLOB data on a small-endian
system in an Oracle database version before 10g and with a
varying-width character set and you are transporting to a database
in a big-endian system, the CLOB data must be converted in the
destination database. RMAN does not handle the conversion during the
CONVERT phase. However, Oracle database automatically handles the
conversion while accessing the CLOB data.
If you want to eliminate this run-time conversion
cost from this automatic conversion, you can issue the CREATE TABLE
AS SELECT command before accessing the data.
6. Plug in the tablespace.
IMPDP
system/password DUMPFILE=expdat.dmp
DIRECTORY=dpump_dir
TRANSPORT_DATAFILES=
/salesdb/sales_101.dbf,
/salesdb/sales_201.dbf
REMAP_SCHEMA=(dcranney:smith)
REMAP_SCHEMA=(jfee:williams)
If required, put the tablespace into READ WRITE
mode.
A Few Restrictions
o There are a few restrictions on what tablespaces
can qualify for transportability:
o You cannot transport the SYSTEM tablespace or
any of its contents. This means that you cannot use TTS for
PL/SQL, triggers, or views. These would have to be moved with
export.
o The source and target database must have the
same character set and national language set.
o You cannot transport a table with a materialized
view unless the mview is in the transport set you create.
o You cannot transport a partition of a table
without transporting the entire table.
Using Transportable Tablespaces: Scenarios
Transporting and Attaching Partitions for Data
Warehousing
1. In a staging database, you create a new
tablespace and make it contain the table you want to transport.
It should have the same columns as the destination partitioned
table.
2. Create an index on the same columns as the local
index in the partitioned table.
3. Transport the tablespace to the data warehouse.
4. In the data warehouse, add a partition to the
table.
ALTER TABLE sales
ADD PARTITION jul98 VALUES
LESS THAN (1998, 8, 1)
5. Attach the transported table to the partitioned
table by exchanging it with the new partition:
ALTER TABLE sales
EXCHANGE PARTITION jul98
WITH TABLE jul_sales
INCLUDING INDEXES WITHOUT VALIDATION
Publishing Structured Data on CDs
A data provider can load a tablespace with data to
be published, generate the transportable set, and copy the
transportable set to a CD. When customers receive this CD,
they can plug it into an existing database without having to copy
the datafiles from the CD to disk storage.
Note: In this case, it is highly recommended to
set the READ_ONLY_OPEN_DELAYED initialization parameter to TRUE.
Mounting the Same Tablespace Read-Only on Multiple
Databases
You can use transportable tablespaces to mount a
tablespace read-only on multiple databases.
Archiving Historical Data Using Transportable
Tablespaces
Using Transportable Tablespaces to Perform TSPITR
Note: For information about transporting the
entire database across the platforms, see the section "
Cross-Platform
Transportable Database".
Using Database Control to Transport Tablespaces
You can use the Transport Tablespaces wizard to move
a subset of an Oracle database from one Oracle database to another,
even across different platforms.
The Transport Tablespaces wizard automates the
process of generating a transportable tablespace set, or integrating
an existing transportable tablespace set.
The wizard uses a job that runs in the Enterprise
Manager job system.
You can access the wizard from the
Maintenance | Transport Tablespaces
link in the
Move Database
Files
section.
 |
If you like Oracle tuning, see the
book "Oracle
Tuning: The Definitive Reference", with 950 pages of tuning
tips and scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |