[20171105]exp imp buffer参数解析.txt

[20171105]exp imp buffer参数解析.txt

oracle官方所给的关于buffer的解释如下:
https://docs.oracle.com/cd/A84870_01/doc/server.816/a76955/ch01.htm

BUFFER

Default: operating system-dependent. See your Oracle operating system-specific documentation to determine the default
value for this parameter.

Specifies the size, in bytes, of the buffer used to fetch rows. As a result, this parameter determines the maximum
number of rows in an array fetched by Export. Use the following formula to calculate the buffer size:

buffer_size = rows_in_array * maximum_row_size

If you specify zero, then the Export utility fetches only one row at a time.

Tables with columns of type LOBs, LONG, BFILE, REF, ROWID, LOGICAL ROWID, or DATE are fetched one row at a time.

Note:

The BUFFER parameter applies only to conventional path Export. It has no effect on a direct path Export. For direct path
Exports, use the RECORDLENGTH parameter to specify the size of the buffer that Export uses for writing to the export
file.

Example: Calculating Buffer Size

This section shows an example of how to calculate buffer size.

The following table is created:

CREATE TABLE sample (name varchar(30), weight number);

The maximum size of the name column is 30, plus 2 bytes for the indicator. The maximum size of the weight column is 22
(the size of the internal representation for Oracle numbers), plus 2 bytes for the indicator.

Therefore, the maximum row size is 56 (30+2+22+2).

To perform array operations for 100 rows, a buffer size of 5600 should be specified.

--//才知道以前写的猜测胡乱蒙对了,链接:blog.itpub.net/267265/viewspace-2144708/
--//另外感觉这份文档有点旧(8.1.6),明显数据类型date应该不存在这样的问题.

Tables with columns of type LOBs, LONG, BFILE, REF, ROWID, LOGICAL ROWID, or DATE are fetched one row at a time.

--//我当时计算的行长度每个字段少考虑2个字节.
CREATE TABLE sample (name varchar(30), weight number);
The maximum size of the name column is 30, plus 2 bytes for the indicator. The maximum size of the weight column is 22
(the size of the internal representation for Oracle numbers), plus 2 bytes for the indicator.

Therefore, the maximum row size is 56 (30+2+22+2).

To perform array operations for 100 rows, a buffer size of 5600 should be specified.

--//如果考虑2个字节,计算结果会更加接近.比如上次测试的例子:

create table t(x number, x2 varchar2(2000),x3 varchar2(1000))  SEGMENT CREATION IMMEDIATE;
insert into t select level, rpad(' ', 100, ' '),rpad('a',100,'a') from dual connect by level <= 1e6;
commit ;
exec sys.dbms_stats.gather_table_stats ( OwnName => 'SCOTT',TabName => 't',Estimate_Percent => NULL,Method_Opt => 'FOR
ALL COLUMNS SIZE 1 ',Cascade => True ,No_Invalidate => false);

$ exp scott/book tables=T file=t.dmp direct=y buffer=1280000
...

alter table t rename to t1;
//drop table t purge ;
alter system flush shared_pool;

$ imp scott/book tables=T file=t.dmp  buffer=1048576

SCOTT@book> select sql_id,sql_text,executions from v$sql where sql_id='62m8tgc8mhwr2';
SQL_ID        SQL_TEXT                                                       EXECUTIONS
------------- ------------------------------------------------------------ ------------
62m8tgc8mhwr2 INSERT /*+NESTED_TABLE_SET_REFS+*/ INTO "T" ("X", "X2", "X3"         2891
              ) VALUES (:1, :2, :3)

1024*1024/(3022+6) = 346.29326287978863936591
1000000/346.29326287978863936591 = 2887.72583007812500000006
1000000/346=2890.1734104462427745664

--//按照这样推断插入是2890次(实际上剩下的零头算1次就是2891次),与实际的结果非常接近.

//drop table t purge;
//drop table t1 purge;
create table t(x number, x2 varchar2(2000),x3 varchar2(2000))  SEGMENT CREATION IMMEDIATE;
insert into t select level, rpad(' ', 100, ' '),rpad('a',100,'a') from dual connect by level <= 1e6;
commit ;
exec sys.dbms_stats.gather_table_stats ( OwnName => 'SCOTT',TabName => 't',Estimate_Percent => NULL,Method_Opt => 'FOR
ALL COLUMNS SIZE 1 ',Cascade => True ,No_Invalidate => false);

$ exp scott/book tables=T file=t.dmp direct=y buffer=1280000
...

alter table t rename to t1;
//drop table t purge ;
alter system flush shared_pool;

$ imp scott/book tables=T file=t.dmp  buffer=1048576

SCOTT@book> select sql_id,sql_text,executions from v$sql where sql_id='62m8tgc8mhwr2';
SQL_ID        SQL_TEXT                                                       EXECUTIONS
------------- ------------------------------------------------------------ ------------
62m8tgc8mhwr2 INSERT /*+NESTED_TABLE_SET_REFS+*/ INTO "T" ("X", "X2", "X3"         3847
              ) VALUES (:1, :2, :3)

1024*1024/(4022+6) = 260.32174776564051638530
1000000/260.32174776564051638530 = 3841.40014648437500000004
1000000/260=3846.15384615384615384615

--//按照这样推断插入是3847次,与实际的结果非常接近.

--//另外按照文档介绍使用直接路径导出以及导入,参数RECORDLENGTH才有用.

Note:

The BUFFER parameter applies only to conventional path Export. It has no effect on a direct path Export. For direct path
Exports, use the RECORDLENGTH parameter to specify the size of the buffer that Export uses for writing to the export
file.

--//看来,学习oracle认真看官方文档很重要..^_^.

时间: 2024-07-30 10:48:25

[20171105]exp imp buffer参数解析.txt的相关文章

EXP/IMP全部参数 说明

(备注) -----EXP 全部参数说明 USERID 必须是命令行中的第一个参数. 关键字               说明 (默认)------------------------------------------------------------------------------ATTACH                连接到现有作业, 例如 ATTACH [=作业名].CONTENT               指定要卸载的数据, 其中有效关键字为:               

[20120410]EXP&amp;IMP和COMPRESS参数.txt

[20120410]EXP&IMP和COMPRESS参数.txt 测试需要要建立一个空库,我使用EXP&IMP操作,很久不使用它操作,发现导入过程有一些慢,最终发现一个参数compress影响导入操作.缺省COMPRESS=Y,这样在导入时需要初始很大的空间. 测试如下: SQL> select * from v$version ; BANNER ---------------------------------------------------------------------

[20140827]imp exp 使用管道迁移数据.txt

[20140827]imp exp 使用管道迁移数据.txt --最近帮别人升级一套数据库,9i到11g. --那个慢真让人受不了,也许是以前的老机器性能不行.数据量并不大.导出花了时间比较长. --我很久就知道导出可以管道压缩导出文件,实现一边导出一边压缩的功能,现在硬盘空间都很大,很少考虑这种方式. --而且现在很少使用这种方式备份数据. --是否可以使用管道实现一边导出一边导入呢?这样可以节约时间,我做了一个测试: --全部操作都在目的端进行,主要是exp/imp版本问题(烦),操作系统都

[20160803]exp/imp语法问题.txt

[20160803]exp/imp语法问题.txt --那个给我解析exp这种语法: 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ------------------------------------------------------------------------------

【exp/imp】将US7ASCII字符集的dmp文件导入到ZHS16GBK字符集的数据库中

[exp/imp]将US7ASCII字符集的dmp文件导入到ZHS16GBK字符集的数据库中   1.1  BLOG文档结构图     1.2  前言部分 1.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~: ① 如何将US7ASCII字符集的dmp文件导入到ZHS16GBK字符集的数据库中(重点,2种方法)? ② 从dmp文件可以获取到哪些信息?如何从dmp文件获取到dmp文件的字符集(重点,N种方法)? ③

Oracle exp/imp命令快速导入导出数据

用exp命令导出表结构,不导出表数据.只需在命令行里加一个参数rows=n即可.表示不导出表数据. exp username/pwd@sid file=d:databak.dmp owner=(user)rows=n ******************************************************************************************************************** oracle exp/imp命令详解 E:>ex

exp/imp 与 expdp/impdp 对比

原文转自:http://blog.csdn.net/tianlesoftware/article/details/6093973 一. exp/imp 与 expdp/impdp 对比  1.1 expdp/impdp调用Server端的API在执行操作,是数据库内部的job任务.可以远程使用,但是生成的dump 文件存在于服务器上的directory里.   1.2  exp/imp 与 expdp/impdp 的默认模式和原理不一样   1.2.1 exp/imp 不同模式原理 在metal

[20171117]参数filesystemio_options.txt

[20171117]参数filesystemio_options.txt --//前几天看别人的awr报表发现设置参数filesystemio_options=setall,问为什么?对方给出一个链接,某某人都是这样设置的, --//自己很无语,我希望对方能提出自己的见解. --//首先给出oracle官方的解析: https://docs.oracle.com/cd/E11882_01/server.112/e41573/os.htm#PFGRF94410 9.1.1.2 FILESYSTEM

EXP/IMP 学习(三)

1.3  优化1.  加快exp速度加大 large_pool_size,可以提高 exp的速度 采用直接路径的方式(direct=y),数据不需要经过内存进行整合和检查. 设置较大的 buffer,如果导出大对象,小 buffer会失败.export文件不在 ORACLE使用的驱动器上 不要 export到 NFS文件系统UNIX环境:用管道模式直接导入导出来提高 imp/exp的性能 2.  加快imp速度建立一个 indexfile,在数据 import完成后在建立索引将 import 文