这个问题问的很好,我相信很多人都觉得(或者听说过)不能用了。但事实真的是这个样子吗? 我做了一个实验 你可以来看一下:UcJmhs-MacBook-Pro:~ ucjmh$ ssh [email]root@192.168.56.101[/email][email]root@192.168.56.101[/email]'s password: Last login: Mon Sep 14 09:13:49...
显示全部这个问题问的很好,我相信很多人都觉得(或者听说过)不能用了。但事实真的是这个样子吗? 我做了一个实验 你可以来看一下:
UcJmhs-MacBook-Pro:~ ucjmh$ ssh [email]root@192.168.56.101[/email]
[email]root@192.168.56.101[/email]'s password:
Last login: Mon Sep 14 09:13:49 2015 from 192.168.56.1
[root@ucjmh ~]#
[root@ucjmh ~]#
[root@ucjmh ~]# su - oracle
[oracle@ucjmh ~]$
[oracle@ucjmh ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 14 18:01:05 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create sequence seq_text cache 100;
Sequence created. —先创建一个 缓存100
SQL> select seq_text.nextval from dual;
NEXTVAL
----------
1
SQL> /
NEXTVAL
----------
2
SQL> /
NEXTVAL
----------
3
SQL> shutdown immediate 把数据库干净的关闭
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup --起动
ORACLE instance started.
Total System Global Area 795127808 bytes
Fixed Size 1347876 bytes
Variable Size 557846236 bytes
Database Buffers 230686720 bytes
Redo Buffers 5246976 bytes
Database mounted.
Database opened.
SQL> select seq_text.nextval from dual;
NEXTVAL
----------
4 --发现并没有跳号
SQL> /
NEXTVAL
----------
5
SQL> /
NEXTVAL
----------
6
SQL> shutdown abort --用abort的方式关闭数据库
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 795127808 bytes
Fixed Size 1347876 bytes
Variable Size 557846236 bytes
Database Buffers 230686720 bytes
Redo Buffers 5246976 bytes
Database mounted.
Database opened.
SQL> select seq_text.nextval from dual;
NEXTVAL
----------
104--发现跳号了 是104的原因是因为上次缓存到104
SQL> alter system flush shared_pool; --同理 刷新shard_pool 也跳了
System altered.
SQL> select seq_text.nextval from dual;
NEXTVAL
----------
204
--开个10046并关闭数据库 来看一下原理
SQL> alter session set events '10046 trace name context forever, level 4';
Session altered.
update seq$ set increment$=:2,minvalue=:3,maxvalue=:4,cycle#=:5,order$=:6,cache=:7,highwater=:8,audit$=:9,flags=:10 where obj#=:1
在正常关闭的时候oracle去修改了数据字典 所以才没有丢已经缓存的
收起