作者们跟踪会话创立体系的经过,TRACE并捕捉跟踪文件中的绑定变量)

在条分缕析ORACLE的AW奥迪Q5报告时,发现SQL
ordered by Executions(记录了如约SQL的实施次数排序的TOP
SQL。该排序可以见见监察和控制范围内的SQL执行次数)下有3个SQL语句执行分外频仍,三个小时实施了上万次:

在解析ORACLE的AWHighlander报告时,发现SQL
ordered by Executions(记录了根据SQL的推行次数排序的TOP
SQL。该排序能够看出监控范围内的SQL执行次数)下有二个SQL语句执行相当频繁,二个钟头实施了上万次:

 

 

update
seq$ set increment$=:2, minvalue=:3, maxvalue=:4, cycle#=:5, order$=:6,
cache=:7, highwater=:8, audit$=:9, flags=:10 where obj#=:1

update
seq$ set increment$=:2, minvalue=:3, maxvalue=:4, cycle#=:5, order$=:6,
cache=:7, highwater=:8, audit$=:9, flags=:10 where obj#=:1

 

 

那正是说seq$那一个数据字典表是做怎么着用的吗?
其实那几个数目字典表是保存的是数据库下系列对象(SEQUENCE)的连锁新闻,而且它用来有限支撑种类的转移。如下所示,我们因此实验来证爱他美下,大家启用10046事件,跟踪一下对话(level=4
表示启用SQL_TRACE并捕捉跟踪文件中的绑定变量),我们跟踪会话创制类别的经过。下边测试环境为Oracle
11g

那就是说seq$这些数量字典表是做如何用的吗?
其实那个数目字典表是保存的是数据库下类别对象(SEQUENCE)的相关消息,而且它用来维护连串的成形。如下所示,大家通过试验来证澳优(Ausnutria Hyproca)下,大家启用10046事变,跟踪一下对话(level=4
表示启用SQL_TRACE并捕捉跟踪文件中的绑定变量),大家跟踪会话成立体系的长河。上面测试环境为Oracle
11g

 

 

SQL> show user;

USER is "TEST"

SQL> alter session set events '10046 trace name context forever, level 4';

 

Session altered.

 

SQL> create sequence my_sequence_test

  2  start with 1

  3  increment by 1

  4  maxvalue 999999999

  5  nocache;

 

Sequence created.

 

SQL> alter session set events '10046 trace name context off';

 

Session altered.

 

SQL> SELECT    a.VALUE

  2         || b.symbol

  3         || LOWER(c.instance_name)

  4         || '_ora_'

  5         || d.spid

  6         || '.trc' trace_file

  7    FROM (SELECT VALUE

  8            FROM v$parameter

  9           WHERE NAME = 'user_dump_dest') a,

 10         (SELECT SUBSTR (VALUE, -6, 1) symbol

 11            FROM v$parameter

 12           WHERE NAME = 'user_dump_dest') b,

 13         (SELECT instance_name

 14            FROM v$instance) c,

 15         (SELECT spid

 16            FROM v$session s, v$process p, v$mystat m

 17           WHERE s.paddr = p.addr AND s.SID = m.SID AND m.statistic# = 0) d

 18  /

 

TRACE_FILE

--------------------------------------------------------------------------------

/u01/app/oracle/diag/rdbms/gsp/gsp/trace/gsp_ora_28201.trc
SQL> show user;

USER is "TEST"

SQL> alter session set events '10046 trace name context forever, level 4';

 

Session altered.

 

SQL> create sequence my_sequence_test

  2  start with 1

  3  increment by 1

  4  maxvalue 999999999

  5  nocache;

 

Sequence created.

 

SQL> alter session set events '10046 trace name context off';

 

Session altered.

 

SQL> SELECT    a.VALUE

  2         || b.symbol

  3         || LOWER(c.instance_name)

  4         || '_ora_'

  5         || d.spid

  6         || '.trc' trace_file

  7    FROM (SELECT VALUE

  8            FROM v$parameter

  9           WHERE NAME = 'user_dump_dest') a,

 10         (SELECT SUBSTR (VALUE, -6, 1) symbol

 11            FROM v$parameter

 12           WHERE NAME = 'user_dump_dest') b,

 13         (SELECT instance_name

 14            FROM v$instance) c,

 15         (SELECT spid

 16            FROM v$session s, v$process p, v$mystat m

 17           WHERE s.paddr = p.addr AND s.SID = m.SID AND m.statistic# = 0) d

 18  /

 

TRACE_FILE

--------------------------------------------------------------------------------

/u01/app/oracle/diag/rdbms/gsp/gsp/trace/gsp_ora_28201.trc

 

 

[oracle@DB-Server trace]$ tkprof gsp_ora_28201.trc  anay_out_28201.txt aggreage=yes;

LRM-00101: unknown parameter name 'aggreage'

error during command line parsing, cannot continue.

[oracle@DB-Server trace]$ tkprof gsp_ora_28201.trc  anay_out_28201.txt aggregate=yes;

 

TKPROF: Release 11.2.0.1.0 - Development on Tue Aug 29 22:52:08 2017

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
[oracle@DB-Server trace]$ tkprof gsp_ora_28201.trc  anay_out_28201.txt aggreage=yes;

LRM-00101: unknown parameter name 'aggreage'

error during command line parsing, cannot continue.

[oracle@DB-Server trace]$ tkprof gsp_ora_28201.trc  anay_out_28201.txt aggregate=yes;

 

TKPROF: Release 11.2.0.1.0 - Development on Tue Aug 29 22:52:08 2017

 

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

 

 

 

 

使用tkprof将跟踪文件转换到可读格式的文书后,你会注意到:在开创系列时,会往数据字典表seq$中插入一条记下(其实创制种类的真面目正是在seq$和obj$中插入了一条记下),如下截图所示:

应用tkprof将跟踪文件转换到可读格式的文本后,你会小心到:在创建系列时,会往数据字典表seq$中插入一条记下(其实创立系列的真面目正是在seq$和obj$中插入了一条记下),如下截图所示:

 

 

图片 1

图片 2

 

 

 

 

tkprof格式化后的输出文件之中,没有绑定变量,在原有跟踪文件gsp_ora_28201.trc中,你能够见到相应绑定变量的值

tkprof格式化后的出口文件之中,没有绑定变量,在本来跟踪文件gsp_ora_28201.trc中,你能够观察相应绑定变量的值

 

 

 

 

图片 3

图片 4

 

 

 

 

选用下边脚本,你就会发现那一个都以对应类别对象的有个别音讯(类别对象的OBJECT_ID、MINVALUE、MAXVALUE、CACHE等等)

运用下边脚本,你就会意识那么些都是对应体系对象的一部分音信(系列对象的OBJECT_ID、MINVALUE、MAXVALUE、CACHE等等)

 

 

 

 

SQL> show user;

USER is "SYS"

SQL> select obj#,increment$,minvalue,maxvalue,cycle#,cache,highwater

  2  from seq$

  3  where obj#=97570;

 

      OBJ# INCREMENT$   MINVALUE   MAXVALUE     CYCLE#      CACHE  HIGHWATER

---------- ---------- ---------- ---------- ---------- ---------- ----------

     97570          1          1  999999999          0          0          1

 

SQL> select object_type,object_name from dba_objects

  2  where object_id=97570;

 

OBJECT_TYPE         OBJECT_NAME

-------------------  -----------------------------------------------

SEQUENCE            MY_SEQUENCE_TEST

 

SQL> select * from dba_sequences where sequence_name='MY_SEQUENCE_TEST';

 

SEQUENCE_OWNER SEQUENCE_NAME     MIN_VALUE  MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER

-------------- ---------------- ---------- ---------- ------------ - - ---------- -----------

TEST           MY_SEQUENCE_TEST          1  999999999            1 N N          0           1

 

SQL> 
SQL> show user;

USER is "SYS"

SQL> select obj#,increment$,minvalue,maxvalue,cycle#,cache,highwater

  2  from seq$

  3  where obj#=97570;

 

      OBJ# INCREMENT$   MINVALUE   MAXVALUE     CYCLE#      CACHE  HIGHWATER

---------- ---------- ---------- ---------- ---------- ---------- ----------

     97570          1          1  999999999          0          0          1

 

SQL> select object_type,object_name from dba_objects

  2  where object_id=97570;

 

OBJECT_TYPE         OBJECT_NAME

-------------------  -----------------------------------------------

SEQUENCE            MY_SEQUENCE_TEST

 

SQL> select * from dba_sequences where sequence_name='MY_SEQUENCE_TEST';

 

SEQUENCE_OWNER SEQUENCE_NAME     MIN_VALUE  MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER

-------------- ---------------- ---------- ---------- ------------ - - ---------- -----------

TEST           MY_SEQUENCE_TEST          1  999999999            1 N N          0           1

 

SQL> 

 

 

 

 

图片 5

图片 6

 

 

 

 

那么,大家接下去使用SQL
TRACE看看使用SEQUENCE时,会对seq$表有甚操作。如下所示,大家在启用SQL_TRACE后,执行3次该SQL语句

那正是说,大家接下去使用SQL
TRACE看看使用SEQUENCE时,会对seq$表有吗操作。如下所示,大家在启用SQL_TRACE后,执行3次该SQL语句

 

 

 

 

SQL> show user;

USER is "TEST"

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         1          1

 

SQL> alter session set sql_trace=true;

 

Session altered.

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         2          2

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         3          3

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         4          4

 

SQL> alter session set sql_trace=false;

 

Session altered.

 

SQL> 
SQL> show user;

USER is "TEST"

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         1          1

 

SQL> alter session set sql_trace=true;

 

Session altered.

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         2          2

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         3          3

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         4          4

 

SQL> alter session set sql_trace=false;

 

Session altered.

 

SQL> 

 

 

 

 

在跟踪文件中(具体进度跟上边查看跟踪文件类似,在此忽略具体经过),你会看出也对seq$做了三遍立异,更新HIGHWATE奥迪Q3的值。

在跟踪文件中(具体经过跟下边查看跟踪文件类似,在此忽略具体进程),你会看到也对seq$做了1遍立异,更新HIGHWATERAV4的值。

 

 

 

 

update
seq$ set
increment$=:2,minvalue=:3,maxvalue=:4,cycle#=:5,order$=:6,

update
seq$ set
increment$=:2,minvalue=:3,maxvalue=:4,cycle#=:5,order$=:6,

 
cache=:7,highwater=:8,audit$=:9,flags=:10

 
cache=:7,highwater=:8,audit$=:9,flags=:10

where

where

 obj#=:1

 obj#=:1

图片 7

图片 8

 

 

 

 

那么大家接下去,大家修改体系CACHE属性的值,然后再度下面操作,如下所示,在跟踪文件之中,你会看到只更新了seq$二回,其实创新seq$的革新次数是跟CACHE的值有涉及的。所以适量的选择CACHE,是能够减去更新seq$数据字典表的次数。

那么大家接下去,大家修改连串CACHE属性的值,然后再次上面操作,如下所示,在跟踪文件之中,你会看到只更新了seq$2遍,其实立异seq$的立异次数是跟CACHE的值有关系的。所以适量的采取CACHE,是能够减掉更新seq$数据字典表的次数。

 

 

SQL> alter sequence my_sequence_test cache 10;

 

Sequence altered.

 

SQL> alter session set sql_trace=true;

 

Session altered.

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         5          5

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         6          6

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         7          7

 

SQL> alter session set sql_trace=false;

 

Session altered.

 

SQL> 
SQL> alter sequence my_sequence_test cache 10;

 

Sequence altered.

 

SQL> alter session set sql_trace=true;

 

Session altered.

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         5          5

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         6          6

 

SQL> select my_sequence_test.currval, my_sequence_test.nextval from dual;

 

   CURRVAL    NEXTVAL

---------- ----------

         7          7

 

SQL> alter session set sql_trace=false;

 

Session altered.

 

SQL> 

 

 

图片 9

图片 10

 

 

那么大家接下去创制三个表,然后循环递归调用体系,然后生成对应时间段的AWPAJERO报告,大家来再次出现一下生产条件遭遇的标题:

这正是说大家接下去创制一个表,然后循环递归调用类别,然后生成对应时间段的AW奥德赛报告,大家来再次出现一下生育条件蒙受的题目:

 

 

SQL> create table test(id  number);

 

Table created.

 

 

begin

        

        for row_num in 1 .. 50000

        loop

          insert into test

            select  my_sequence_test.nextval from dual;

            

            commit;

        end loop;

end;

/
SQL> create table test(id  number);

 

Table created.

 

 

begin

        

        for row_num in 1 .. 50000

        loop

          insert into test

            select  my_sequence_test.nextval from dual;

            

            commit;

        end loop;

end;

/

 

 

正如所示,你见到INSEGL450T语句执行了60000次,而立异seq$执行了4000次,因为地点测试将系列的CACHE设置为10了,假诺没有安装CACHE,那么类别被调用陆仟0次,更新seq$对象也将创新40000次。

如下所示,你看到INSE奔驰G级T语句执行了五千0次,而立异seq$执行了伍仟次,因为地方测试将序列的CACHE设置为10了,假使没有安装CACHE,那么种类被调用陆仟0次,更新seq$对象也将创新50000次。

 

 

图片 11

图片 12

 

 

 

 

别的,调用种类也会有部分redo
log开销,如下测试所示,大家先将体系设置为NOCACHE,然后测试进度意识,每一趟执行都有900多大小的redo
log生成。

其它,调用连串也会有一部分redo
log耗费,如下测试所示,咱们先将连串设置为NOCACHE,然后测试进度意识,每一回执行都有900多大小的redo
log生成。

 

 

SQL> alter sequence my_sequence_test nocache;

 

Sequence altered.

 

SQL> set autotrace on;

SQL> select  my_sequence_test.nextval from dual; 

 

   NEXTVAL

----------

     50015

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

         30  recursive calls

          3  db block gets

          3  consistent gets

          0  physical reads

        908  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50016

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

         14  recursive calls

          4  db block gets

          1  consistent gets

          0  physical reads

        908  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> 
SQL> alter sequence my_sequence_test nocache;

 

Sequence altered.

 

SQL> set autotrace on;

SQL> select  my_sequence_test.nextval from dual; 

 

   NEXTVAL

----------

     50015

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

         30  recursive calls

          3  db block gets

          3  consistent gets

          0  physical reads

        908  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50016

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

         14  recursive calls

          4  db block gets

          1  consistent gets

          0  physical reads

        908  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> 

 

 

要是运用CACHE的sequence对象而言,redo
size生成的功用肯定是低得多。如下所示,测试1回,唯有首先次生成了redo
log,
当然那几个是跟类别的CACHE值有关,当缓存的类别值使用完了,生成新的行列值缓存时,也会发生redo
log。

比方选拔CACHE的sequence对象而言,redo
size生成的频率显著是低得多。如下所示,测试一次,只有首先次生成了redo
log,
当然那么些是跟类别的CACHE值有关,当缓存的连串值使用完了,生成新的类别值缓存时,也会发生redo
log。

 

 

SQL> alter sequence my_sequence_test cache 10;

 

Sequence altered.

 

SQL> set autotrace on;

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50017

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

         30  recursive calls

          3  db block gets

          3  consistent gets

          0  physical reads

        908  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50018

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

          0  recursive calls

          0  db block gets

          0  consistent gets

          0  physical reads

          0  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50019

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

          0  recursive calls

          0  db block gets

          0  consistent gets

          0  physical reads

          0  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed
SQL> alter sequence my_sequence_test cache 10;

 

Sequence altered.

 

SQL> set autotrace on;

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50017

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

         30  recursive calls

          3  db block gets

          3  consistent gets

          0  physical reads

        908  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50018

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

          0  recursive calls

          0  db block gets

          0  consistent gets

          0  physical reads

          0  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select  my_sequence_test.nextval from dual;

 

   NEXTVAL

----------

     50019

 

 

Execution Plan

----------------------------------------------------------

Plan hash value: 1070122491

 

-----------------------------------------------------------------------------

| Id  | Operation        | Name             | Rows  | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                  |     1 |     2   (0)| 00:00:01 |

|   1 |  SEQUENCE        | MY_SEQUENCE_TEST |       |            |          |

|   2 |   FAST DUAL      |                  |     1 |     2   (0)| 00:00:01 |

-----------------------------------------------------------------------------

 

Statistics

----------------------------------------------------------

          0  recursive calls

          0  db block gets

          0  consistent gets

          0  physical reads

          0  redo size

        527  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

 

 

 

除此以外一个题材尽管,假如连串是NOCACHE,并发调用系列时,
那么也会时有发生row lock contention,
所以给类别设置三个确切的CACHE值是有不小益处的,既能收缩redo
log的发生,也能幸免收缩row lock
contention(并发更新seq$同一行记录)。然而体系设置了CACHE后,也有恐怕遇见跳号难点。那么那些就须要遵照实况钻探考虑处理了。

除此以外1个题材即便,倘若连串是NOCACHE,并发调用连串时,
那么也会时有爆发row lock contention,
所以给连串设置三个合适的CACHE值是有十分大利益的,既能减少redo
log的发生,也能幸免收缩row lock
contention(并发更新seq$同一行记录)。不过种类设置了CACHE后,也有只怕蒙受跳号难题。那么这几个就要求依据真实情状切磋考虑处理了。

 

 

 

 

 

 

 

 

参考资料:

参考资料:

 

 

https://asktom.oracle.com/pls/asktom/f?p=100:11:451611870226342::::P11_QUESTION_ID:2985886242221

https://asktom.oracle.com/pls/asktom/f?p=100:11:451611870226342::::P11_QUESTION_ID:2985886242221

http://www.xifenfei.com/forum/performance/%E5%85%B3%E4%BA%8Eoracle-sequence%E4%B8%80%E4%BA%9B%E5%B0%8F%E6%B5%8B%E8%AF%95

http://www.xifenfei.com/forum/performance/%E5%85%B3%E4%BA%8Eoracle-sequence%E4%B8%80%E4%BA%9B%E5%B0%8F%E6%B5%8B%E8%AF%95

 

 

 

 

相关文章