一、数据导出
expdp test/test directory=dump_dir dumpfile=test.dmp logfile=test_expdp.log tables=userinfo
——利用expdp 语句导出具体数据,如果是导出整个用户下数据,去掉 tables 参数
二、把数据导入数据表空间
impdp test/test directory=dump_dir dumpfile=test.dmp logfile=impdp_data.log remap_tablespace=system:datatb exclude=index
注释:
remap_tablespace=system:datatb ——更换数据的原system表空间为datatb数据表空间
exclude=index ——导入过程中不创建索引,导入除索引外的其它所有对象
三、把索引创建到指定的索引表空间
impdp test/test directory=dump_dir dumpfile=test.dmp logfile=impdp_index.log remap_tablespace=system:idxtb include=index
注释:
remap_tablespace=system:idxtb 更换索引表空间
include=index 创建索引,仅仅导入索引
四、查询确认
select segment_name,tablespace_name from dba_segments where owner='TEST';
通过以上语句确认表数据和索引数据是否导入到指定的表空间中。
expdp test/test directory=dump_dir dumpfile=test.dmp logfile=test_expdp.log tables=userinfo
——利用expdp 语句导出具体数据,如果是导出整个用户下数据,去掉 tables 参数
二、把数据导入数据表空间
impdp test/test directory=dump_dir dumpfile=test.dmp logfile=impdp_data.log remap_tablespace=system:datatb exclude=index
注释:
remap_tablespace=system:datatb ——更换数据的原system表空间为datatb数据表空间
exclude=index ——导入过程中不创建索引,导入除索引外的其它所有对象
三、把索引创建到指定的索引表空间
impdp test/test directory=dump_dir dumpfile=test.dmp logfile=impdp_index.log remap_tablespace=system:idxtb include=index
注释:
remap_tablespace=system:idxtb 更换索引表空间
include=index 创建索引,仅仅导入索引
四、查询确认
select segment_name,tablespace_name from dba_segments where owner='TEST';
通过以上语句确认表数据和索引数据是否导入到指定的表空间中。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26589291/viewspace-1665331/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26589291/viewspace-1665331/
本文详细介绍如何使用 Oracle 的 expdp 和 impdp 命令进行数据迁移,包括数据导出、导入到不同表空间及索引重建的过程。文章还提供了实用的 SQL 查询语句来验证数据迁移的成功。

被折叠的 条评论
为什么被折叠?



