楼主: bellsz

[精华] 关于SCN的理解,请指正

[复制链接]
论坛徽章:
0
31#
发表于 2005-10-27 19:37 | 只看该作者
cool

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-11-10 22:29:04
32#
发表于 2005-10-28 11:23 | 只看该作者

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
33#
发表于 2005-10-28 14:21 | 只看该作者
scn号是唯一的,如果第一scn号是1000的话,那么在出现第二个
scn号的时候,如果是1004,这就意味着在这个期间数据库做了某些内部的操作(例如buffer 块的清除),
scn是唯一的,但可能不连贯
除非对数据库重新建立,否则scn号永远不会被重置为0

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
34#
发表于 2005-10-29 02:33 | 只看该作者

Note:

get latest SCN (depends on your oracle version :-p)

select dbms_flashback.get_system_change_number from dual;

使用道具 举报

回复
论坛徽章:
26
ITPUB元老
日期:2005-02-28 12:57:00生肖徽章:兔
日期:2006-09-26 21:29:55生肖徽章:兔
日期:2006-09-07 17:01:32生肖徽章:兔
日期:2006-09-07 17:02:25生肖徽章:兔
日期:2006-09-07 17:02:46生肖徽章:兔
日期:2006-09-07 17:06:29生肖徽章:兔
日期:2006-09-18 05:26:00生肖徽章:狗
日期:2006-10-06 13:28:27生肖徽章:狗
日期:2006-10-08 05:28:34生肖徽章2007版:鸡
日期:2008-01-02 17:35:53
35#
发表于 2005-11-4 11:03 | 只看该作者
SQL> select checkpoint_change#  from v$database;

CHECKPOINT_CHANGE#
------------------
           1069220

SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                 1070544

为什么这2个查到的SCN不一样呢

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
36#
发表于 2005-11-4 12:08 | 只看该作者
最初由 rchsh 发布
[B]SQL> select checkpoint_change#  from v$database;

CHECKPOINT_CHANGE#
------------------
           1069220

SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                 1070544

为什么这2个查到的SCN不一样呢 [/B]


They're two different things. Checkpoint SCN should always lag behind the latest SCN in the database. If you alter system checkpoint and immediately run your two queries, they should differ less, but still checkpoint SCN is smaller.

Yong Huang

使用道具 举报

回复
论坛徽章:
0
37#
发表于 2006-6-30 14:25 | 只看该作者
最初由 Yong Huang 发布
[B]

They're two different things. Checkpoint SCN should always lag behind the latest SCN in the database. If you alter system checkpoint and immediately run your two queries, they should differ less, but still checkpoint SCN is smaller.

Yong Huang [/B]


[php]
sys@DBAP01> select max(ktuxescnw*power(2,32)+ktuxescnb) from x$ktuxe;

MAX(KTUXESCNW*POWER(2,32)+KTUX
------------------------------
                      52211024

已用时间:  00: 00: 00.00
sys@DBAP01> alter system checkpoint;

系统已更改。

已用时间:  00: 00: 00.06
sys@DBAP01> select CHECKPOINT_CHANGE# from v$database;

CHECKPOINT_CHANGE#
------------------
          52211055

已用时间:  00: 00: 00.00
sys@DBAP01> select max(ktuxescnw*power(2,32)+ktuxescnb) from x$ktuxe;

MAX(KTUXESCNW*POWER(2,32)+KTUX
------------------------------
                      52211053

已用时间:  00: 00: 00.00
sys@DBAP01>
[/php]

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
38#
发表于 2006-7-1 20:37 | 只看该作者
最初由 localhosts 发布
[B]

[php]
sys@DBAP01> select max(ktuxescnw*power(2,32)+ktuxescnb) from x$ktuxe;

MAX(KTUXESCNW*POWER(2,32)+KTUX
------------------------------
                      52211024

已用时间:  00: 00: 00.00
sys@DBAP01> alter system checkpoint;

系统已更改。

已用时间:  00: 00: 00.06
sys@DBAP01> select CHECKPOINT_CHANGE# from v$database;

CHECKPOINT_CHANGE#
------------------
          52211055

已用时间:  00: 00: 00.00
sys@DBAP01> select max(ktuxescnw*power(2,32)+ktuxescnb) from x$ktuxe;

MAX(KTUXESCNW*POWER(2,32)+KTUX
------------------------------
                      52211053

已用时间:  00: 00: 00.00
sys@DBAP01>
[/php] [/B]



x$ktuxe 计算出来的是已经结束的最新的事务的commit scn ,所以可小于当前系统scn。 检查点 scn 自然也小于当前系统scn。 但是 检查点scn 和 x$ktuxe 计算出来的大小却倚赖于 系统状况了。

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
39#
发表于 2006-7-1 22:24 | 只看该作者
最初由 biti_rainy 发布
[B]
x$ktuxe 计算出来的是已经结束的最新的事务的commit scn ,所以可小于当前系统scn。 检查点 scn 自然也小于当前系统scn。 但是 检查点scn 和 x$ktuxe 计算出来的大小却倚赖于 系统状况了。 [/B]


You're saying both the x$ktuxe SCN and the checkpoint SCN are smaller than the "current system SCN", whatever that is, so there's no relationship between these two (x$ktuxe SCN and checkpoint SCN). Correct? The question becomes, what is exactly that "current system SCN"? Is there any way to find that?

Yong Huang

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
40#
发表于 2006-7-2 01:09 | 只看该作者
最初由 Yong Huang 发布
[B]

You're saying both the x$ktuxe SCN and the checkpoint SCN are smaller than the "current system SCN", whatever that is, so there's no relationship between these two (x$ktuxe SCN and checkpoint SCN). Correct? The question becomes, what is exactly that "current system SCN"? Is there any way to find that?

Yong Huang [/B]


current  scn 是 系统当前所产生的最大 scn ,可能是当前未结束事务所产生的scn。 在9i 的 dbms_flashback.get_system_number 可以得到这个值,这个值应该是大于等于  x$ktuxe SCN  (这个view 记录的是 当前数据库结束事务的最大scn)

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表