Oracle实例之间的心跳机制,为何而心跳-Oracle Heartbeat研究之二

为何而心跳-Oracle Heartbeat研究之二

6ee5639a40442445944d63b514b2dd02.png

在上一篇文章(为何而心跳-Oracle Heartbeat研究)中,我简单介绍了heartbeat的机制,现在我们来作点进一步的研究.

首先启动数据库到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>

历史上的今天...

>>

2011-01-27文章:

2008-01-27文章:

By eygle on 2006-01-27 21:04 |

Comments (5) |

Internal | 659 |

5 Comments

eygle大师你好,

上面你的测试是在mount状态下进行的,dump出来的控制文件中只有心跳值发生变化,这很正常,但是在open状态下,如果数据库脏缓冲区有很多数据要写入数据文件时刻,此时再间隔一段时间dump出来控制文件的信息,可能就不只是心跳值变化了,

13c13

Unix process pid: 16613, image: oracle@www (TNS V1-V3)

15,16c15

*** SESSION ID:(13.19) 2006-09-18 17:22:38.334

59,61c58,60

THREAD #1 - status:0x2 flags:0x0 dirty:226

> low cache rba:(0x1.362b.0) on disk rba:(0x1.1ca06.0)

> on disk scn: 0x0000.0158ee4b 09/18/2006 17:22:31

63c62

heartbeat: 601429873 mount id: 76487130

看到上面on disk scn以及心跳都发生了变化,所以俺认为不能说heartbeat每3秒更新的仅是"heartbeat"而已,同时你的测试时间间隔也不是3妙!

一点不同看法,如有不对,请指正,谢谢!

>'同时你的测试时间间隔也不是3妙!'

你怎么知道不是?

这个时间,你去跟踪后台进程就知道了。

>'看到上面on disk scn以及心跳都发生了变化,所以俺认为不能说heartbeat每3秒更新的仅是"heartbeat"而已'

heartbeat 一直在跳,这期间有其它数据发生变化一点都不奇怪啊。

可以再参考我之前给出的链接:

http://www.eygle.com/archives/2006/01/why_oracle_heartbeat.html

可不可这样说:心跳和更新控制文件中的low cache rba、on disk RBA和on disk scn等内容都是CKPT的任务。在三秒超时时,如果不需要更新任这些RBA和SCN,CKPT只记录heartbeat。

X$KCCRT这个写错了吧,应该是X$KCCCP?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux-HA heartbeat源码包是一种用于实现高可用性(High Availability)集群的开源软件。作为一个底层系统工具,它在集群中的节点之间提供了一种心跳机制,用于检测节点的状态和通信。 heartbeat源码包的主要功能是监控集群中的节点,并在发生故障时自动切换到备用节点,以保证系统的连续可用性。它通过不断发送心跳信号来检测节点的状态,一旦检测到节点宕机或出现问题,就会触发自动故障切换。此外,heartbeat还提供了灵活的配置选项,用户可以根据自己的需求进行配置,如定义故障检测算法、设置故障切换策略等。 heartbeat源码包采用C语言编写,具有良好的可移植性和跨平台性,可以在各种Linux发行版和其他Unix操作系统上运行。它基于分布式的架构,支持多种网络通信协议(如UDP、TCP等),能够在不同网络层面上进行心跳通信,确保可靠性和性能。 对于开发者而言,心态源码包提供了丰富的API接口和文档,方便二次开发和定制化。开发者可以通过编写自定义的资源代理来扩展heartbeat的功能,比如添加新的监控指标或自定义故障检测算法等。 总结而言,Linux-HA heartbeat源码包是一个功能强大的高可用性集群软件,提供了可靠的心跳机制和故障切换功能。它通过自动监测节点状态和通信来确保系统的连续可用性,并提供了灵活的配置和扩展选项,可以满足不同用户的需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值