12
返回列表 发新帖
楼主: kewin

一个没有任何事务的DB,如果一直开着,那SCN号会不会增大?

[复制链接]
论坛徽章:
8
2009新春纪念徽章
日期:2009-01-04 14:52:28祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:07:24ITPUB9周年纪念徽章
日期:2010-10-08 09:32:25ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262013年新春福章
日期:2013-02-25 14:51:24沸羊羊
日期:2015-03-04 14:51:522015年新春福章
日期:2015-03-06 11:57:31
11#
发表于 2009-10-12 10:46 | 只看该作者
谢谢viadeazhu,学习了。

使用道具 举报

回复
论坛徽章:
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
12#
发表于 2009-10-13 03:37 | 只看该作者
viadeazhu's research is very interesting.

We (including me) should not quickly jump to the conclusion about any relationship between heartbeat and SCN increase. It's just a hypothesis, until anybody can find an official document to prove it. 9i's 'redo size' statistic# is 115. If you run this query

select sysdate, dbms_flashback.get_system_change_number, value from v$sysstat where statistic# = 115;

multiple times in 9i, you'll see the SCN go up while redo value remains the same for a while. It may indicate the cause of the SCN increase is heartbeat, but we don't know for sure.

Before you run it in 10g, change 115 to 134. Do not use current_scn column of v$database to do this test. Apparently, a simple query (on any column) of v$database in 10g will increase SCN. This doesn't happen in 9i.

viadeazhu said you can't get SQL trace to generate a trace file. Two things you need to watch. One is you need to use oradebug to set event on the SMON session. What method did you use? Secondly, wait longer. You may need to wait as long as 5 minutes (SMON has a few cycles to perform its different routine tasks, one of which is 5 minutes.) The SQL trace I got on SMON in Oracle 10.2.0.1 on Windows has these SQLs (excluding select's, shown below not in order):

delete from smon_scn_time...
insert into smon_scn_time...
update smon_scn_time...
insert into sys.col_usage$ values...
lock table sys.col_usage$ in exclusive mode nowait
insert into sys.mon_mods$ values...
lock table sys.mon_mods$ in exclusive mode nowait
update sys.col_usage$...
update sys.mon_mods$...

Yong Huang

使用道具 举报

回复
论坛徽章:
113
ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512011新春纪念徽章
日期:2011-02-18 11:42:50现任管理团队成员
日期:2011-05-07 01:45:08ITPUB官方微博粉丝徽章
日期:2011-06-28 19:45:36蛋疼蛋
日期:2011-07-24 22:25:332012新春纪念徽章
日期:2012-02-13 15:12:252012新春纪念徽章
日期:2012-02-13 15:12:252012新春纪念徽章
日期:2012-02-13 15:12:252012新春纪念徽章
日期:2012-02-13 15:12:252012新春纪念徽章
日期:2012-02-13 15:12:25
13#
发表于 2009-10-13 09:14 | 只看该作者

回复 #12 Yong Huang 的帖子

感谢huangyong的回答。
我是用的oradebug 10046 trace smon的,但是我发现我一直等在udump目录下,后来我发现trace文件产生在了bdump下面。
然而,我等待了许久,还是没从trace文件发现有update col_usage$的语句,于是我刚才logminer了过去几天的日志,才发现了少许update col_usage$的语句。我想我的第二个观点可以扩展为smon会自己跟新一些内部表,这可能跟你开启了什么参数有关,可能跟你版本不同有关,所以产生了redo。比如如果开启了awr,可能会有更多的redo。
对于第一个观点,我想我是无法确定一定是checkpoint heartbeat产生的,但现象是在没有任何redo产生的情况下每三秒增加一个scn。这是否可以理解为scn的一个heartbeat呢:)

使用道具 举报

回复
论坛徽章:
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
14#
发表于 2009-10-14 02:03 | 只看该作者
I randomly picked one update sys.col_usage$... SQL and checked the obj#. It's a table related to SQL*Plus. I didn't check others.

We can assume the SCN increase without redo is related to heartbeat. It's good to have a theory, even though it may be falsified later. If we can find an official paper giving us the details of this heartbeat, that'll solve the mystery.

Yong Huang

使用道具 举报

回复

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

本版积分规则 发表回复

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