blog 结构图:

表空间迁移(一)_迁移 表空间

 

1  场景描述

源平台为:windows xp 32系统 + oracle 11.2.0.1.0  + ORACLE_SID=orcl

目标平台rhel6.5 + oracle 11.2.0.1.0 + asm 64位 + ORACLE_SID=orclasm

目标:要实现将自定义的应用程序表空间app1tbs,app2tbs,idxtbs从源平台传递到目标平台

 

注:

 

① linux到windows 下参考: http://blog.itpub.net/26736162/viewspace-1375260/

② source和target database的数据库版本最好一致,否则会因为db time zone 一致导致报如下错误,但是source如果大于target的话是可以的,向下兼容的
ORA-39002: invalid operation

ORA-39322: Cannot use transportabletablespace with timestamp with timezone columns and different timezone version.

 

 

 

表空间迁移(一)_迁移 表空间_02 

 

2  环境准备

表空间迁移(一)_迁移 表空间_03 

 

2.1  在源库上创建3个用户应用的表空间

C:\Users\Administrator>sqlplus lhr/lhr@orclxp

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期一 5 17:15:22 2015

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

 

连接到8行。

 

SQL>

SQL>

 

2.2  在相应的表空间创建表和索引

SQL> create table scott.app1_tab tablespace app1tbs as select * from scott.emp;

 

Table created.

 

SQL> create table scott.app2_tab tablespace app2tbs as select * from scott.dept;

 

Table created.

 

SQL> create index scott.idx_emp_ename on scott.app1_tab(ename) tablespace idxtbs;

 

Index created.

 

SQL> create index scott.idx_dept_dname on scott.app2_tab(dname) tablespace idxtbs;

 

Index created.

 

SQL>

 

 

 

3  判断平台支持并确定字节序

如果传输表空间集到不同的平台,则要确定对于源和目标平台这种跨平台表空间被支持,也要确定每个平台的字节序,如果平台具有相同的字节序,则不需要进行转化,否则必须做一个表空间集转化,在源端或目标端。

3.1  在源平台查询

SQL> col platform_name for a40

SQL> select d.platform_name,tp.endian_format from v$transportable_platform tp,v$database d

  2  where tp.platform_name=d.platform_name;

 

PLATFORM_NAME                            ENDIAN_FORMAT

---------------------------------------- --------------

Microsoft Windows IA (32-bit)            Little

 

 

结论:当前的系统平台支持跨平台表空间传输(因为上面的查询有记录返回)

 

3.2  在目标平台查询

 

SQL> col platform_name for a40

SQL> select d.platform_name,tp.endian_format from v$transportable_platform tp,v$database d

  2  where tp.platform_name=d.platform_name;

 

PLATFORM_NAME ENDIAN_FORMAT

---------------------------------------- --------------

Linux x86 64-bit Little

 

SQL>

 

 

 

结论: 当前的平台支持跨平台的表空间传输源平台和目标平台的Endian_format 相同(均为Little),不需要进行表空间集转换

 

4  选择自包含的表空间集(目前要传输app1tbs和idxtbs这2个表空间)

4.1  进行检查

Indicates whether a full or partial dependency check is required. If TRUE, treats all IN and OUT pointers(dependencies) and captures them as violations if they are not self-contained in the transportable set.

SQL> execute sys.dbms_tts.transport_set_check('app1tbs,idxtbs',true);

 

PL/SQL procedure successfully completed.