Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of RAC_Sequence serial number

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

[CACHE integer |NOCACHE] --Specifies the number of sequence values pre-allocated in database memory, with a minimum cache value of 2| Do not specify cache count

The default value is cache 20.

[ORDER |NOORDER] --Specify an order condition to ensure that the sequence is generated in the order requested| There is no guarantee that the sequence will be generated in the order requested

Default is NOORDER

Single sequence is order. Even if you add noorder, the result is still order.

RAC sequence has real order and noorder

Order: Two nodes maintain the same order

noorder: If nocache is used, both nodes remain in the same order

If cache is used, the two nodes are not ordered, but each node is internally ordered.

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB2

SQL> create sequence SEQ_T1 start with 10 maxvalue 100000 cache 2000 noorder;

Sequence created.

SQL> select SEQ_T1.nextval from dual;

NEXTVAL

----------

10

SQL> select SEQ_T1.nextval from dual;

NEXTVAL

----------

11

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB1

SQL> select SEQ_T1.nextval from dual;

NEXTVAL

----------

2010

SQL> select SEQ_T1.nextval from dual;

NEXTVAL

----------

2011

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB2

SQL> create sequence SEQ_T2 start with 10 maxvalue 100000 nocache noorder;

Sequence created.

SQL> select SEQ_T2.nextval from dual;

NEXTVAL

----------

10

SQL> select SEQ_T2.nextval from dual;

NEXTVAL

----------

11

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB1

SQL> select SEQ_T2.nextval from dual;

NEXTVAL

----------

12

SQL> select SEQ_T2.nextval from dual;

NEXTVAL

----------

13

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB2

SQL> create sequence SEQ_T3 start with 10 maxvalue 100000 noorder;

Sequence created.

SQL> select SEQ_T3.nextval from dual;

NEXTVAL

----------

10

SQL> select SEQ_T3.nextval from dual;

NEXTVAL

----------

11

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB1

SQL> select SEQ_T3.nextval from dual;

NEXTVAL

----------

30

SQL> select SEQ_T3.nextval from dual;

NEXTVAL

----------

31

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB2

SQL> create sequence SEQ_T4 start with 10 maxvalue 100000 order;

Sequence created.

SQL> select SEQ_T4.nextval from dual;

NEXTVAL

----------

10

SQL> select SEQ_T4.nextval from dual;

NEXTVAL

----------

11

SQL> show parameter instance_name

NAME TYPE VALUE

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

instance_name string PLMDB1

SQL> select SEQ_T4.nextval from dual;

NEXTVAL

----------

12

SQL> select SEQ_T4.nextval from dual;

NEXTVAL

----------

13

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report