日期:2014-05-16  浏览次数:20489 次

关于序列的号码丢失
首先看一个例子,让我们对CACHE丢失有一个直观的了解:

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

SQL> create sequence seq_czw
  2  start with 1
  3  nomaxvalue
  4  cache 200
  5  /

Sequence created.

SQL> select seq_czw.nextval from dual;

   NEXTVAL
----------
         1

SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1670221824 bytes
Fixed Size                  2176328 bytes
Variable Size            1073744568 bytes
Database Buffers          587202560 bytes
Redo Buffers                7098368 bytes
Database mounted.
Database opened.
SQL> select seq_czw.nextval from dual;

   NEXTVAL
----------
       201

SQL> select seq_czw.nextval from dual;

   NEXTVAL
----------
       202

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.