[20170910]imp参数buffer的简单探究2.txt

简介: [20170910]imp参数buffer的简单探究2.txt --//exp,imp已经很少在用,如果存在8i估计还会用一下,下面因为别人遇到升级忘记家buffer参数(8i),导致导入缓慢, --//当然还有许多因素,比如存在lob字段,不过还是简单探究参数buffer.

[20170910]imp参数buffer的简单探究2.txt

--//exp,imp已经很少在用,如果存在8i估计还会用一下,下面因为别人遇到升级忘记家buffer参数(8i),导致导入缓慢,
--//当然还有许多因素,比如存在lob字段,不过还是简单探究参数buffer.
--//上个星期做了参数buffer的简单探究,发现缓存大小除以记录的最大长度=每次插入记录数量.
--//忘记测试缺省是多少,补充测试看看.

1.环境:
SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

alter system set pga_aggregate_target=4G;
--//以前设置太小256M,因为测试环境,connect by方式建表经常报错,设置大一些.

create table t(x number, x2 varchar2(1000),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);

SCOTT@book> @ &r/tpt/seg2 scott.t
    SEG_MB OWNER SEGMENT_NAME SEG_PART_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS     HDRFIL     HDRBLK
---------- ----- ------------ ------------- ------------ ------------------- ------ ---------- ----------
       234 SCOTT T                          TABLE        USERS                29952          4        546

--//234M.


2.导出:
$ exp scott/book tables=T file=t.dmp direct=y buffer=1280000
Export: Release 11.2.0.4.0 - Production on Fri Sep 8 11:48:29 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Direct Path ...
. . exporting table                              T    1000000 rows exported
Export terminated successfully without warnings.

3.测试导入:

--//如果检索NESTED_TABLE_SET_REFS,可以找到imp导入执行如下语句.
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"         1935
              ) VALUES (:1, :2, :3)

SCOTT@book> alter system flush shared_pool;
System altered.

SCOTT@book> select sql_id,sql_text,executions from v$sql where sql_id='62m8tgc8mhwr2';
no rows selected

--//开始测试不同buffer数量的情况:
alter table t rename to t1;
//drop table t purge ;
alter system flush shared_pool;

--//导入不设置buffer参数量.
$ imp scott/book tables=T file=t.dmp

Import: Release 11.2.0.4.0 - Production on Mon Sep 11 09:02:19 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via direct path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into SCOTT
. importing SCOTT's objects into SCOTT
. . importing table                            "T"    1000000 rows imported
Import terminated successfully without warnings.
--//导入很慢.

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"      66667
              ) VALUES (:1, :2, :3)

--//前面测试buffer=N,不同N的表格:

N             EXECUTIONS
----------------------------------
8388608       242
4194304       484
2097152       968
1048576       1935
524288        3876
-----------------------------------

--//1000000/66667=14.999925000374998125,每次15条
--//2022*15=30330
--//大约30*1024=30720

--//反向测试看看:
SCOTT@book> alter system flush shared_pool;
System altered.

SCOTT@book> select sql_id,sql_text,executions from v$sql where sql_id='62m8tgc8mhwr2';
no rows selected

SCOTT@book> drop table t purge;
Table dropped.

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

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"      66667
              ) VALUES (:1, :2, :3)


--//基本一致.这也基本验证我的推断,为什么是30K不是很清楚,如果换1个表也许不对.放弃!!

目录
相关文章
|
SQL Oracle 关系型数据库
跟着吕大师(VAGE)揭密隐含参数:_db_writer_coalesce_area_size
[size=13.913043975830078px]最近在看吕大师的大作《Oracle核心揭密》,这部大作可以与Jonathan Lewis大师的《Oracle Core_ Essential Internals for DBA》相提并论,看了几天收益颇多,哈哈美国有Lewis,中国有VAGE。
跟着吕大师(VAGE)揭密隐含参数:_db_writer_coalesce_area_size
|
SQL NoSQL Oracle
[20180305]手工模拟buffer busy wait.txt
[20180305]手工模拟buffer busy wait.txt --//一般出现buffer busy wait原因,主要是对热块,大量dml操作. --//一种提法:oracle读不会阻塞写,写不会阻塞读,实际上写一定程度会阻塞读,只不过时间很短罢了.
1132 0
|
Oracle 关系型数据库 Linux
[20180224]理解exp direct导出操作.txt
[20180224]理解exp direct导出操作.txt 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER -------------...
1085 0
|
SQL 缓存 Oracle
[20180226]exp buffer RECORDLENGTH.txt
[20180226]exp buffer RECORDLENGTH.txt --//虽然已经很少使用exp导致,如果加入direct=y参数,设置RECORDLENGTH参数能加快数据导出.
1261 0
|
Oracle 关系型数据库 SQL
[20171105]exp imp buffer参数解析.txt
[20171105]exp imp buffer参数解析.txt oracle官方所给的关于buffer的解释如下: https://docs.oracle.com/cd/A84870_01/doc/server.
1764 0
|
SQL Oracle 关系型数据库
[20170908]imp参数buffer的简单探究.txt
[20170908]imp参数buffer的简单探究.txt --//exp,imp已经很少在用,如果存在8i估计还会用一下,下面因为别人遇到升级忘记家buffer参数(8i),导致导入缓慢, --//当然还有许多因素,比如存在lob字段,不过还是简单探究参数buffer.
1302 0