Oracle的expdp/impdp工具和exp/imp工具比较
1.导入导出数据泵(expdp/impdp)是服务器端工具。所谓的服务器端工具,简单理解就是这样,你执行命令可以在服务器上,也可以在客户端做,但是命令其实是在oracle数据库里建job,所以,即使你的session断掉了,这个操作一样会继续,并最终完成。对于这个job,你还可以进入交互模式并加以控制,比如说,你发现导出操作执行比较慢,你可以进入交互界面修改并行度。
导入导出工具(exp/imp)是客户端工具。所谓客户端工具,简单理解就是这样,你执行命令可以在服务器上,也可以在客户端做,不过实际上oracle是通过这个建立起来的session来完成操作,一旦session终端,那么操作也会失败。
2.导入导出数据泵(expdp/impdp)是oracle
10g的新特性,他的文件格式采用XML。他的操作速度要远远快于exp/imp。
3.导入导出数据泵的数据只能存储在本地服务器目录,不管你从本地还是远程发起,oracle需要你首先创建目录对象,并授予用户正确的读写权限。
4.导入导出数据泵导出文件取数据库字符集,而exp/imp工具生成文件取的字符集受客户端环境变量NLS_LANG影响。
5.不管是数据泵(expdp/impdp)也好,还是导入导出工具(exp/imp),都可以作为逻辑备份的工具使用,注意,只是逻辑备份。
6.数据泵(expdp/impdp)和导入导出工具(exp/imp)也可以作为数据迁移和数据升级的工具来使用,基本上遵循向下兼容的原则,简单来说,就是低版本不认识高版本的工具,但是高版本认识低版本的,仔细体会。
7.Oracle10g的外部表可以通过SqlLoader实现
,也可以通过数据泵datapump来实现。
*******************************************************************************
下面是一个小例子 ,仅供参考,通过比较 ,你可以发现这两个工具的不同,注意红色部分的区别。
客户端 :windows
7 ip:192.168.56.21
服务器 :RH55 ip:192.168.56.101
Oracle版本: Oracle 11g
使用用户:scott 表 :emp
服务器端directory目录对象:dump_dir 用户scott对目录有读写的权限
sys@PROD>create or replace directory
dump_dir as '/arch/dump/';
Directory created.
sys@PROD>grant read,write on directory
dump_dir to scott;
Grant succeeded.
[oracle@RH55_11g ~]$expdp scott/tiger dumpfile=ab.dump tables=emp
directory=dump_dir
Export: Release 11.2.0.3.0 - Production on Fri
Oct 31 02:16:31 2014
Copyright (c) 1982, 2011, Oracle and/or its
affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise
Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security,
OLAP, Data Mining,
Oracle Database Vault and Real Application
Testing options
Starting
"SCOTT"."SYS_EXPORT_TABLE_01": scott/******** dumpfile=ab.dump tables=emp
directory=dump_dir
Estimate in progress using BLOCKS method...
Processing object type
TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type
TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type
TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type
TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported
"SCOTT"."EMP" 8.562 KB 14 rows
Master table
"SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
/arch/dump/ab.dump
Job
"SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at
02:16:44
-----------------------------------------------------分割线-----------------------------------------------------
exp工具
语句举例:
exp username/password file=... dmp tables=table_name log=... log
imp username/password file=...dmp fromuser=user1 touser=user1
或 imp username/password file=...dmp tables=table_name
[oracle@RH55_11g ~]$exp scott/tiger file=/arch/a.dmp tables=emp
Export: Release 11.2.0.3.0 - Production on Fri
Oct 31 02:22:55 2014
Copyright (c) 1982, 2011, Oracle and/or its
affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise
Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security,
OLAP, Data Mining,
Oracle Database Vault and Real Application
Testing option
Export done in US7ASCII character set and AL16UTF16
NCHAR character set
server uses ZHS16GBK character set (possible
charset conversion)
About to export specified tables via Conventional
Path ...
. . exporting table EMP 14 rows exported
Export terminated successfully without warnings.
附:数据泵的一些简单操作
http://blog.sina.com.cn/s/blog_69e7b8d70101223k.html
http://blog.sina.com.cn/s/blog_69e7b8d70100zkc7.html