日期:2014-05-17  浏览次数:20973 次

exp.imp与expdp,impdp在用法上有什么不同?
1.语法有没有不同?
2.导出/导入数据是否只是速度上有区别?其他都一样?

------解决方案--------------------
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:只导出数据的记录)
A: exp/imp的使用 (服务器端和客户端都可以执行。并且备份文件可以在客户端产生。)

exp user/password@servicename file=dump.dmp
imp user/password@servicename fromuser=fuser touser=tuser file=dump.dmp


2: expdp/impdp的使用 (服务器端和客户端都可以执行。备份文件只能存在服务器里面。)

I:在使用expdp导出时在Oracle需要定义目录变量,在导出的时候需要制定这个变量。如果可以,你可以为每个用户都建立一个单独的备份目录。
SQL>create directory dmpdir_user1 as '/home/oracle/backup';
SQL>grant read,write on directory dmpdir_user1 to user1;
对了,操作系统内必须创建这个目录。在SQL命令行下,并不会产生这个目录的。
[oracle@kook ~]$ mkdir backup
如果你没有制定这个目录的话,默认exp导出存放的目录是$HOME/rdbms/log里面。至少我的是这样。很奇怪,为什么在这里。

II:执行导出导入命令
expdp user1/password@servicename schemas=user1 directory=dmpdir_user1 dumpfile=user1.dmp
impdp user2/password@servicename directory=dmpdir_user1 dumpfile=user1.dmp remap_schema=user1:user2 remap_tablespace=user1ts:user2ts
使用expdp/impdp最大的好处可以让我转换表空间。而exp/imp这个是不支持的。处理起来非常麻烦。
------解决方案--------------------
http://blog.csdn.net/viszl/article/details/6732066
------解决方案--------------------
expdp/impdp和exp/imp,可以在任意有ORACLE客户端的机器上执行,区别如下
exp/imp是真正的客户端程序,导出与导出都是操作客户端本地文件,相对比较慢
而expdp/impdp是运行在客户端,但是要求,导入导出的文件,必须是服务器上的,并且路径限制在ORACLE服务器中声明的DIRECTOR下,所以速度更快一些。两者参数基本上一致,但expdp/impdp更丰富一些。