为何而心跳(2)

首先启动数据库到Mount状态:
[oracle@jumper bdump]$ sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 24 14:10:02 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 33554432 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
在Mount状态DUMP控制文件,比较前后变化,我们发现Heartbeat每3秒都被更新一次:
[oracle@jumper udump]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 24 14:10:33 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> alter session set events 'immediate trace name CONTROLF level 10' ;
Session altered.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[oracle@jumper udump]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 24 14:10:46 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> alter session set events 'immediate trace name CONTROLF level 10' ;
Session altered.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[oracle@jumper udump]$ ls
conner_ora_31841.trc conner_ora_31846.trc
[oracle@jumper udump]$ diff conner_ora_31841.trc conner_ora_31846.trc
....
16c16
< *** SESSION ID:(9.5) 2006-01-24 14:10:39.076
---
> *** SESSION ID:(9.7) 2006-01-24 14:10:48.822
63c63
< heartbeat: 580556236 mount id: 3192501183
---
> heartbeat: 580556239 mount id: 3192501183
这说明Heartbeat并非在数据库Open状态下才会更新,也说明HeartBeat是用来维持实例的Mount状态检测.
Q:这里的mount id应该代表的是instance的id,每次不同,这个id来自何处呢?应该和系统有关,我没找到具体的含义.哪位知道请告知.
之所以验证这个内容是因为在 Steve ( www.ixora.com.au )的网站上有这样 一段话:
The checkpoint RBA is copied into the checkpoint progress record of the controlfile by the checkpoint heartbeat once every 3 seconds.
这段话在不同的数据库版本里需要被重新理解.
另外我们还可以看到,在Mount状态下,数据库通过以下两个锁定来维持Instance的变化:
SQL> select * from v$lock;
ADDR KADDR SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK
-------- -------- ---------- ---- ---------- ---------- ---------- ---------- ---------- ----------
562E35F4 562E3604 3 RT 1 0 6 0 1616 0
562E34C4 562E34D4 4 XR 4 0 1 0 1619 0
其中RT锁是: Redo thread global enqueue ,为LGWR进程持有.
XR锁Oracle的解释为:
acquired for ALTER SYSTEM QUIESCE RESTRICTED command (or alter database open) in RAC mode."
此处为CKPT进程持有.
在数据库Mount状态下,我们也可以通过查询 X$KCCRT来观察heartbeat的变化:
[oracle@jumper oracle]$ sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Wed Jan 25 00:08:06 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> select cphbt from X$KCCCP;
CPHBT
----------
580567934
SQL> /
CPHBT
----------
580567935
SQL> /
CPHBT
----------
580567936
SQL> select open_mode from v$database;
OPEN_MODE
----------
MOUNTED
SQL>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/92530/viewspace-128002/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/92530/viewspace-128002/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值