序列sequence中的cache问题
来源:互联网 发布:中国陆军战斗力 知乎 编辑:程序博客网 时间:2024/05/17 05:11
CREATE SEQUENCE [ schema. ] sequence [ { INCREMENT BY | START WITH } integer | { MAXVALUE integer | NOMAXVALUE } | { MINVALUE integer | NOMINVALUE } | { CYCLE | NOCYCLE } | { CACHE integer | NOCACHE } | { ORDER | NOORDER } ]...;
在sequence的创建语句中,
The CACHE clause preallocates a set of sequence numbers and keeps them in memory so that sequence numbers can be accessed faster. When the last of the sequence numbers in the cache has been used, the database reads another set of numbers into the cache.
The database might skip sequence numbers if you choose to cache a set of sequence numbers. For example, when an instance abnormally shuts down (for example, when an instance failure occurs or a SHUTDOWN ABORT statement is issued), sequence numbers that have been cached but not used are lost.
--下面我们来做个试验测试一下,创建序列如下:
SQL> create sequence s1
2 start with 10
3 increment by 10
4 maxvalue 1000000000000000000000
5 cycle
6 cache 10;
SQL> select s1.nextval from dual;
NEXTVAL
----------
10
SQL> shutdown abort
SQL> startup
SQL> select s1.nextval from dual;
NEXTVAL
----------
110
SQL> /
NEXTVAL
----------
120
SQL> shutdown immediate
SQL> startup
SQL> select s1.nextval from dual;
NEXTVAL
----------
130
由此可见,在数据库异常关闭时,cache中预存的序列值全部丢失,在本例中预存了10个值,从10到100,。重新启动数据库后,下一个序列值从120开始。而数据库在正常关闭时,cache中预存的序列值不会丢失。
- 序列sequence中的cache问题
- oracle中的序列-sequence
- bzoj1345 序列问题sequence
- Oracle中的序列 sequence 用法
- python中的sequence(序列)
- BZOJ1345: [Baltic2007]序列问题Sequence
- 【Baltic2007】【BZOJ1345】序列问题Sequence
- bzoj1345: [Baltic2007]序列问题Sequence
- Liferay中的Cache问题
- Oracle中的序列sequence - 顺序生成seqid
- BZOJ 1345: [Baltic2007]序列问题Sequence
- 【BZOJ 1345】 [Baltic2007]序列问题Sequence
- 【bzoj 1345】 [Baltic2007]序列问题Sequence
- 嵌入式系统中的CACHE问题
- 嵌入式系统中的CACHE问题
- 嵌入式系统中的CACHE问题
- Oracle Sequence不设置cache参数的几个潜在问题
- sequence序列
- Linux命令之diff
- valgrind
- Oracle工具之DBNEWID
- 运算符重载
- Oracle常用函数汇总
- 序列sequence中的cache问题
- 教您修复mysql数据库的方法
- 一键准备Oracle安装
- 一键配置本地yum源
- Shell最多可以输入多少个参数?
- (转)Shell函数
- SQL Cookbook
- Qt5双缓冲机制
- [刷题]Ugly Number