设为首页 收藏本站
查看: 661|回复: 0

[经验分享] oracle transport tablespace-pl

[复制链接]

尚未签到

发表于 2018-9-13 07:35:27 | 显示全部楼层 |阅读模式
  数据迁移的一种技术;
  数据迁移,就是将数据在数据库之间进行的传输;
  1.有哪些操作系统平台,支持传输表空间技术
  SYS@orcl11g> select * from v$transportable_platform order by 1;
  PLATFORM_ID PLATFORM_NAME                                      ENDIAN_FORMAT
  ----------- -------------------------------------------------- --------------
  1 Solaris[tm] OE (32-bit)                            Big
  2 Solaris[tm] OE (64-bit)                            Big
  3 HP-UX (64-bit)                                     Big
  4 HP-UX IA (64-bit)                                  Big
  5 HP Tru64 UNIX                                      Little
  6 AIX-Based Systems (64-bit)                         Big
  7 Microsoft Windows IA (32-bit)                      Little
  8 Microsoft Windows IA (64-bit)                      Little
  9 IBM zSeries Based Linux                            Big
  10 Linux IA (32-bit)                                  Little
  11 Linux IA (64-bit)                                  Little
  12 Microsoft Windows x86 64-bit                       Little
  13 Linux x86 64-bit                                   Little
  15 HP Open VMS                                        Little
  16 Apple Mac OS                                       Big
  17 Solaris Operating System (x86)                     Little
  18 IBM Power Based Linux                              Big
  19 HP IA Open VMS                                     Little
  20 Solaris Operating System (x86-64)                  Little
  21 Apple Mac OS (x86-64)                              Little
  20 rows selected.
  SYS@orcl11g> select platform_id,platform_name from v$database;
  PLATFORM_ID PLATFORM_NAME
  ----------- ------------------------------
  13 Linux x86 64-bit
  2.使用传输表空间技术的限制
  a.源库和目标库的数据库字符集必是兼容的;
  b.源库和目标库的国家字符集也必须是兼容的;
  c.目标库不能存在同名的表空间
  d.对于潜在的对象(物化视图,分区表)必须全部存在要传输的表空间集中;
  e.不能传输系统表空间,也不能传输包含sys用户对象的表空间
  3.传输表空间最小的版本需求
  *******************************************************************************
  传输表空间样例:
  1.创建样传输表空间
  SYS@orcl11g> create tablespace tbs_tran
  2  datafile '/u01/app/oracle/oradata/orcl11g/tbs_tran01.dbf'
  3  size 100m;
  Tablespace created.
  2.在表空间上创建一些表
  SYS@orcl11g> alter table hr.test move tablespace tbs_tran;
  SYS@orcl11g> alter table hr.regions move tablespace tbs_tran;
  3.查看源库和目标库的平台信息
  源库:orcl11g
  SYS@orcl11g> SELECT d.name,d.PLATFORM_NAME, ENDIAN_FORMAT
  2  FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d
  3* WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME
  SYS@orcl11g> /
  NAME   PLATFORM_NAME    ENDIAN_FORMAT
  --------- ------------------------------ --------------
  ORCL11G   Linux x86 64-bit   Little
  目标库:catdb
  SYS@catdb> col platform_name for a30
  SYS@catdb>  SELECT d.name,d.PLATFORM_NAME, ENDIAN_FORMAT
  2  FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d
  3* WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME
  NAME      PLATFORM_NAME                  ENDIAN_FORMAT
  --------- ------------------------------ --------------
  CATDB     Linux x86 64-bit             Little
  4.表空间的自包含检查
  --自包含检测的包
  SYS@orcl11g> exec dbms_tts.transport_set_check('tbs_tran',true);
  --查看检测结果
  SYS@orcl11g> select * from transport_set_violations;
  VIOLATIONS
  --------------------------------------------------------------------------------
  ORA-39908: Index HR.REG_ID_PK in tablespace EXAMPLE enforces primary constraints
  of table HR.REGIONS in tablespace TBS_TRAN.
  ORA-39908: Index HR.TEST_PK in tablespace USERS enforces primary constraints  of
  table HR.TEST in tablespace TBS_TRAN.
  --将错误修复
  SYS@orcl11g> alter index hr.reg_id_pk rebuild tablespace tbs_tran;
  SYS@orcl11g> alter index hr.test_pk rebuild tablespace tbs_tran;
  --再次检测
  SYS@orcl11g> exec dbms_tts.transport_set_check('tbs_tran',true);
  SYS@orcl11g> select * from transport_set_violations;
  no rows selected
  5.创建传输表空间集
  a.源表空间置为read only
  SYS@orcl11g> alter tablespace tbs_tran read only;
  b.导出传输表空间集的元数据信息
  --如果不存在目录对象,还要创建目录对象
  [oracle@db253 pumpdir]$ expdp system/oracle directory=pump_dir dumpfile=tbs_tran.dmp transport_tablespaces=tbs_tran
  [oracle@db253 pumpdir]$ ll -h tbs_tran.dmp
  -rw-r----- 1 oracle oinstall 136K Jun 28 16:15 tbs_tran.dmp
  6.把传输表空间集,拷贝到目标数据库所在的服务器
  包括传输表空间的元数据信息和表空间的数据文件;
  本例中包括:
  [oracle@db253 pumpdir]$ ll /home/oracle/pumpdir/tbs_tran.dmp
  -rw-r----- 1 oracle oinstall 139264 Jun 28 16:15 /home/oracle/pumpdir/tbs_tran.dmp
  [oracle@db253 pumpdir]$ ll /u01/app/oracle/oradata/orcl11g/tbs_tran01.dbf
  -rw-r----- 1 oracle oinstall 104865792 Jun 28 16:13 /u01/app/oracle/oradata/orcl11g/tbs_tran01.dbf
  --将表空间的数据文件,拷贝至目标数据库所在的路径
  [oracle@db253 pumpdir]$ cp /u01/app/oracle/oradata/orcl11g/tbs_tran01.dbf /u01/app/oracle/oradata/catdb/
  7.导入传输表空间
  a.目标库创建目录对象,读取表空间元数据信息
  SYS@catdb> create directory catdb_dir as '/home/oracle/pumpdir';
  b.将传输表空间集导入目标数据库
  --需要注意的问题
  && 目标库中必须存在和源库中同样的数据库模式
  && 如果不存在,那么,需要使用remap_schema
  [oracle@db253 ~]$ impdp system/oracle directory=catdb_dir dumpfile=tbs_tran.dmp transport_datafiles='/u01/app/oracle/oradata/catdb/tbs_tran01.dbf'
  或者
  [oracle@db253 orcl11g]$ impdp system/oracle directory=catdb_dir dumpfile=tbs_tran.dmp transport_datafiles='/u01/app/oracle/oradata/catdb/tbs_tran01.dbf' remap_schema=hr:new_hr
  8.将源库和目标库的表空间都重新设置为read write
  --源库的表空间
  SYS@orcl11g> alter tablespace tbs_tran read write;
  --目标库的表空间
  SYS@catdb> alter tablespace tbs_tran read write;
  ******************************
  官方文档样例:
  Oracle Database Administrator's Guide
  11g Release 2 (11.2)
  14 Managing Tablespaces
  -->Transporting Tablespaces Between Databases
  --> Example


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-577325-1-1.html 上篇帖子: Oracle数据库常用的操作命令 下篇帖子: oracle 日志挖掘
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表