在ORACLE数据库间移动或复制表空间测试
2010-08-12 14:13
246 查看
做了个移动表空间的测试
我想把数据库orcl里面的某个表空间,移到另一个数据库epma
先建一些表空间,以及用户
create tablespace tts1 datafile 'D:\ORADATA\ORCL\TTS1.DBF' SIZE 10M
autoextend on next 10M maxsize unlimited
segment space management auto
extent management local ;
create user tts identified by tts default tablespace tts1
temporary tablespace temp quota unlimited on tts1 ;
grant connect ,resource to tts ;
建一些测试的表
create table testtts(id number,name varchar2(10)) ;
alter table testtts add constraint pk_testtts primary key(id) using index tablespace tts1 ;
select * from user_indexes ;
首先把要转移的表设置为只读
alter tablespace tts1 read only ;
select * from dba_directories ;
用如下语句导出元数据信息
set ORACLE_SID=orcl
expdp directory=DATA_PUMP_DIR TRANSPORT_TABLESPACES=tts1 dumpfile=tts1.dump
下面是cmd里面的详细过程:
C:\Documents and Settings\lisx>expdp directory=DATA_PUMP_DIR TRANSPORT_TABLESPACES=y tablespaces=tts
1 dumpfile=tts1.dump
Export: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:15:28
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
UDE-00010: 已请求多个作业模式, tablespace 和 transport_tablespaces。
上面的语句报错,原来expdp转移表空间和exp是有区别的,exp的格式是
EXP transport_tablespace=y tablespaces=tts1,tts2 file=expdat.dmp
注意transport_tablespace后面没有s,不是复数形式的
而用expdp的正确的导出如下:
C:\Documents and Settings\lisx>expdp directory=DATA_PUMP_DIR TRANSPORT_TABLESPACES=tts1 dumpfile=tts
1.dump
Export: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:16:06
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
启动 "SYS"."SYS_EXPORT_TRANSPORTABLE_01": sys/******** AS SYSDBA directory=DATA_PUMP_DIR TRANSPORT_
TABLESPACES=tts1 dumpfile=tts1.dump
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/INDEX
处理对象类型 TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
已成功加载/卸载了主表 "SYS"."SYS_EXPORT_TRANSPORTABLE_01"
******************************************************************************
SYS.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:
D:\ADMIN\ORCL\DPDUMP\TTS1.DUMP
作业 "SYS"."SYS_EXPORT_TRANSPORTABLE_01" 已于 11:16:41 成功完成
下面导入到新的数据库epma
set ORACLE_SID=epma
impdp directory=DATA_PUMP_DIR dumpfile=TTS1.DUMP TRANSPORT_DATAFILES='D:\oradata\epma\TTS1.DBF'
C:\Documents and Settings\lisx>impdp directory=DATA_PUMP_DIR dumpfile=TTS1.DUMP TRANSPORT_DATAFILES=
'D:\oradata\epma\TTS1.DBF'
Import: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:29:16
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: 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/******** AS SYSDBA directory=DATA_PUMP_DIR dumpfile=T
TS1.DUMP TRANSPORT_DATAFILES='D:\oradata\epma\TTS1.DBF'
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: 数据泵可传输的表空间作业中止
ORA-29342: 数据库中不存在用户 TTS
作业 "SYS"."SYS_IMPORT_TRANSPORTABLE_01" 因致命错误于 11:29:26 停止
一定要先建用户TTS,否则报错
create user tts identified by tts ;
grant connect ,resource to tts ;
C:\Documents and Settings\lisx>impdp directory=DATA_PUMP_DIR dumpfile=TTS1.DUMP TRANSPORT_DATAFILES=
'D:\oradata\epma\TTS1.DBF'
Import: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:30:51
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: 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/******** AS SYSDBA directory=DATA_PUMP_DIR dumpfile=T
TS1.DUMP TRANSPORT_DATAFILES='D:\oradata\epma\TTS1.DBF'
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/INDEX
处理对象类型 TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
作业 "SYS"."SYS_IMPORT_TRANSPORTABLE_01" 已于 11:31:10 成功完成
**/
查看发现原来表空间里面的内容果然导入到新的表空间里面了
select * from user_indexes ;
查看状态也是只读
select * from dba_tablespaces ;
select * from dba_data_files ;
alter tablespace tts1 read write ;
我想把数据库orcl里面的某个表空间,移到另一个数据库epma
先建一些表空间,以及用户
create tablespace tts1 datafile 'D:\ORADATA\ORCL\TTS1.DBF' SIZE 10M
autoextend on next 10M maxsize unlimited
segment space management auto
extent management local ;
create user tts identified by tts default tablespace tts1
temporary tablespace temp quota unlimited on tts1 ;
grant connect ,resource to tts ;
建一些测试的表
create table testtts(id number,name varchar2(10)) ;
alter table testtts add constraint pk_testtts primary key(id) using index tablespace tts1 ;
select * from user_indexes ;
首先把要转移的表设置为只读
alter tablespace tts1 read only ;
select * from dba_directories ;
用如下语句导出元数据信息
set ORACLE_SID=orcl
expdp directory=DATA_PUMP_DIR TRANSPORT_TABLESPACES=tts1 dumpfile=tts1.dump
下面是cmd里面的详细过程:
C:\Documents and Settings\lisx>expdp directory=DATA_PUMP_DIR TRANSPORT_TABLESPACES=y tablespaces=tts
1 dumpfile=tts1.dump
Export: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:15:28
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
UDE-00010: 已请求多个作业模式, tablespace 和 transport_tablespaces。
上面的语句报错,原来expdp转移表空间和exp是有区别的,exp的格式是
EXP transport_tablespace=y tablespaces=tts1,tts2 file=expdat.dmp
注意transport_tablespace后面没有s,不是复数形式的
而用expdp的正确的导出如下:
C:\Documents and Settings\lisx>expdp directory=DATA_PUMP_DIR TRANSPORT_TABLESPACES=tts1 dumpfile=tts
1.dump
Export: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:16:06
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
启动 "SYS"."SYS_EXPORT_TRANSPORTABLE_01": sys/******** AS SYSDBA directory=DATA_PUMP_DIR TRANSPORT_
TABLESPACES=tts1 dumpfile=tts1.dump
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/INDEX
处理对象类型 TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
已成功加载/卸载了主表 "SYS"."SYS_EXPORT_TRANSPORTABLE_01"
******************************************************************************
SYS.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:
D:\ADMIN\ORCL\DPDUMP\TTS1.DUMP
作业 "SYS"."SYS_EXPORT_TRANSPORTABLE_01" 已于 11:16:41 成功完成
下面导入到新的数据库epma
set ORACLE_SID=epma
impdp directory=DATA_PUMP_DIR dumpfile=TTS1.DUMP TRANSPORT_DATAFILES='D:\oradata\epma\TTS1.DBF'
C:\Documents and Settings\lisx>impdp directory=DATA_PUMP_DIR dumpfile=TTS1.DUMP TRANSPORT_DATAFILES=
'D:\oradata\epma\TTS1.DBF'
Import: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:29:16
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: 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/******** AS SYSDBA directory=DATA_PUMP_DIR dumpfile=T
TS1.DUMP TRANSPORT_DATAFILES='D:\oradata\epma\TTS1.DBF'
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: 数据泵可传输的表空间作业中止
ORA-29342: 数据库中不存在用户 TTS
作业 "SYS"."SYS_IMPORT_TRANSPORTABLE_01" 因致命错误于 11:29:26 停止
一定要先建用户TTS,否则报错
create user tts identified by tts ;
grant connect ,resource to tts ;
C:\Documents and Settings\lisx>impdp directory=DATA_PUMP_DIR dumpfile=TTS1.DUMP TRANSPORT_DATAFILES=
'D:\oradata\epma\TTS1.DBF'
Import: Release 10.2.0.1.0 - Production on 星期四, 12 8月, 2010 11:30:51
Copyright (c) 2003, 2005, Oracle. All rights reserved.
用户名: sys as sysdba
口令:
连接到: 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/******** AS SYSDBA directory=DATA_PUMP_DIR dumpfile=T
TS1.DUMP TRANSPORT_DATAFILES='D:\oradata\epma\TTS1.DBF'
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/INDEX
处理对象类型 TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
作业 "SYS"."SYS_IMPORT_TRANSPORTABLE_01" 已于 11:31:10 成功完成
**/
查看发现原来表空间里面的内容果然导入到新的表空间里面了
select * from user_indexes ;
查看状态也是只读
select * from dba_tablespaces ;
select * from dba_data_files ;
alter tablespace tts1 read write ;
相关文章推荐
- 移动Oracle数据库表空间文件。
- 记录:移动Oracle数据库表空间文件
- oracle数据库文件移动(复制)另一个目录(主机)上重新启动的方法
- 移动Oracle数据库的表空间方法介绍
- 移动Oracle数据库的表空间方法
- 记录:移动Oracle数据库表空间文件
- 将Oracle数据库审计相关的表移动到其他表空间
- ant学习记录(复制-移动-删除-依赖综合测试)+fileset
- 怎样移动Oracle数据库的表空间
- 移动Oracle数据库的表空间方法介绍
- linux下移动Oracle数据库表空间文件
- 用SPExport和SPImport复制或移动SharePoint网站
- 同一数据库中复制数据表。未测试完成
- ubuntu上eclipse无法使用复制行并上/下移动热键 Ctrl + Alt + Up/Down
- 复制图纸空间的视口到另一个dwg文件中
- 移动客户端测试的一份思维导图
- 单机环境下MongoDB复制集测试步骤
- 边做移动测试边看“示波器”--Android测试工具ThreadingTest带给你不一样的移动测试体验
- Goldengate单向大事务复制性能测试
- Linux 入门常用命令 — 文件的复制、删除和移动