比较数据泵和exp/imp对相同数据导出/导入的性能差异(二)
$ imp bys/bys file='/home/oracle/test.dmp' full=y ignore=y
Import: Release 11.2.0.1.0 - Production on Mon Jul 29 17:21:16 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing BYS's objects into BYS
. importing BYS's objects into BYS
. . importing table "TEST" 1280000 rows imported
Import terminated successfully without warnings.
[oracle@oel-01 ~]$ date
Mon Jul 29 17:22:55 CST 2013
2. impdp导入用时1分20秒。
BYS@ bys001>truncate table test;
Table truncated.
Elapsed: 00:00:00.12
BYS@ bys001>drop table test purge;
Table dropped.
Elapsed: 00:00:00.05
[oracle@oel-01 exp_dump]$ impdp bys/bys directory=exp_dump dumpfile=test.dmp
Import: Release 11.2.0.1.0 - Production on Mon Jul 29 17:39:08 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "BYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "BYS"."SYS_IMPORT_FULL_01": bys/******** directory=exp_dump dumpfile=test.dmp
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "BYS"."TEST" 111.6 MB 1280000 rows
Job "BYS"."SYS_IMPORT_FULL_01" successfully completed at 17:40:28
实验总结:
此次实验数据量不大,以上的每个工具的导入导出都测试两次,结果依然如上。
可能是因为数据量过小,导出时expdp比exp慢的较多。导入时impdp比imp快的也不太多。
EXPDP/IMPDP是Oracle推荐的数据泵导入导出工具,用于代替传统的EXP/IMP,只能在服务端使用,效率比EXP/IMP快几十倍,有续传功能和并行功能。
这个工具始于Oracle10g,从Oracle11g开始不再提供老的EXP/IMP的咨询但工具还可以使用。
EXPDP工具的效率差不多比EXP快几倍,IMPDP工具的效率差不多比IMP快几十倍,这两个工具适用于大数据导入导出的场景。
导出文件的格式更接近于数据库本身的文件格式,避免了数据写入文件时的转换
直接路径加载,跳过SGA内存区,直接加载到高水位线之后
元数据metadata和数据data在导出的过程中可以重叠进行,提高导出的效率。
在使用EXPDP/IMPDP之前需要定义一个目录对象,告知EXPDP/IMPDP工具导出的文件和导入的文件的存放目录