博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[20171105]exp imp buffer参数解析.txt
阅读量:6824 次
发布时间:2019-06-26

本文共 4644 字,大约阅读时间需要 15 分钟。

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

oracle官方所给的关于buffer的解释如下:

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认真看官方文档很重要..^_^.

转载地址:http://wvgzl.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
使用node-webkit开发exe窗口程序
查看>>
图解:双IP地址引起的网络故障
查看>>
C语言第三天(文件)
查看>>
MongoDB: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
查看>>
第二章 数据,变量和计算
查看>>
openwrt无线连接互联网的实现原理【2】
查看>>
禁止用户使用ctrl+alt+Fn进行tty1-ttyn切换的设置
查看>>
nginx+keepalived+proxy_cache 配置高可用nginx群集和高速缓存
查看>>
Spring cloud 熔断器Hystrix
查看>>
postfix 邮件集群方案(02)
查看>>
内建控制结构之不再使用break和continue
查看>>
自己写的一个JavaScrpt输入验证
查看>>
我的友情链接
查看>>
warning: no newline at end of file的原因
查看>>
tar 无法解压带冒号的文件
查看>>
linux设置mysql,apache,tomcat开机启动
查看>>
javascript(十一) 弹出窗口/自定义窗口
查看>>
Spark 装载 MySQL的数据
查看>>
Win10 远程桌面 连上就断开
查看>>