Rac 的GES/GCS原理(4)

来源:互联网 发布:网络资讯 编辑:程序博客网 时间:2024/05/01 08:59

资源的信息被保存在 GRD中,由GCS、GES 来管理。GRD 是一个内存结构,在所有的实例中分配。GRD的目的是提供优化的表现。每个实例负责对SGA中部分的GRD信息进行管理,因此,访问GRD的开销在RAC的所有实例中共享。GRD中的信息对于所有的实例都是可以访问的,如果这个信息是在本地,可以通过直接访问;如果不在本地,可以通过和远程节点的后台进程通信来访问。GRD 也被设计来提供容错。如果发生一个节点失败事件,GRD将被剩下来的实例所重构。在恢复之后,只要还有一个活动的实例。这个共享的数据库还是可以被访问的。GCS和GES 被设计来在多个并行节点的失败情况下恢复。一个节点加入或离开群集 都会导致GRD被重建。GRD的动态执行将 方便RAC的任何实例都可以在任何时候以任何顺序启停。节点关系的任何改动都将导致群集信息的重构。每个资源初始时候都是通过hash 算法来指派给某一个实例的。这个实例叫做资源属主(resource master)。某个特定资源的 master 实例可能在每次群集信息重构(cluster reconfiguration)的时候改变,这种改动方式叫做静态资源管理。在oracle 10.1以及以上,资源能够通过使用模式来被重新指定属主,目的是降低网络访问和随之的CPU资源损耗。这种叫做动态资源管理。在ORACLE 10.1上,GCS 将定时的评估资源的管理情况。如果它发先某个实例和某个数据文件上的数据块资源之间有密切的关系,那么这个文件上的所有块的master 属主将被动态分配给这个实例。在ORACLE 10.2以及以上,动态资源属主管理(dynamic resource mastering)是在段级别来实施的,GCS 发现了某个实例和一个segment上的数据有密切的联系后,将启动重新指派属主(initiate remastering)的动作。每个实例保存了GRD 的一部分,它包含了全局资源的某个子集的当前状态。这个信息,在实例进行失败恢复的时候或群集信息重配的时候都被使用,包含有数据块的识别符号,数据块的当前版本的位置,该数据块被任何实例持有的模式,模式可以是null(N),shared(S),或exclusive(X).而每个持有数据块的角色可以是本地的或者全局的。

当一个实例申请一个资源的时候,比如某个数据块,它首先会和资源属主(resource master)进行沟通,确定资源的当前状态。如果这个资源目前不被使用,则可以本地获取。如果这个资源正在被使用,资源属主将向占用此资源的实例要求把资源发送给要求资源的实例。如果资源随后被1个或多个实例要求修改,GRD 将被修改并申明这个资源是全局资源。如果本地实例需要某个数据块的读一致性版本,它会先联系资源属主来确认是否这个版本的数据块是否在远程节点的buffer cache中有同样版本或更新版本的数据块。如果这个数据块存在,那么资源属主将对远程实例发送一个要求,要求把读一致性版本的数据块
发送到本地。如果远程实例持有要求SCN 时间点版本的数据块,它将立即发送数据块。如果远程实例持有一个更新的数据块版本,它将建立数据块的一个副本,然后应用undo信息把这个副本回滚到要求的时间点scn。当某个 RAC 实例要求一个数据块,这个数据块当前正在被本地实例修改,那么这个需求在RAC实例的处理方式 将和本地单实例处理方式一直。然而,当一个RAC实例要求某个被别的实例跟新的数据块的时候,那么这个块信息将首先被定位,然后准备,最后通过远程实例的GCS 的后台进程LMSn 传输到本地。

 

 

一个数据块可以存在多个buffer cache中。它可以被多个实例以不同的模式持有,持有的模式要依据这个数据块的状态,是被读还是被更新。GCS使用持有模式来决定是否实例当前拥有修改这个数据块的权限。有三种持有模式:null 模式(N),共享模式(S),排他模式(X)。这些模式在下表中可以看到

 

Null  N                                         没有访问权限
Shared S                                     共享访问权限,可以被多个实例读,不能被任何实例修改。
Exclusive X                                   持有X模式的实例有权限可以修改这个数据块,只有一个实例
                                                   能够以X模式来访问资源

 

你可以通过 访问V$BH动态视图的STATUS列来查看某个实例的buffer 在buffer cache中的状态。STATUS 列包含下表22-5所示的信息:

V$BH 状态列数值
资源属主的状态信息
FREE                                                      Buffer当前没有在使用状态
CR NULL                                                 一致性读(只读)
SCUR S                                                  共享当前的数据块(只读)
XCUR X                                                  对当前块的专用模式(可以被修改)
PI     NULL                                              旧映象(只读)

 

SCUR 和 PI 这两个状态是RAC独有的。数据块被某个实例修改前,必须先把它修改为XCUR状态。在一个群集数据库 buffer cache中,可能有某个块的多个拷贝,但任何时间点但是其中只有一个拷贝是出于XCUR状态。

 

 

Global Resource Directory (GRD)
Information about resources is maintained in the GRD by the GCS and GES. The GRD is a memory
structure that is distributed across all instances.
资源的信息被保存在 GRD中,由GCS、GES 来管理。GRD 是一个内存结构,在所有的实例中分配。

The GRD is designed to provide enhanced runtime performance. Each instance is responsible for maintaining part of the GRD in its SGA; therefore, the overhead of maintaining the GRD is shared between all active instances.
GRD的目的是提供优化的表现。每个实例负责对SGA中部分的GRD信息进行管理,因此,访问GRD的开销在RAC的所有实例中共享。

 Information in the GRD is available to all instances, either directly if that information is maintained locally, or indirectly through communication with background processes on the remote node.
GRD中的信息对于所有的实例都是可以访问的,如果这个信息是在本地,可以通过直接访问;如果不在本地,可以通过和远程节点的后台进程通信来访问。

The GRD is also designed to provide fault tolerance. In the event of a node failure, the GRD is
reconstructed by the remaining instances.
GRD 也被设计来提供容错。如果发生一个节点失败事件,GRD将被剩下来的实例所重构。

 As long as at least one active instance remains after recovery is completed, the shared database will still be accessible. GCS and GES are designed to be resilient in the event of multiple concurrent node failures.
在恢复之后,只要还有一个活动的实例。这个共享的数据库还是可以被访问的。GCS和GES 被设计来在多个并行节点的失败情况下恢复。

The GRD is reconstructed whenever a node joins or leaves the cluster. The dynamic implementation
of the GRD enables RAC instances to start and stop at any time and in any order. Every change
in node membership results in a cluster reconfiguration.
一个节点加入或离开群集 都会导致GRD被重建。GRD的动态执行将 方便RAC的任何实例都可以
在任何时候以任何顺序启停。节点关系的任何改动都将导致群集信息的重构。

Each resource is initially mapped onto an instance using a hashing algorithm. This instance is
called the resource master. The master instance for a specific resource may change each time there
is a cluster reconfiguration, which is known as static resource mastering.
每个资源初始时候都是通过hash 算法来指派给某一个实例的。这个实例叫做资源属主(resource master)。某个特定资源的 master 实例可能在每次群集信息重构(cluster reconfiguration)的时候改变,这种改动方式叫做静态资源管理。

In Oracle 10.1 and above, resources can also be remastered based on usage patterns to reduce
network traffic and the consequent CPU resource consumption. This is known as dynamic resource
mastering.
在oracle 10.1以及以上,资源能够通过使用模式来被重新指定属主,目的是降低网络访问和随之的
CPU资源损耗。这种叫做动态资源管理。

In Oracle 10.1, GCS evaluates resource mastering periodically. If it detects a high level of
affinity between a particular instance and blocks from a specific data file, then all blocks in the file
may be remastered by that instance.
在ORACLE 10.1上,GCS 将定时的评估资源的管理情况。如果它发先某个实例和某个数据文件
上的数据块资源之间有密切的关系,那么这个文件上的所有块的master 属主将被动态分配给这个
实例。

 In Oracle 10.2 and above, dynamic resource mastering is performed on a segment level, and GCS will initiate remastering if there is a high level of affinity between a particular instance and blocks from a specific segment.
在ORACLE 10.2以及以上,动态资源属主管理(dynamic resource mastering)是在段级别来实施的,GCS 发现了某个实例和一个segment上的数据有密切的联系后,将启动重新指派属主(initiate remastering)的动作。


Each instance maintains a portion of the GRD containing information about the current status
of a subset of the global resources. This information, which is used during instance failure recovery
and cluster reconfigurations, includes data block identifiers, the location of the current version of
the data block, modes in which the data block is held by each instance, which can be null (N), shared (S),or exclusive (X), and the role in which each instance is holding the data block, which can be local or
global.
每个实例保存了GRD 的一部分,它包含了全局资源的某个子集的当前状态。这个信息,在
实例进行失败恢复的时候或群集信息重配的时候都被使用,包含有数据块的识别符号,数据块
的当前版本的位置,该数据块被任何实例持有的模式,模式可以是null(N),shared(S),或
exclusive(X).而每个持有数据块的角色可以是本地的或者全局的。

When an instance requests a resource, such as a data block, it first contacts the resource master
to ascertain the current status of the resource. If the resource is not currently in use, it can be acquired locally.

当一个实例申请一个资源的时候,比如某个数据块,它首先会和资源属主(resource master)进行沟通,确定资源的当前状态。如果这个资源目前不被使用,则可以本地获取。

 

If the resource is currently in use, then the resource master will request that the holding
instance passes the resource to the requesting resource.
如果这个资源正在被使用,资源属主将向占用此资源的实例要求把资源发送给要求资源的实例。

 If the resource is subsequently required for modification by one or more instances, the GRD will be modified to indicate that the resource is held globally.
如果资源随后被1个或多个实例要求修改,GRD 将被修改并申明这个资源是全局资源。


If the local instance requires a read-consistent version of a block, it still contacts the resource
master to ascertain if a version of the block that has the same or a more recent SCN exists in the buffercache of any remote instance.

如果本地实例需要某个数据块的读一致性版本,它会先联系资源属主来确认是否这个版本的数据块
是否在远程节点的buffer cache中有同样版本或更新版本的数据块。

 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 and applies undo to the copy to revert it to the correct SCN.
如果远程实例持有要求SCN 时间点版本的数据块,它将立即发送数据块。如果远程实例持有一个
更新的数据块版本,它将建立数据块的一个副本,然后应用undo信息把这个副本回滚到要求
的时间点scn。

 

When a RAC instance requires a data block that is currently being updated on the local instance,
the request is processed in exactly the same way that it would be in a single instance database.
However, when a RAC instance requests a data block that is being updated on another instance, the
block images are located, prepared, and transmitted by the GCS background processes (LMSn) on theremote instance.

当某个 RAC 实例要求一个数据块,这个数据块当前正在被本地实例修改,那么这个需求
在RAC实例的处理方式 将和本地单实例处理方式一直。然而,当一个RAC实例要求某个
被别的实例跟新的数据块的时候,那么这个块信息将首先被定位,然后准备,最后通过
远程实例的GCS 的后台进程LMSn 传输到本地。

 

Resource Modes
A data block can exist in multiple buffer caches. It can be held by multiple instances in different
modes depending on whether the block is being read or updated by the instance.

一个数据块可以存在多个buffer cache中。它可以被多个实例以不同的模式持有,持有的模式
要依据这个数据块的状态,是被读还是被更新。

GCS uses the resource mode to determine whether the instance currently holding the block can modify it. There are three modes: null (N) mode, shared (S) mode, and exclusive (X) mode. These modes are summarized in Table 22-4.

GCS使用这种持有模式来决定是否实例当前拥有修改这个数据块的权限。有三种持有模式:null 模式(N),共享模式(S),排他模式(X)。这些模式在下表中可以看到:

Table 22-4. Resource Modes
Resource Mode Identifier Description
Null N                     No access rights.
Shared S                   Shared resources can be read by multiple instances but
                                                  cannot be updated by any instance.
Exclusive X                An instance holding a block in exclusive mode can modify
                                                  the block. Only one instance can hold the resource in
                                                  exclusive mode.

Null  N                                         没有访问权限
Shared S                                     共享访问权限,可以被多个实例读,不能被任何实例修改。
Exclusive X                                 持有X模式的实例有权限可以修改这个数据块,只有一个实例
                                                   能够以X模式来访问资源

You can verify the current state of any buffer in the buffer cache of an instance by selecting the
STATUS column from the V$BH dynamic performance view. The STATUS column can contain the values
shown in Table 22-5.

你可以通过 访问V$BH动态视图的STATUS列来查看某个实例的buffer 在buffer cache中的状态。
STATUS 列包含下表22-5所示的信息:

Table 22-5. V$BH Status Column Values
Status Resource Mode Description
FREE                              Buffer is not currently in use
CR NULL                           Consistent read (read only)
SCUR S                            Shared current block (read only)
XCUR X                            Exclusive current block (can be modified)
PI NULL                           Past image (read only)

V$BH 状态列数值
资源属主的状态信息
FREE                                                      Buffer当前没有在使用状态
CR NULL                                                 一致性读(只读)
SCUR S                                                  共享当前的数据块(只读)
XCUR X                                                  对当前块的专用模式(可以被修改)
PI     NULL                                              旧映象(只读)

The SCUR and PI states are RAC specific. The XCUR state must be assigned before the block can
be modified. There can be only one copy of a block in the XCUR state in any buffer cache in the cluster
database at any one time

SCUR 和 PI 这两个状态是RAC独有的。数据块被某个实例修改前,必须先把它修改为XCUR状态。
在一个群集数据库 buffer cache中,可能有某个块的多个拷贝,但任何时间点但是其中只有一个拷贝是出于XCUR状态。

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 ipad来不了机怎么办 深圳车牌租用怎么办的 电脑连wiwf老掉线怎么办 电脑要设置密码怎么办 苹果笔记本电脑忘记密码怎么办 换了外屏有缝隙怎么办 苹果7屏幕松动怎么办 平板电脑屏幕一直闪怎么办 平板电脑屏幕模糊了怎么办 平板电脑模糊怎么办啊 苹果没有声音了怎么办 微信视频回声怎么办 苹果手机总卡机不动怎么办 苹果手机不掉电怎么办 iphonex屏幕漏液怎么办 苹果6sp充不进电怎么办 iphone6充电越少怎么办 苹果6不能充电怎么办 脸部苹果肌很大怎么办 液晶屏上有划痕怎么办 苹果手机屏幕翘起来怎么办? iphone5s翘屏了怎么办 lpad触屏失灵怎么办 平板一直重启怎么办 苹果平板老死机怎么办 华为屏幕反应慢怎么办 平板屏幕没反应怎么办 iPadmini3触屏了怎么办 联想电脑触摸屏没反应怎么办 电脑触摸屏没反应怎么办 换屏后屏幕乱跳怎么办 联想平板进不去系统怎么办 平板触摸屏坏了怎么办 苹果6触摸不灵敏怎么办 5s home失灵怎么办? 平板触控失灵怎么办 ipad触摸屏坏了怎么办 ipad屏幕颠倒了怎么办 ipad电池坏了怎么办 手机碎屏使屏幕失灵怎么办 电磁炉触屏不灵怎么办