---
title: "【转】oracle imp/exp 和 impdp/expdp的区别"
author: "秋日春朝"
date: "2011-12-08T10:48:26Z"
tags: []
categories: ["数据库"]
slug: "oracle-imp-exp-impdp-expdp"
draft: false
lastmod: "2011-12-08T10:48:26Z"
id: 1297451
url: "https://qhltj.iteye.com/blog/1297451"
---

一、用法区别

1：把用户usera的对象导到用户userb,用法区别在于fromuser=usera touser=userb ,remap\_schema='usera':'usera' 。例如:imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log;  
impdp system/passwd directory=expdp dumpfile=expdp.dmp remap\_schema='usera':'userb' logfile=/oracle/exp.log;

2：更换表空间，用exp/imp的时候，要想更改表所在的表空间，需要手工去处理一下，  
如alter table xxx move tablespace\_new之类的操作。  
用impdp只要用remap\_tablespace='tabspace\_old':'tablespace\_new'

3：当指定一些表的时候，使用exp/imp 时，tables的用法是 tables=('table1','table2','table3')。  
expdp/impdp的用法是tables='table1','table2','table3'

4：是否要导出数据行  
exp　（ROWS=Y 导出数据行，ROWS=N 不导出数据行）  
expdp content（ALL:对象＋导出数据行，DATA\_ONLY：只导出对象，METADATA\_ONLY：只导出数据的记录）

5：expdp是[的新特性而且只能在](http://qhltj.iteye.com/admin/blogs/.:;)[**服务器**](http://hi.baidu.com/windbellxy/blog/item/:;)执行。而exp/imp是通用的。[**10g**](http://hi.baidu.com/windbellxy/blog/item/:;)

二、效率比较

[条件：单个表测试，1363292行记录，116.6 MB左右数据量。](http://qhltj.iteye.com/admin/blogs/.:;)[**测试**](http://hi.baidu.com/windbellxy/blog/item/:;)

使用并行expdp花费时间约43秒，语句：expdp scott/oracle dumpfile=big\_table.dmp directory=dpdata tables=big\_table job\_name=exptab parallel=4

使用正常的expdp（无parallel=4），花费时间约34秒，并行的差异可能需要更大数据量的测试。

exp直接路径导出约71秒，语句：exp scott/oracle file=big\_table3.dmp tables=big\_table direct=y  
exp常规路径（无direct=y）导出，约126秒，花费时间最长。

从效率比较上看，expdp是一般exp的4倍左右。而导出的文件大小，传统方式exp文件要大于expdp的文件大小，大约大出10M左右。