今天看书时看到了关于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. HDU 5726 GCD(RMQ+二分)

    http://acm.split.hdu.edu.cn/showproblem.php?pid=5726 题意:给出一串数字,现在有多次询问,每次询问输出(l,r)范围内所有数的gcd值,并且输出有多 ...

  2. HDU 4821 String(BKDRHash)

    http://acm.hdu.edu.cn/showproblem.php?pid=4821 题意:给出一个字符串,现在问你可以找出多少个长度为M*L的子串,该子串被分成L个段,并且每个段的字符串都是 ...

  3. hdu 3836 Equivalent Sets trajan缩点

    Equivalent Sets Time Limit: 12000/4000 MS (Java/Others)    Memory Limit: 104857/104857 K (Java/Other ...

  4. c++ demo

    #include "stdafx.h" #include <boost\version.hpp> #include <boost\config.hpp> # ...

  5. netstat 在windows下和Linux下查看网络连接和端口占用

    假设忽然起个服务,告诉我8080端口被占用了,OK,我要去看一下是什么服务正在占用着,能不能杀 先假设我是在Windows下: 第一列: Proto 协议 第二列: 本地地址[ip+端口] 第三列:远 ...

  6. Qt532.QString::split()

    1.效果 和 JS里面 貌似是一样的 1.1.QString 编码转换(https://www.cnblogs.com/CodeSkill/p/5082447.html) 2.代码: void Mai ...

  7. sort-归并排序

    void sort_merge(vector<int> &v,int left,int right) { if(left>=right) return; int mid=(l ...

  8. Linux环境下配置及启动Hadoop(伪集群)

    1.下载tag软件包后,我习惯放到software文件夹下,并建立app文件夹2.通过tar -zxvf hadoop-2.6.0-cdh5.7.0.tar.gz -C ~/app/ 命令解压到app ...

  9. mint fcitx搜狗输入法不显示输入框,其他输入法丢失皮肤

    mint18.3 因为这个原因刚刚重装过,结果一不留神又这样了. 这次原因相对清晰: 双屏显示下,合屏睡眠,打开之后,发现卡死了.屏幕分辨率改变了似的. 然后再重启,发现输入法悬浮框变大了,然后输入法 ...

  10. c# 7.0 学习笔记

    refer : https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7 out 可以写在里面了 // int result ...