ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle Transportable Tablespaces

Oracle Transportable Tablespaces

原创 Linux操作系统 作者:xhailiang 时间:2006-11-28 00:00:00 0 删除 编辑
Version 10.2

Oracle Transportable Tablespaces
General
You can use the transportable tablespaces feature to move a subset of an Oracle database and "plug" it in to another Oracle database, essentially moving tablespaces between the databases. The tablespaces being transported can be either dictionary managed or locally managed. Starting with Oracle9i, the transported tablespaces are not required to be of the same block size as the target database's standard block size. Transporting tablespaces is particularly useful for:

Moving data from OLTP systems to data warehouse staging systems Updating data warehouses and data marts from staging systems Loading data marts from central data warehouses Archiving OLTP and data warehouse systems efficiently Data publishing to internal and external customers Performing Tablespace Point-in-Time Recovery (TSPITR)

Moving data using transportable tablespaces can be much faster than performing either an export/import or unload/load of the same data, because transporting a tablespace only requires the copying of datafiles and integrating the tablespace structural information. You can also use transportable tablespaces to move index data, thereby avoiding the index rebuilds you would have to perform when importing or loading table data.

LIMITATIONS
Be aware of the following limitations as you plan for transportable tablespace use:

The source and target database must be on the same hardware platform. For example, you can transport tablespaces between Sun Solaris Oracle databases, or you can transport tablespaces between Windows NT Oracle databases. However, you cannot transport a tablespace from a Sun Solaris Oracle database to an Windows NT Oracle database. The source and target database must use the same character set and national character set. You cannot transport a tablespace to a target database in which a tablespace with the same name already exists. Transportable tablespaces do not support: Materialized views/replication Function-based indexes.
Demo
conn / as sysdba

CREATE TABLESPACE tts
DATAFILE 'c:temptts.dbf' size 10M
BLOCKSIZE 8192
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K
SEGMENT SPACE MANAGEMENT AUTO
ONLINE;

CREATE OR REPLACE DIRECTORY trans_dir AS 'c:tts';

GRANT READ, WRITE ON DIRECTORY trans_dir TO public;

SELECT tablespace_name, contents, status
FROM dba_tablespaces;

ALTER USER amazon QUOTA UNLIMITED ON tts;


conn amazon/amazon

CREATE TABLE t1 (
pid NUMBER(5),
lname VARCHAR2(20))
TABLESPACE uwdata;

ALTER TABLE t1
ADD CONSTRAINT pk_t1
PRIMARY KEY (pid)
USING INDEX
PCTFREE 0
TABLESPACE tts;

CREATE TABLE t2 (
pid NUMBER(5),
lname VARCHAR2(20))
TABLESPACE tts;

ALTER TABLE t2
ADD CONSTRAINT pk_t2
PRIMARY KEY (pid)
USING INDEX
PCTFREE 0
TABLESPACE uwdata;


conn / as sysdba

EXECUTE sys.DBMS_TTS.TRANSPORT_SET_CHECK('tts', TRUE);

SELECT *
FROM sys.TRANSPORT_SET_VIOLATIONS;


conn amazon/amazon

ALTER TABLE t1 MOVE TABLESPACE tts;

ALTER INDEX pk_t2 REBUILD TABLESPACE tts;


conn / as sysdba

EXECUTE sys.DBMS_TTS.TRANSPORT_SET_CHECK('tts', TRUE);

SELECT *
FROM sys.TRANSPORT_SET_VIOLATIONS;

ALTER TABLESPACE tts READ ONLY;

-- in o/s window
expdp system/manager
DUMPFILE=tts.dmp
DIRECTORY=trans_dir
TRANSPORT_TABLESPACES = tts


conn / as sysdba

DROP TABLESPACE tts INCLUDING CONTENTS AND DATAFILES;


-- in o/s window
impdp system/manager parfile=trans.par
/*
DUMPFILE=trans.dmp
DIRECTORY=trans_dir
REMAP_SCHEMA=amazon:uwclass
TRANSPORT_DATAFILES='c:temptts.dbf'
*/


conn / as sysdba

SELECT tablespace_name, contents, status
FROM dba_tablespaces;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/308563/viewspace-171955/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-17

  • 博文量
    270
  • 访问量
    415387