TRACE并捕捉追踪文件中的绑定变量),大家追踪会话创制连串的进程

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
TRACE看看使用SEQUENCE时,会对seq$表有吗操作。如下所示,大家在启用SQL_TRACE后,执行3次该SQL语句

 

假设使用CACHE的sequence对象来讲,redo
size生成的功能确定是低得多。如下所示,测试一次,惟有首先次生成了redo
log,
当然这几个是跟连串的CACHE值有关,当缓存的体系值使用完了,生成新的连串值缓存时,也会发生redo
log。

 

 

图片 1

 

 

 

 

其余,调用类别也会有一部分redo
log耗费,如下测试所示,大家先将类别设置为NOCACHE,然后测试过程意识,每便推行都有900多大小的redo
log生成。

除此以外二个主题材料固然,要是类别是NOCACHE,并发调用连串时,
那么也会时有发生row lock contention,
所以给系列设置3个适中的CACHE值是有非常的大便宜的,既能裁减redo
log的发生,也能防止收缩row lock
contention(并发更新seq$同1行记录)。可是系列设置了CACHE后,也有望遇到跳号难点。那么这些就必要基于实际情形酌定思量处理了。

 

 

 

 

 

 

 

在解析ORACLE的AWLX570报告时,发现SQL
ordered by Executions(记录了依照SQL的执行次数排序的TOP
SQL。该排序可以看出监察和控制范围内的SQL实施次数)下有三个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$做了三次创新,更新HIGHWATEEvoque的值。

 obj#=:1

 

如下所示,你见到INSERT语句实践了陆仟0次,而立异seq$施行了5000次,因为上边测试将连串的CACHE设置为10了,假诺没有设置CACHE,那么体系被调用陆仟0次,更新seq$对象也将革新五千0次。

 

 

 

 

 obj#=:1

图片 2

 

 

在解析ORACLE的AW中华V报告时,发现SQL
ordered by Executions(记录了遵照SQL的实行次数排序的TOP
SQL。该排序能够看来监察和控制范围内的SQL实行次数)下有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> 

 

 

 

万1采纳CACHE的sequence对象来说,redo
size生成的频率鲜明是低得多。如下所示,测试三回,唯有首先次生成了redo
log,
当然这么些是跟系列的CACHE值有关,当缓存的连串值使用完了,生成新的队列值缓存时,也会发生redo
log。

图片 3

 

 

 

 

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

 

 

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;

/

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

 

图片 4

参考资料:

 

 

图片 5

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

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> 

 

除此以外,调用种类也会有一对redo
log费用,如下测试所示,大家先将体系设置为NOCACHE,然后测试进度意识,每回实践都有900多大小的redo
log生成。

图片 6

 

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

 

 

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

那么seq$那个数额字典表是做哪些用的啊?
其实那一个数据字典表是保存的是数据库下体系对象(SEQUENCE)的连锁消息,而且它用来保卫安全类别的变型。如下所示,大家透过试验来验证一下,我们启用十046轩然大波,追踪一下对话(level=四表示启用SQL_TRACE并捕捉追踪文件中的绑定变量),大家追踪会话创立连串的长河。下边测试环境为Oracle
1一g

 

 

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

 

[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$中插入了一条记下),如下截图所示:

 

 

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> 

 

图片 7

图片 8

 

应用上边脚本,你就会发觉那一个都以对应种类对象的有的新闻(体系对象的OBJECT_ID、MINVALUE、MAXVALUE、CACHE等等)

 

 

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

tkprof格式化后的出口文件之中,未有绑定变量,在原来追踪文件gsp_ora_2820一.trc中,你能够看到相应绑定变量的值

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> 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 "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

 

 

 

 

 

别的一个难题不怕,要是系列是NOCACHE,并发调用类别时,
那么也会爆发row lock contention,
所以给连串设置三个适宜的CACHE值是有相当大利润的,既能收缩redo
log的发出,也能幸免收缩row lock
contention(并发更新seq$同一行记录)。不过连串设置了CACHE后,也有极大概率遇到跳号难点。那么那几个就要求基于真实情况商量思虑处理了。

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

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> 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

图片 9

 

图片 10

 

where

那么我们接下去,我们修改种类CACHE属性的值,然后重新下面操作,如下所示,在追踪文件之中,你会师到只更新了seq$1回,其实立异seq$的创新次数是跟CACHE的值有提到的。所以适用的采用CACHE,是可以缩小更新seq$数据字典表的次数。

 

 

 

那么seq$那一个数额字典表是做哪些用的啊?
其实那个数据字典表是保存的是数据库下种类对象(SEQUENCE)的连带新闻,而且它用来保卫安全体系的成形。如下所示,大家透过试验来验证一下,大家启用十0肆6轩然大波,跟踪一下对话(level=4表示启用SQL_TRACE并捕捉追踪文件中的绑定变量),咱们追踪会话创立种类的进度。下边测试环境为Oracle
11g

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

 

 

 

那么大家接下去创设三个表,然后循环递归调用体系,然后生成对应时间段的AWTiggo报告,我们来重现一下生产条件遇到的难题:

 

 

在追踪文件中(具体经过跟上边查看追踪文件类似,在此忽略具体进度),你会看到也对seq$做了3次立异,更新HIGHWATE冠道的值。

[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.

 

 

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

图片 11

 

 

where

 

 

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

 

 

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

这就是说我们接下去,大家修改连串CACHE属性的值,然后再一次上边操作,如下所示,在追踪文件之中,你会看出只更新了seq$二遍,其实立异seq$的立异次数是跟CACHE的值有提到的。所以适当的选择CACHE,是可以收缩更新seq$数据字典表的次数。

 

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> 

参考资料:

 

那么我们接下去创设2个表,然后循环递归调用类别,然后生成对应时间段的AW奥德赛报告,大家来重现一下生育条件蒙受的标题:

 

 

 

 

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

运用上边脚本,你就会发现那个都以对应系列对象的一部分音讯(类别对象的OBJECT_ID、MINVALUE、MAXVALUE、CACHE等等)

一般来讲所示,你看来INSERT语句实施了四千0次,而立异seq$实践了5000次,因为地点测试将类别的CACHE设置为拾了,假设没有设置CACHE,那么类别被调用50000次,更新seq$对象也将履新六千0次。

图片 12

 

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,

 

相关文章

网站地图xml地图