传输表空间实验

简介:
windows xp操作系统,从数据库study把表空间test传输到数据库test。
study用户连接到study库,在test表空间建表test_test
SQL> create table test_test(id number,name varchar2(10)) tablespace test
  2  /
Table created
 
SQL> insert into test_test values(1,'guojje')
  2  /
 
1 row inserted
 
SQL> commit
  2  /
把索引建到表空间user上
SQL> create index idx_test_test on test_test(id) tablespace users
  2  /
Index created
在USERS表空间上建users_test表
SQL> create table users_test(id number,name varchar2(10)) tablespace users
  2  /
 
Table created
 
SQL> insert into users_test values(1,'guojje_u')
  2  /
 
1 row inserted
 
SQL> commit
  2  /
把索引建到表空间test上
SQL> create index idx_users_test on users_test(id) tablespace test
  2  /
Index created
执行自包含检查,分两种,一般自包含与严格自包含。
执行一般自含检查:
SQL> exec sys.dbms_tts.TRANSPORT_SET_CHECK('test',true)
PL/SQL procedure successfully completed
 
SQL>  select * from sys.transport_set_violations
  2  /
 
VIOLATIONS
--------------------------------------------------------------------------------
Index STUDY.IDX_USERS_TEST in tablespace TEST points to table STUDY.USERS_TEST in tablespace USERS
显示说含有别人的索引。
执行严格检查:
SQL> exec sys.dbms_tts.TRANSPORT_SET_CHECK('test',true,true)
PL/SQL procedure successfully completed
SQL>  select * from sys.transport_set_violations
  2  /
VIOLATIONS
-----------------------------------------------------------------------------------------------------
Index STUDY.IDX_TEST_TEST in tablespace USERS points to table STUDY.TEST_TEST in tablespace TEST
Index STUDY.IDX_USERS_TEST in tablespace TEST points to table STUDY.USERS_TEST in tablespace USERS
显示说含有别人的索引,自已的索引在别人那儿。
只要满足一般自包含就可以,只是索引没有被传输到目的数据库。即自已的可以丢掉,但不能把别人的拿走.
C:\Documents and Settings\Administrator>expdp  study/study@mystudy dumpfile=test.
dmp directory=test transport_tablespaces=test
Export: Release 10.2.0.1.0 - Production on 星期六, 19 6月, 2010 22:19:29
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
启动 "STUDY"."SYS_EXPORT_TRANSPORTABLE_01":   study/********@mystudy dumpfile=tes
t.dmp directory=test transport_tablespaces=test
ORA-39123: 数据泵可传输的表空间作业中止
ORA-29335: 表空间 'TEST' 不为只读
作业 "STUDY"."SYS_EXPORT_TRANSPORTABLE_01" 因致命错误于 22:19:32 停止
表空间必须只读状态:
SQL> alter tablespace test read only
  2  /
Tablespace altered
C:\Documents and Settings\Administrator>expdp  study/study@mystudy dumpfile=test.
dmp directory=test transport_tablespaces=test
Export: Release 10.2.0.1.0 - Production on 星期六, 19 6月, 2010 22:20:59
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
启动 "STUDY"."SYS_EXPORT_TRANSPORTABLE_01":   study/********@mystudy dumpfile=tes
t.dmp directory=test transport_tablespaces=test
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
已成功加载/卸载了主表 "STUDY"."SYS_EXPORT_TRANSPORTABLE_01"
******************************************************************************
STUDY.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:
  D:\TEST\TEST.DMP
作业 "STUDY"."SYS_EXPORT_TRANSPORTABLE_01" 已于 22:21:12 成功完成
手工把数据文件拷过去,文件名可以更改。
C:\Documents and Settings\Administrator>impdp  'sys/system@test as sysdba' dumpfi
le=test.dmp directory=test transport_datafiles='D:\oracle\product\10.2.0\oradata
\TEST\DATAFILE\O1_MF_TEST_61SJGJ98_1.DBF'
Import: Release 10.2.0.1.0 - Production on 星期六, 19 6月, 2010 22:35:10
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
已成功加载/卸载了主表 "SYS"."SYS_IMPORT_TRANSPORTABLE_01"
启动 "SYS"."SYS_IMPORT_TRANSPORTABLE_01":   'sys/********@test AS SYSDBA' dumpfil
e=test.dmp directory=test transport_datafiles='D:\oracle\product\10.2.0\oradata\
TEST\DATAFILE\O1_MF_TEST_61SJGJ98_1.DBF'
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
作业 "SYS"."SYS_IMPORT_TRANSPORTABLE_01" 已于 22:35:13 成功完成
在数据库test上执行:
SQL> select * from study.test_test 
  2  /
 
        ID NAME
---------- ----------
         1 guojje
成功完成传输。
最后记得把两个库的test表空间都置入read write
SQL>alter tablespace test read, write.
备:
我的EM上执行空间传输时总报错,发现是在Convert datafile时出错,手工执行转换:
RMAN> convert tablespace TEST to platform 'Microsoft Windows IA (32-bit)'  format='D:\test\test.dbf' 报rman-20202:在恢复目录中未找到表空间。换其他表空间均正常。后来把表空间名改成TEST2,运行成功,可能RMAN把TEST当关键字了。

本文转自 anranran 51CTO博客,原文链接:http://blog.51cto.com/guojuanjun/335832

相关文章
|
Linux Windows
linux学习教程(六) 命令技巧小节
一、前言 又经过几天的视频和资料学习,还是选择视频学习,自己没静下来心,学习也是这么慢。都不好意思写出博客,但是作为复习和巩固还是希望写出来,大家能够指正和有一点帮助也满足了。
941 0
|
4天前
|
人工智能 运维 安全
|
2天前
|
人工智能 异构计算
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
|
9天前
|
人工智能 JavaScript 测试技术
Qwen3-Coder入门教程|10分钟搞定安装配置
Qwen3-Coder 挑战赛简介:无论你是编程小白还是办公达人,都能通过本教程快速上手 Qwen-Code CLI,利用 AI 轻松实现代码编写、文档处理等任务。内容涵盖 API 配置、CLI 安装及多种实用案例,助你提升效率,体验智能编码的乐趣。
818 109
|
3天前
|
机器学习/深度学习 人工智能 自然语言处理
B站开源IndexTTS2,用极致表现力颠覆听觉体验
在语音合成技术不断演进的背景下,早期版本的IndexTTS虽然在多场景应用中展现出良好的表现,但在情感表达的细腻度与时长控制的精准性方面仍存在提升空间。为了解决这些问题,并进一步推动零样本语音合成在实际场景中的落地能力,B站语音团队对模型架构与训练策略进行了深度优化,推出了全新一代语音合成模型——IndexTTS2 。
416 9
|
3天前
|
人工智能 测试技术 API
智能体(AI Agent)搭建全攻略:从概念到实践的终极指南
在人工智能浪潮中,智能体(AI Agent)正成为变革性技术。它们具备自主决策、环境感知、任务执行等能力,广泛应用于日常任务与商业流程。本文详解智能体概念、架构及七步搭建指南,助你打造专属智能体,迎接智能自动化新时代。