exp/imp与expdp/impdp对比及使用中的一些优化事项(一)

2014-11-24 08:49:01 · 作者: · 浏览: 1
exp/imp与expdp/impdp对比及使用中的一些优化事项
一. exp/imp 与 expdp/impdp 对比
1.1 expdp/impdp调用Server端的API在执行操作,是 数据库内部的job任务。可以远程使用,但是生成的dump 文件存在于服务器上的directory里。
1.2 exp/imp 与 expdp/impdp 的默认模式和原理不一样
1.2.1 exp/imp 不同模式原理
在metalink的这边文章中,提到了exp/imp的不同模式下的工作原理:
Parameter DIRECT: Conventional Path Export Versus Direct Path Export [ID 155477.1]
Starting with Oracle7 release 7.3, the Export utility provides two methods for exporting table data:
- Conventional Path Export
- Direct Path Export
(1) Conventional path Export.
Conventional path Export uses the SQL SELECT statement to extract data from tables. Data is read from disk into the buffer cache, and rows are transferred to the eva luating buffer. The data, after passing expression eva luation, is transferred to the Export client, which then writes the data into the export file.
exp/imp 默认会是传统路径,这种模式下,是用SELECT 将数据查询出来,然后写入buffer cache,在将这些记录写入eva luate buffer. 最后传到Export客户端,在写入dump文件。
(2) Direct path Export.
When using a Direct path Export, the data is read from disk directly into the export session's program global area (PGA): the rows are transferred directly to the Export session's private buffer. This also means that the SQL command-processing layer (eva luation buffer) can be bypassed, because the data is already in the format that Export expects. As a result, unnecessary data conversion is avoided. The data is transferred to the Export client, which then writes the data into the export file.
The default is DIRECT=N, which extracts the table data using the conventional path.
This parameter is only applicable to the original export client. Export DataPump (expdp) uses a Direct Path unload by default and switches to External Table mode if required
直接路径模式下,数据直接从硬盘读取,然后写入PGA, 格式就是export 的格式,不需要转换,数据再直接传到export 客户端,写入dump 文件。这种模式没有经过eva luation buffer。 少了一个过程,导出速度提高也是很明显。
1.2.2 expdp/impdp 不同模式
Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data [ID 552424.1]
The two most commonly used methods to move data in and out of databases with Data Pump are the "Direct Path" method and the "External Tables" method.
(1)Direct Path mode.
After data file copying, direct path is the fastest method of moving data. In this method, the SQL layer of the database is bypassed and rows are moved to and from the dump file with only minimal interpretation. Data Pump automatically uses the direct path method for loading and unloading data when the structure of a table allows it.
(2)External Tables mode.
If data cannot be moved in direct path mode, or if there is a situation where parallel SQL can be used to speed up the data move even more, then the external tables mode is used. The external table mechanism creates an external table that maps the dump file data for the database table. The SQL engine is then used to move the data. If possible, the APPEND hint is used on import to speed the copying of the data into the database.
Note: When the Export NETWORK_LINK parameter is used to specify a network link for an export operation, a variant of the external tables method is used. In this case, data is selected from across the specified network link and inserted into the dump file using an external table.
(3)Data File Copying mode.
This mode is used when a transport tablespace job is started, i.e.: the TRANSPORT_TABLESPACES parameter is speci