当前位置: 首页 > news >正文

海量数据迁移之传输表空间(一) (r5笔记第71天)

在自己接触的很多的数据迁移工作中,使用外部表在一定程度上达到了系统的预期,对于增量,批量的数据迁移效果还是不错的,但是也不能停步不前,在很多限定的场景中,有很多物理迁移中使用传统方法还是相当不错的,传输表空间就是一个样例。最近的有一个数据迁移任务是需要把一些全新的数据表迁移到另外一个库中,因为这些表在目标库中不存在,所以使用逻辑迁移就显得有些力不从心了。尽管在速度可以接受的情况下,最大的痛处就是大量的归档文件了。因为需要在原有的schema下增加一些全新的数据表,不是很肯定传输表空间的校验是否能够完全支持。所以在给出方案之前还是做了做测试,达到了预期的想法。为了对比清晰,我创建了两个全新的表空间,然后创建一个用户,创建两个表,制定到两个不同的表空间下,然后使用exp使用传输表空间模式导出,然后拷贝数据文件,导入,为了简单验证,就在同一个实例下做了测试。唯一多出来的步骤就是做一些简单的清理。--数据准备创建两个表空间 create tablespace test_new datafile '/u02/ora11g/oradata/TEST11G/test_new01.dbf' size 10M; create tablespace test_old datafile '/u02/ora11g/oradata/TEST11G/test_old01.dbf' size 10M;创建一个用户create user test_tts identified by oracle default tablespace test_old;grant connect,resource to test_tts;然后创建两个表制定不同的表空间create table test1 tablespace test_new as select *from all_objects where rownum<1000;create table test2 tablespace test_old as select *from all_objects where rownum<100;可以简单验证一下数据情况。select count(*)from test1;select count(*)from test2;然后查看user_tables简单验证一下表所处的表空间select tablespace_name,table_name from user_tables;TABLESPACE_NAME TABLE_NAME------------------------------ ------------------------------TEST_NEW TEST1TEST_OLD TEST2----表空间传输检查在导出之前,使用dbms_tts做一下检查,在这个例子中是没有问题的。exec dbms_tts.transport_set_check('TEST_NEW',TRUE);使用给定的视图来查看是否有传输的限制。select *from transport_set_violations;--表空间传输导出导出时需要指定表空间为只读模式alter tablespace test_new read only;[ora11g@oel1 ~]$ exp \'sys/oracle as sysdba\' file=test_new.dmp transport_tablespace=y tablespaces=test_new log=test_new_tts.logExport: Release 11.2.0.1.0 - Production on Wed Jun 17 18:26:17 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsExport done in AL32UTF8 character set and AL16UTF16 NCHAR character setNote: table data (rows) will not be exportedAbout to export transportable tablespace metadata...For tablespace TEST_NEW .... exporting cluster definitions. exporting table definitions. . exporting table TEST1. exporting referential integrity constraints. exporting triggers. end transportable tablespace metadata exportExport terminated successfully without warnings. --额外的步骤,做一下简单的备份和数据清理。因为在同一个实例中实验,所以需要备份一下,然后把数据删除。 备份:cp /u02/ora11g/oradata/TEST11G/test_new01.dbf /u02/ora11g/oradata/TEST11G/test_new01.dbf1 清理drop table TEST1 purge;drop tablespace test_new including contents and datafiles cascade constraint简单验证是否数据文件存在,需要确定数据文件的句柄已经释放。sys@TEST11G> !ls -l /u02/ora11g/oradata/TEST11G/test_new01.dbfls: /u02/ora11g/oradata/TEST11G/test_new01.dbf: No such file or directory然后重命名数据文件,把原有的备份恢复。这个时候数据文件就回来了。!mv /u02/ora11g/oradata/TEST11G/test_new01.dbf1 /u02/ora11g/oradata/TEST11G/test_new01.dbf!ls -l /u02/ora11g/oradata/TEST11G/test_new01.dbf--表空间导入 imp \'sys/oracle as sysdba\' file=test_new.dmp transport_tablespace=y tablespaces=test_new datafiles=/u02/ora11g/oradata/TEST11G/test_new01.dbfImport: Release 11.2.0.1.0 - Production on Wed Jun 17 18:42:47 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsExport file created by EXPORT:V11.02.00 via conventional pathAbout to import transportable tablespace(s) metadata...import done in AL32UTF8 character set and AL16UTF16 NCHAR character set. importing SYS's objects into SYS. importing SYS's objects into SYS. importing TEST_TTS's objects into TEST_TTS. . importing table "TEST1". importing SYS's objects into SYSImport terminated successfully without warnings.--迁移后的补充迁移后需要把表空间设置为read,write模式alter tablespace test_new read write;--数据检查select tablespace_name,table_name from user_tables;淡然了上面的步骤只是简单的一个常规步骤,其实还是有不少的细节考虑的,后面继续补充。

相关文章:

  • 数据刷新中的并行改进(r5笔记第72天)
  • 一条sql语句的建议调优分析(r5笔记第73天)
  • 泰国之旅随感(r1笔记第70天)
  • 曼谷周末游(r5笔记第74天)
  • 使用flashback query巧妙抽取指定数据(r5笔记第75天)
  • 数据刷新中的并行改进(二) (r5笔记第76天)
  • 养鱼生活的一段终结(r5笔记第77天)
  • oracle监控工具ignite使用图解(r5笔记第78天)
  • 数据刷新中的并行改进(三) (r5笔记第79天)
  • 浅谈exp/imp(上) (r5笔记第81天)
  • dataguard中MRP无法启动的问题分析和解决(r5笔记第82天)
  • tomcat源码编译和环境搭建(r5笔记第83天)
  • 浅谈exp/imp(下) (r5笔记第84天)
  • IT中的闰秒问题(r5笔记第85天)
  • 并行查询缓慢的问题分析(r5笔记第86天)
  • angular2开源库收集
  • Angular6错误 Service: No provider for Renderer2
  • ECMAScript6(0):ES6简明参考手册
  • es的写入过程
  • Node 版本管理
  • storm drpc实例
  • 从地狱到天堂,Node 回调向 async/await 转变
  • 第三十一到第三十三天:我是精明的小卖家(一)
  • 记录:CentOS7.2配置LNMP环境记录
  • 来,膜拜下android roadmap,强大的执行力
  • 配置 PM2 实现代码自动发布
  • 网络应用优化——时延与带宽
  • 微信小程序上拉加载:onReachBottom详解+设置触发距离
  • 400多位云计算专家和开发者,加入了同一个组织 ...
  • ​用户画像从0到100的构建思路
  • ​油烟净化器电源安全,保障健康餐饮生活
  • #我与Java虚拟机的故事#连载16:打开Java世界大门的钥匙
  • ${factoryList }后面有空格不影响
  • %check_box% in rails :coditions={:has_many , :through}
  • (0)Nginx 功能特性
  • (2)STM32单片机上位机
  • (pytorch进阶之路)CLIP模型 实现图像多模态检索任务
  • (Redis使用系列) Springboot 实现Redis消息的订阅与分布 四
  • (附源码)spring boot车辆管理系统 毕业设计 031034
  • (论文阅读11/100)Fast R-CNN
  • (一)python发送HTTP 请求的两种方式(get和post )
  • (已更新)关于Visual Studio 2019安装时VS installer无法下载文件,进度条为0,显示网络有问题的解决办法
  • (转) Android中ViewStub组件使用
  • .net 前台table如何加一列下拉框_如何用Word编辑参考文献
  • .NET 使用 ILRepack 合并多个程序集(替代 ILMerge),避免引入额外的依赖
  • .NET 使用配置文件
  • .NET单元测试
  • .NET命令行(CLI)常用命令
  • .NET中GET与SET的用法
  • .NET中winform传递参数至Url并获得返回值或文件
  • @Bean有哪些属性
  • @ModelAttribute使用详解
  • @RequestBody与@ResponseBody的使用
  • @RunWith注解作用
  • [1] 平面(Plane)图形的生成算法