使用exp和imp搬移表空间

来源:互联网 发布:电子相册视频软件 编辑:程序博客网 时间:2024/04/28 04:23

1 条件限制

l  要求源数据库和目标数据库必须具有相同的数据库字符集和民族字符集(nls_database_parameters

l  不能将表空间搬移到具有同名表空间的目标数据库中(如同名用alter tablespace rename修改)

l  不能搬移system表空间和sys用户对象所在的表空间

l  如果将表空间搬移到其他OS平台,必须把初始化参数compatible设为10.0以上

2 例子

下面以在windows平台上将demo数据库的user02表空间搬移到ORCL数据库中为例子:

2.1 确定自包含表空间集合

execute sys.dbms_tts.transport_set_check('user02',true)

select * from sys.transport_set_violations;---如果没有返回信息,说明是自包含。

2.2 生成要搬移的表空间集合

alter tablespace user02 read only---设为只读

host exp 'sys/oracle@demo as sysdba' transport_tablespace=y tablespaces=user02 file=a.dmp

2.3 传送转储文件和数据文件到目标数据库

host copy d:/demo/users02.dbf d:/oracle/oradata/orcl/user02.dbf(假如demoorcl数据库在同一机器上)

2.4 插入表空间到目标数据库

alter system set db_cache_size=20m;

alter system set db_4k_cache_size=4m;

host imp 'sys/oracle@demo as sysdba' transport_tablespace=y file=a.dmp datafile=d:/oracle/oradata/orcl/user02.dbf'

alter tablespace user02 read write

原创粉丝点击