表空间移动(transporting tablespaces)
--表空间移动(transporting tablespaces)
--------------------------------------2014/01/15
1. 表空间传输步骤简介。
a. 选择一个自包含的表空间集合。
b. 在源数据库端,设置需要传输的表空间集合为只读状态。
c. 在源数据库端,导出表空间中的metadata。
d. 传输dmp文件和表空间数据文件到目标数据库服务器中。
e. 将源数据库端表空间恢复成读写状态。
f. 在目标数据库中建立与表空间对应的用户信息。如果使用impdp,可以选者remap_schema重新定位用户,不过重定位的用户也必须是存在的。
g. 在目标数据库中倒入表空间。
2. 操作步骤。
源:windows服务器
SQL> create tablespace tran datafile ‘D:\app\Hujie\oradata\august\tran01.DBF’ size 30M;
SQL> create user tran identified by tran default tablespace tran;
SQL> grant connect,resource to tran;
SQL> conn tran/tran;
SQL> create table tran as select * from dict;
SQL> select count(1) from tran;
COUNT(1)
----------
835
SQL> conn sys/dba as sysdba
Connected.
SQL> alter tablespace tran read only;
Tablespace altered.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
C:\Users\Hujie>exp '/ as sysdba' tablespaces=tran transport_tablespace=y file=exp_trans.dmp
Export: Release 11.2.0.1.0 - Production on Wed Jan 15 09:05:34 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace TRAN ...
. exporting cluster definitions
. exporting table definitions
. . exporting table TRAN
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.
将exp_trans.dmp和D:\app\Hujie\oradata\august\tran01.DBF传输到目标linux服务器目录/u01下。
目标:linux服务器
SQL> create user tran identified by tran;
User created.
SQL> grant connect , resource to tran;
Grant succeeded.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[Oracle@localhost u01]$ ls
app august01.ctl exp_trans.dmp TRAN_lx.DBF(改名测试,原名:TRAN.DBF)
[Oracle@localhost u01]$ imp \'/ as sysdba\' tablespaces=tran transport_tablespace=y file=exp_trans.dmp datafiles=/u01/TRAN_lx.DBF
Import: Release 11.2.0.1.0 - Production on Tue Jan 14 18:06:20 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
export client uses WE8MSWIN1252 character set (possible charset conversion)
. importing SYS's objects into SYS
. importing SYS's objects into SYS
. importing TRAN's objects into TRAN
. . importing table "TRAN"
. importing SYS's objects into SYS
Import terminated successfully without warnings.
[Oracle@localhost u01]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 14 18:06:33 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn tran/tran
Connected.
SQL> select count(1) from tran;
COUNT(1)
----------
835
*改变数据文件的名字不影响导入,所以没有必要使用rman来对文件改名。
RMAN> convert datafile ‘/u01/TRAN.DBF’ db_file_name_convert ‘/u01/TRAN.DBF’,’/u01/TRAN_lx.DBF’; ----使用expdp和impdp参数略微有些不同,请参考下面例子。
导入:
$ expdp \'/ as sysdba\' dumpfile=expdat.dmp direcotry=data_pump_dir transport_tablespaces=sales_1,sales_2 logfile=tts_export.log
导出:
$ impdp \'/ as sysdba\' dumpfile=expdat.dmp dirctory=data_pump_dir transport_datafiles=
'/u01/oradata/sales_101.dbf',
'/u01/oradata/sales_201.dbf'
remap_schema=sales1:crm1 remap_schema=sales2:crm2
logfile=tts_import.log ----对于用户的切换,imp也可以实现,请看下面例子。
SQL> drop user tran cascade;
User dropped.
SQL> drop tablespace tran;
Tablespace dropped.
SQL> create user nart identified by nart;
User created.
SQL> grant connect,resource to nart;
Grant succeeded.
[Oracle@localhost u01]$ imp \'/ as sysdba\' tablespaces=tran transport_tablespace=y file=exp_trans.dmp datafiles=/u01/TRAN_lx.DBF fromuser=tran touser=nart;
Import: Release 11.2.0.1.0 - Production on Tue Jan 14 19:11:24 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
export client uses WE8MSWIN1252 character set (possible charset conversion)
. importing TRAN's objects into NART
. . importing table "TRAN"
Import terminated successfully without warnings.
[Oracle@localhost u01]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 14 19:11:41 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn nart/nart
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------------------------------------
TRAN
SQL> select count(1) from tran;
COUNT(1)
----------
835
表空间移动(transporting tablespaces)的更多相关文章
- 6. 将单独表空间(File-Per-Table Tablespaces)复制到另一个实例
6. 将单独表空间复制到另一个实例 本节介绍如何将单独表空间从一个MySQL实例复制 到另一个MySQL实例,也称为可传输表空间功能. 将InnoDB单独表空间复制到其他实例的原因有很多: - 在不对 ...
- 浅谈mysql中各种表空间(tablespaces)的概念
mysql中,会涉及到各种表空间的概念,虽然,很多方面这些概念和Oracle有相似性,但也有很多不同的地方,初学者很容易被这些概念弄的晕头转向,从而,混淆这些概念的区别和理解,下面,就简要介绍和说明一 ...
- 【DB2】表空间相关详细说明
-.创建表空间 1.创建用户表空间 声明:在指定表空间创建路径的时候,需要指定空文件夹,非空文件夹会导致创建报错!!!如果文件夹不存在,那么在创建表空间的时候会自动创建文件夹! 1.1 创建SMS表空 ...
- DB2表空间重定向恢复数据库实战
DB2的备份恢复有点坑,当源系统和目标系统的路径设置不同时,要手动进行重定向恢复,本文是我一次实战操作之后总结的过程,仅供参考. 一.发出重定向恢复命令 DB2 RESTORE DB TO " ...
- DB2表空间
https://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0902yuancg/ 临时表空间的使用 (sorts or jo ...
- Oracle表空间概述及其基本管理
最近在工作中遇到有同事对Oracle表空间的理解有问题,所以写了这篇文章.我会从概念,管理及特别需要关注的点等几个维度对表空间进行一些介绍.本文以介绍表空间为主,涉及到的其他概念不展开描述.有问题的地 ...
- Oracle表空间(tablespaces)
http://www.cnblogs.com/fnng/archive/2012/08/12/2634485.html 我们知道oarcle数据库真正存放数据的是数据文件(data files),Oa ...
- 14.5.7 Storing InnoDB Undo Logs in Separate Tablespaces 存储InnoDB Undo logs 到单独的表空间
14.5.7 Storing InnoDB Undo Logs in Separate Tablespaces 存储InnoDB Undo logs 到单独的表空间 在MySQL 5.6.3,你可以存 ...
- oracle 表空间Tablespaces
1.表空间 一个数据库可以有多个表空间,一个表空间里可以有多个表.表空间就是存多个表的物理空间: 可以指定表空间的大小位置等. 创建表空间:create tablespace ts1 datafile ...
随机推荐
- python2和python3中的类
经典类与新式类 例如: A B C D 四个类 D 包含 BC : B和C分别包含A py2 在经典类中是按深度优先来继承 例如: D中查找B,B没有从A中查找 新式类中是按广度优先来查找继承的 ...
- EF查询百万级数据的性能测试--多表连接复杂查询
相关文章:EF查询百万级数据的性能测试--单表查询 一.起因 上次做的是EF百万级数据的单表查询,总结了一下,在200w以下的数据量的情况(Sql Server 2012),EF是可以使用,但是由于 ...
- JAVA中Socket的用法模拟服务端和客户端
<看透springMvc源代码分析与实践>学习笔记 Socket分为ServerSocket和Socket两个大类 ServerSocket用于服务端,可以通过accept方法监听请求,监 ...
- MongoDB入门解析【学习记录】
刚开始学习mongodb,对笔记做了一个整理.是基于nodejs来学习的. 1.mongodb介绍 mongodb 是C++语言编写的,是一个基于分布式文件存储的开源数据库系统. 在高负载的情况下,添 ...
- 使用Linux环境变量
bash shell用一个叫做环境变量的特性来存储有关shell会话和工作环境的信息. 全局环境变量 这对shell 会话和所有生成的子shell都是可见的.局部变量只对创建他们的shell可见. 系 ...
- Android - 读取JSON文件数据
Android读取JSON文件数据 JSON - JavaScript Object Notation 是一种存储和交换文本信息的语法. JSON对象在花括号中书写.用逗号来分隔值. JSON数组在方 ...
- Loadrunner常用15种的分析点
性能测试的工具目前用的最多的就是LoadRunner和JMeter,性能测试重点在分析和解决, 下边列出了LR中常见的15种分析点,不知道如何分析性能,来看这里吧! Vusers:提供了生产负载的虚拟 ...
- iOS开发实战-基于SpriteKit的FlappyBird小游戏
写在前面 最近一直在忙自己的维P恩的事情 公司项目也是一团乱 于是...随手找了个游戏项目改了改就上线了,就当充数了. SpriteKit简介 SpriteKit是iOS 7之后苹果推出的2D游戏框架 ...
- 【PHP】this,self,parent的区别(转)
一. 定义&区别 self: 指向当前类的指针,self是不指向任何已经实例化的对象,一般self使用来指向类中的静态变量. this: 指向当前对象的指针,使用parent来调用父类的构造函 ...
- 用java写一个用户登陆界面
一.课堂测试源代码及其结果截图 用java的swing写一个用户登录界面,采用网格布局.源代码如下: /** * */package LiuLijia; import java.awt.CardLay ...