[CACHE integer | NOCACHE] --指定數(shù)據(jù)庫內(nèi)存中預(yù)分配的序列值個數(shù),最小cache值為2 |不指定緩存數(shù)
默認(rèn)值是cache 20
[ORDER | NOORDER] --指定order條件保證序列按請求順序生成|不保證序列按請求順序生成
默認(rèn)值是NOORDER
單機(jī) sequence都是order的。就算加了noorder,結(jié)果還是order。
RAC sequence才有真正的order和noorder
order:兩個節(jié)點(diǎn)保持一樣的order
noorder:如果使用了nocache,兩個節(jié)點(diǎn)保持一樣的order
如果使用了cache,兩個節(jié)點(diǎn)不order,但各節(jié)點(diǎn)內(nèi)部order
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
網(wǎng)站欄目:RAC_Sequence序列號的使用
標(biāo)題網(wǎng)址:
http://weahome.cn/article/jgggco.html