今天看书时看到了关于RAC中SCN的问题,为了进一步搞清楚其内部原理和机制,对该问题进行了广泛的查阅和搜索,遗憾的是,可以参考的资料很少,网上大部分是人云亦云的帖子,其中,详细介绍其内部原理和机制的资料更是几乎没有,现将一些有参考价值的资料片段在下面贴出,以供本人和同行参考。

1.Achieving Read Consistency
One of the main characteristics of the Oracle database is the ability to simultaneously provide different
views of data. This characteristic is called multi-version read consistency. Queries will be read
consistently; writers won’t block readers, and vice versa. Of course, multi-version read consistency also
holds true for RAC databases, but a little more work is involved.
The System Change Number is an Oracle internal timestamp that is crucial for read consistency. If
the local instance requires a read-consistent version of a block, it contacts the block’s resource master to
ascertain if a version of the block that has the same SCN, or if a more recent SCN exists in the buffer
cache of any remote instance. If such a block exists, then the resource master will send a request to the
relevant remote instance to forward a read-consistent version of the block to the local instance. If the
remote instance is holding a version of the block at the requested SCN, it sends the block immediately. If
the remote instance is holding a newer version of the block, it creates a copy of the block, called a past
image; applies undo to the copy to revert it to the correct SCN; and sends it over the interconnect.
2.Synchronizing System Change Numbers
System Change Numbers are internal time stamps generated and used by the Oracle database. All events
happening in the database are assigned SCNs, and so are transactions. The implementation Oracle uses
to allow read consistency relies heavily on SCNs and information in the undo tablespaces to produce
read-consistent information. System change numbers needs to be in sync across the cluster. Two
different schemes to keep SCNs current on all cluster nodes are used in Real Application Clusters: the
broadcast-on-commit scheme and the Lamport scheme.
The broadcast-on-commit scheme is the default scheme in 10g Release 2 and newer; it addresses a
known problem with the Lamport scheme. Historically, the Lamport scheme was the default scheme—it
promised better scalability as SCN propagation happened as part of other (not necessarily related)
cluster communication and not immediately after a commit is issued on a node. This was deemed
sufficient in most situations by Oracle, and documents available on My Oracle Support seem to confirm
this. However, there was a problem with the Lamport scheme: It was possible for SCNs of a node to lag
behind another node’s SCNs—especially if there was little messaging activity. The lagging of system
change numbers meant that committed transactions on a node were “seen” a little later by the instance
lagging behind.
On the other hand, the broadcast-on-commit scheme is a bit more resource intensive. The log
writer process LGWR updates the global SCN after every commit and broadcasts it to all other instances.
The deprecated max_commit_propagation_delay initialization parameter allowed the database
administrator to influence the default behavior in RAC 11.1; the parameter has been removed in Oracle
11.2.
3.Wait for master SCN
Each instance in the cluster will generate its own SCN and subsequently, using the propagation method,
will resynchronize to the highest SCN in the cluster.
This wait indicates the number of times the foreground processes waited for SCNs to be acknowledged from
other instances in the cluster.
Before Oracle database 10g Release 2, the method of SCN propagation was driven by the parameter
MAX_COMMIT_PROPAGATION_DELAY. Setting this to a value higher than zero uses the Lamport algorithm. Now this
parameter is deprecated and is maintained for backward compatibility only and defaults to zero. This functionality
is now driven by the underscore (hidden) parameter _IMMEDIATE_COMMIT_PROPAGATION and has a Boolean value of
TRUE or FALSE.
When the value of the parameter is set to TRUE (default) Oracle uses the “Block on Commit” (BOC) algorithm for
messaging. Although the method of propagation remains similar to the Lamport algorithm, in the case of BOC, the
global high water mark for the SCNs sent and received is maintained, thereby reducing messaging traffic for global
SCN synchronization and in turn improving overall performance.
4.
In earlier versions such as Oracle 9i, every commit System
Commit Numbers (Commit SCN) is broadcasted to all the nodes, and the log writer is held up
until all the pending redos are written to the disk. Starting with Oracle 10g, the wait is greatly
reduced because the broadcast and commit are asynchronous. This means the system waits until it
is sure that all nodes have seen the Commit SCN. Any message with an SCN greater than
Commit SCN is deemed sufficient.
Before doing a broadcast, the process checks whether it has already received a higher SCN
from that instance. It used the same SCN to determine whether a foreground or an LMS has to
be posted. With Oracle 10g, this is decoupled: an SCN is needed to release foregrounds and an
SCN is needed for shipping buffers. The init.ora parameter “_lgwr_async_broadcasts = true” can
be used to change the broadcast method.
5.
1)The number of outstanding broadcasts increased from 3 to 8.This improves throughput but does not affect latency.
2)LGWR can now issue direct and indirect sends.This frees up the local LMS processes and improves latency.
3)Processing is not limited to LMS0. The SCN is hashed to determine which LMS process will send the message (indirect send) or process the broadcast and send the ACK back to the broadcasting node.This improves general performance by reducing the load on the local (indirect sends) and remote LMS0 processes.
4)Broadcast and acknowledgement messages are no longer blocked by DRM events.This improves BOC latency by eliminating the up to 0.5-second delay introduced by Dynamic Remastering.
5)All Cache Fusion messages can now carry the broadcast SCN.This reduces the need for explicit broadcasts thereby reducing the number of messages on the private interconnect and possibly reducing latency.
观点:
1)很多资料中,谈到在所有节点中的同步是为了数据视图的一致性,其实,仔细想想,如果仅仅是为了各节点间数据的一致性,只需要在commit时将SCN同步给资源的master节点就可以了,没必要同步给所有节点。
2)接续以上问题,那么,commit时将SCN同步给所有节点的目的,更主要是为了在整个cluster内保持SCN的最高水位线,以便cluster中的任意节点可以随时获取到SCN的最高值,避免了过多的信息通信和性能延迟问题。
 

关于Oracle RAC中SCN原理和机制的探索的更多相关文章

  1. Oracle rac架构和原理

        Oracle RAC Oracle Real Application Cluster (RAC,实时应用集群)用来在集群环境下实现多机共享数据库,以保证应用的高可用性:同时可以自动实现并行处理 ...

  2. Oracle RAC/Clusterware 多种心跳heartbeat机制介绍 RAC超时机制分析

    ORACLE RAC中最主要存在2种clusterware集群件心跳 &  RAC超时机制分析: 1.Network Heartbeat 网络心跳 每秒发生一次: 10.2.0.4以后网络心跳 ...

  3. Oracle RAC cache fusion原理測试

    Oracle RAC cache fusion是RAC最核心的工作机制.他把全部实例的SGA虚拟成一个大的SGA区,每当不同的实例请求同样的数据块,这个数据块就须要在实例间进行传递. 那究竟什么时候传 ...

  4. Oracle RAC中的投票算法

    RAC集群中有三台机器,A,B,C A,B,C都会有3票,假设这是A的心跳线出现问题,整个RAC集群就划分为两个paritition, 一个是只有A的partition,一个是B,C组成的partit ...

  5. ORACLE RAC中的oc4j和gsd资源以及RAC相关的进程

    1.RAC相比单实例数据库多出的进程: LMS - Gobal Cache Service Process 全局缓存服务进程 LMD - Global Enqueue Service Daemon 全 ...

  6. Oracle RAC中的一台机器重启以后无法接入集群

          前天有个同事说有套AIX RAC的其中一台服务器重启了操作系统以后,集群资源CSSD的资源一直都在START的状态,检查日志输出有如下内容: [    CSSD][1286]clssnmv ...

  7. ORACLE RAC中一个实例不能随crs自动启动的解决

    现象:在两个节点上做CRS的重启,这个实例都不能随CRS的启动而启动.CRS启动后做crs_start -all可以把没启动的资源起来,而且无报错. 分析:去crsd.log中找原因,发现CRS根本就 ...

  8. Oracle rac集群环境中的特殊问题

    备注:本文摘抄于张晓明<大话Oracle RAC:集群 高可用性 备份与恢复> 因为集群环境需要多个计算机协同工作,要达到理想状态,必须要考虑在集群环境下面临的新挑战. 1.并发控制 在集 ...

  9. Oracle RAC的机制与测试方法

    Oracle RAC的机制与测试方法 标签: rac 机制 测试 2016-05-25 09:54 1150人阅读 评论(0) 收藏 举报  分类: oracle(2)  1.RAC原理 Oracle ...

随机推荐

  1. Nginx教程---01.Nginx入门

    create by 三七二十一 LZ参考视频(年代久远,但万变不离其宗): 链接:https://pan.baidu.com/s/1O_MmN0c3ckM6vbk08n8Qkg 密码:z9zr 01_ ...

  2. 小程序之image图片实现宽度100%,高度自适应

    哇 今天搞了半天  图片一直变形啊啊啊啊 宽度100%   高度给100%   给auto   完全不管用啊啊啊啊 然后最后最终!!!! 首先我们要给我们的图片一个100%的宽度!让它自适应!! .g ...

  3. hdu 3832 Earth Hour bfs

    Earth Hour Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others) Prob ...

  4. phantomjs 下载

    http://phantomjs.org/download.html

  5. Codeforces 931F - Teodor is not a liar!

    931F - Teodor is not a liar! 思路: 最长上升子序列 先差分数组染色 如果存在一个点,被所有区间包含,那么这张图一定是山峰状,如下图: 那么只要分别从前和从后找一个最长非严 ...

  6. Linux 各种软件的安装-mysql篇

    作为一个长期混迹在windows圈的小白,当拿到一个新的linux服务器时,有点手足无措的赶脚.但是万事开头难嘛,Just Do It! 下面记录一下自己安装各种软件时遇到的坑.这一篇先讲mysql ...

  7. spring: beanutils.copyproperties将一个对象的数据塞入到另一个对象中(合并对象)

    spring: beanutils.copyproperties将一个对象的数据塞入到另一个对象中(合并对象) 它的出现原因: BeanUtils提供对Java反射和自省API的包装.其主要目的是利用 ...

  8. 安卓中使用OkHttp发送数据请求的两种方式(同、异步的GET、POST) 示例-- Android基础

    1.首先看一下最终效果的截图,看看是不是你想要的,这个年代大家都很忙,开门见山很重要! 简要说下,点击不同按钮可以实现通过不同的方式发送OkHttp请求,并返回数据,这里请求的是网页,所以返回的都是些 ...

  9. 使用Vue cli3搭建一个用Fetch Api的组件

    系列参考 ,英文原文参考 我的git代码: https://github.com/chentianwei411/Typeahead 目标: 建立一个输入关键字得到相关列表的组件,用Vuejs2和Fet ...

  10. Vue.js简单的状态管理和 Vuex的几个核心概念使用。

    由于状态零散地分布在许多组件和组件之间的交互中,大型应用复杂度也经常逐渐增长. 如果多层组件嵌套使用,传递prop,和事件emit.都很不方便. 不方便对数据的修改进行历史记录.影响后续的调试! 为了 ...