最近做数据迁移,之前有一篇迁移思路思考的文章,这里继续做具体的测试,主题问表空间传输。

一、源服务器上导出表空间

源服务器:   10.1.122.55
目标服务器:10.1.122.54

0.设置字符集

注意,这里不设置字符集在导入的时候会报错,详细情况见文章的最后。
suse11sp2:~ # export LANG=AMERICAN_AMERICA.AL32UTF8
suse11sp2:~> export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

suse11sp2:~> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 24 14:45:47 2013

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

1.准备需要传输的表空间

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create tablespace aaa datafile '/oracle/oradata/aa.dbf' size 100M ;

Tablespace created.

SQL> CREATE USER aaa  IDENTIFIED BY aaa
DEFAULT TABLESPACE aaa
TEMPORARY TABLESPACE  temp;   2    3

User created.

SQL> GRANT CONNECT,RESOURCE TO aaa;

Grant succeeded.

SQL> REVOKE UNLIMITED TABLESPACE FROM aaa;

Revoke succeeded.

SQL> ALTER USER aaa QUOTA UNLIMITED ON aaa;

User altered.

SQL> conn aaa/aaa;
Connected.
SQL> create table a1(id varchar2(10),name varchar2(20));

Table created.

SQL> insert into a1 values('01','lurou');

1 row created.

SQL> insert into a1 values('02','hello,DBA!');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> select * from a1;

ID         NAME
---------- --------------------
01         lurou
02         hello,DBA!

SQL>
SQL>
SQL>

2.做传输前检查

SQL> conn / as sysdba
Connected.
SQL>
SQL> execute sys.dbms_tts.transport_set_check('aaa',true);

PL/SQL procedure successfully completed.

SQL>
SQL> select * from sys.transport_set_violations;

no rows selected

SQL>

3.设置表空间为只读

SQL>
SQL> alter tablespace aaa read only;

Tablespace altered.

SQL>
SQL> commit;

Commit complete.

SQL>

4.导出表空间

1)遇到个小插曲,必须使用sys dba
suse11sp2:~> exp system/its7888$ tablespaces=aaa file=/tmp/aaatts.dmp  transport_tablespace=y

Export: Release 11.2.0.3.0 - Production on Wed Jul 24 14:58:19 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXP-00044: must be connected 'AS SYSDBA' to do Point-in-time Recovery or Transportable Tablespace import
EXP-00000: Export terminated unsuccessfully

2)导出成功
suse11sp2:~> exp \'sys/its7888$ as sysdba\' tablespaces=aaa file=/tmp/aaatts.dmp transport_tablespace=y

Export: Release 11.2.0.3.0 - Production on Wed Jul 24 14:59:13 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in AL32UTF8 character set and UTF8 NCHAR character set
Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace AAA ...
. exporting cluster definitions
. exporting table definitions
. . exporting table                             A1
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.
suse11sp2:~>

二、目标服务器上导入表空间

5.将导出的dmp文件和数据文件拷贝到目标服务器

scp /oracle/oradata/aa.dbf oracle@10.1.122.54:/oracle/oradata
scp /tmp/aaatts.dmp  oracle@10.1.122.54:/tmp

6.创建用户

SQL> create user bbb identified by bbb;

User created.

SQL> grant connect,resource to bbb;

Grant succeeded.

SQL> commit;

Commit complete.

7.导入表空间

imp \'sys/its7888$ as sysdba\'  tablespaces=aaa transport_tablespace=y file=/tmp/aaatts.dmp  datafiles=/oracle/oradata/aa.dbf  fromuser=aaa touser=bbb

SQL> conn aaa/aaa
Connected.
SQL> select * from a1
  2  ;

ID         NAME
---------- --------------------
01         lurou
02         hello,DBA!

SQL>
SQL>
SQL> conn / as sysdba
Connected.
SQL> drop tablespace aaa including contents and datafiles;

Tablespace dropped.

——————————————————————————

三、之前遭遇的报错

未设置字符集的操作过程中,遭遇报错

suse11sp2:~> exp \'sys/its7888$ as sysdba\' tablespaces=aaa file=/tmp/aaatts.dmp transport_tablespace=y

Export: Release 11.2.0.3.0 - Production on Wed Jul 24 15:31:57 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and UTF8 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace AAA ...
. exporting cluster definitions
. exporting table definitions
. . exporting table                             A1
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.
suse11sp2:~>

imp userid=system/its7888$ tablespaces=aaa transport_tablespace=y file=/tmp/aaatts.dmp  datafiles=/oracle/oradata/aa.dbf

Import: Release 11.2.0.3.0 - Production on Wed Jul 24 09:22:57 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
IMP-00053: Import mode incompatible with Export dump file

IMP-00000: Import terminated unsuccessfully

___________________________________________________________________________________

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Author:   laven54 (lurou)

Email:    laven54@163.com

Blog:      http://blog.csdn.net/laven54

QQ群: 164734649  可以到群里来提问,Oracle相关的问题我都很感兴趣

oracle传输表空间功能测试(含详细过程)的更多相关文章

  1. Oracle传输表空间介绍

    传输表空间通过拷贝数据文件的方式,实现可跨平台的数据迁移,效率远超expdp/impdp, exp/imp等工具.还可以应用跨平台&数据库版本迁移表数据.归档历史数据和实现表空间级时间点数据恢 ...

  2. oracle传输表空间

    https://blog.csdn.net/ch7543658/article/details/39271135/ Oracle expdp/impdp常用性能优化方法 1.查看操作系统endiann ...

  3. oracle传输表空间相关

    1.convert tablespaceconvert tablespace源端库执行:convert tablespace 'TPS_DATA' to platform 'AIX-Based Sys ...

  4. 【TTS】传输表空间AIX asm -> linux asm

    [TTS]传输表空间AIX asm -> linux asm 一.1  BLOG文档结构图       一.2  前言部分   一.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌 ...

  5. 【TTS】传输表空间Linux asm -> AIX asm

    [TTS]传输表空间Linux asm -> AIX asm 一.1  BLOG文档结构图       一.2  前言部分   一.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌 ...

  6. 转 Oracle Transportable TableSpace(TTS) 传输表空间 说明

    ############1   迁移数据库的集中方法 三.相关技术 迁移方式 优势 不足1 Export and import • 对数据库版本,以及系统平台没有要求 • 不支持并发,速度慢• 停机时 ...

  7. oracle操作之传输表空间

    一.传输表空间概述 什么是传输表空间,传输表空间技术始于oracle9i,不论是数据字典管理的表空间还是本地管理的表空间,都可以使用传输表空间技术:传输表空间不需要在源数据库和目标数据库之间具有同样的 ...

  8. oracle expdp/impdp/可传输表空间

    oracle expdp/impdp/可传输表空间/及一些参数 Oracle data pump 导出操作能够将表.索引.约束.权限.PLSQL包.同义词等对象从数据库导出,并将它们保存在一种非文本格 ...

  9. Oracle使用SQL传输表空间

    源环境:RHEL 6.4 + Oracle 11.2.0.4 目的环境:RHEL 6.4 + Oracle 11.2.0.4 DG双机 要求:使用SQL传输表空间DBS_D_JINGYU从源环境到目的 ...

随机推荐

  1. 黑马程序员_static\访问权限\单例模式 大汇总

    一.static关键字 1.用法 Static是一个修饰符,用于修饰成员,包括成员变量和成员函数.当成员被静态修饰后,就多了一种调用方式,除了可以被对象调用外,还可以直接被类名调用.System.ou ...

  2. 10-3[RF] feature selection

    main idea: 计算每一个feature的重要性,选取重要性前k的feature: 衡量一个feature重要的方式:如果一个feature重要,则在这个feature上加上noise,会对最后 ...

  3. #include <stdlib.h>

    1 _itoa 2 atoi 3 rand() 4 srand 1 _itoa _itoa(int value,char*string,int radix); int value 被转换的整数,cha ...

  4. SSH登陆服务器的简单命令

    SSh 用户名@目标Ip: 回车输入密码:

  5. LightOJ - 1422 Halloween Costumes (区间dp)

    Description Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he i ...

  6. hdu 4597 Play Game(区间dp,记忆化搜索)

    Problem Description Alice and Bob are playing a game. There are two piles of cards. There are N card ...

  7. UIImage 图片处理:截图,缩放,设定大小,存储

    图片的处理大概就分 截图(capture), 缩放(scale),设定大小(resize), 存储(save)这几样比较好处理, 另外还有滤镜,擦试等, 以后再说在这个Demo code裡, 我写了几 ...

  8. 依赖注入及AOP简述(十二)——依赖注入对象的行为增强(AOP) .

    四.依赖注入对象的行为增强(AOP) 前面讲到,依赖注入框架的最鲜明的特点就是能够提供受容器管理的依赖对象,并且可以对对象提供行为增强(AOP)功能,所以这一章我们来讨论有关AOP的话题. 1.    ...

  9. 关于js中的类型内容总结(类型识别)

    JS 有7种数据类型: 6种原始类型:Boollean    String   Number    Null    Underfined   Symbol 引用类型:Object 类型识别主要有以下四 ...

  10. Linux 07 故障恢复

    1. 模拟MBR扇区被破坏后的修复. MBR故障恢复: 1.备份 添加硬盘 启动操作系统: 添加硬盘: 对分区格式化: 挂载: 做备份: 破坏MBR 重启系统: 关闭虚拟机 设置光盘启动 救援模式: ...