Oracle RAC 入门:集群架构、共享存储与负载均衡原理
一、引言
Oracle Real Application Clusters (RAC) 是 Oracle 数据库企业版的一个关键特性,它允许多个服务器(节点)同时访问同一个数据库,从而实现高可用性、可扩展性和负载均衡。本文将深入浅出地介绍 RAC 的核心概念,包括其集群架构、共享存储机制以及负载均衡与故障转移的工作原理,为读者构建一个坚实的 RAC 基础知识体系。
二、Oracle RAC 集群架构解析
2.1 核心组件
Oracle RAC 集群由多个独立的服务器节点组成,这些节点通过高速网络互连,并共享存储资源。集群的核心组件包括节点、OCR (Oracle Cluster Registry)、Voting Disk 和 Clusterware。
#publish-mermaid-0-1791540899076{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-0-1791540899076 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-0-1791540899076 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-0-1791540899076 .error-icon{fill:#552222;}#publish-mermaid-0-1791540899076 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-0-1791540899076 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-0-1791540899076 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-0-1791540899076 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-0-1791540899076 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-0-1791540899076 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-0-1791540899076 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-0-1791540899076 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-0-1791540899076 .marker.cross{stroke:#333333;}#publish-mermaid-0-1791540899076 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-0-1791540899076 p{margin:0;}#publish-mermaid-0-1791540899076 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-0-1791540899076 .cluster-label text{fill:#333;}#publish-mermaid-0-1791540899076 .cluster-label span{color:#333;}#publish-mermaid-0-1791540899076 .cluster-label span p{background-color:transparent;}#publish-mermaid-0-1791540899076 .label text,#publish-mermaid-0-1791540899076 span{fill:#333;color:#333;}#publish-mermaid-0-1791540899076 .node rect,#publish-mermaid-0-1791540899076 .node circle,#publish-mermaid-0-1791540899076 .node ellipse,#publish-mermaid-0-1791540899076 .node polygon,#publish-mermaid-0-1791540899076 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-0-1791540899076 .rough-node .label text,#publish-mermaid-0-1791540899076 .node .label text,#publish-mermaid-0-1791540899076 .image-shape .label,#publish-mermaid-0-1791540899076 .icon-shape .label{text-anchor:middle;}#publish-mermaid-0-1791540899076 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-0-1791540899076 .rough-node .label,#publish-mermaid-0-1791540899076 .node .label,#publish-mermaid-0-1791540899076 .image-shape .label,#publish-mermaid-0-1791540899076 .icon-shape .label{text-align:center;}#publish-mermaid-0-1791540899076 .node.clickable{cursor:pointer;}#publish-mermaid-0-1791540899076 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-0-1791540899076 .arrowheadPath{fill:#333333;}#publish-mermaid-0-1791540899076 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-0-1791540899076 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-0-1791540899076 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-0-1791540899076 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-0-1791540899076 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-0-1791540899076 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-0-1791540899076 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-0-1791540899076 .cluster text{fill:#333;}#publish-mermaid-0-1791540899076 .cluster span{color:#333;}#publish-mermaid-0-1791540899076 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-0-1791540899076 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-0-1791540899076 rect.text{fill:none;stroke-width:0;}#publish-mermaid-0-1791540899076 .icon-shape,#publish-mermaid-0-1791540899076 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-0-1791540899076 .icon-shape p,#publish-mermaid-0-1791540899076 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-0-1791540899076 .icon-shape .label rect,#publish-mermaid-0-1791540899076 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-0-1791540899076 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-0-1791540899076 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-0-1791540899076 .node .neo-node{stroke:#9370DB;}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node rect,#publish-mermaid-0-1791540899076 [data-look=\”neo\”].cluster rect,#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1791540899076 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1791540899076 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}StorageClusterware ComponentsCluster Nodes
Node 1
Node 2
OCR
Voting Disk
共享存储
此图展示了 RAC 集群的核心组件及其相互关系,节点通过 OCR 和 Voting Disk 进行集群元数据管理,并通过共享存储访问数据库文件。
2.2 集群启动流程
当集群启动时,每个节点都会启动其本地实例,并参与集群的初始化过程。节点间会通过心跳机制进行通信,以确保集群的健康状态。
Voting DiskOCR节点2节点1Voting DiskOCR节点2节点1#publish-mermaid-1-1791540899131{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-1-1791540899131 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-1-1791540899131 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-1-1791540899131 .error-icon{fill:#552222;}#publish-mermaid-1-1791540899131 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-1-1791540899131 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-1-1791540899131 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-1-1791540899131 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-1-1791540899131 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-1-1791540899131 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-1-1791540899131 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-1-1791540899131 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-1-1791540899131 .marker.cross{stroke:#333333;}#publish-mermaid-1-1791540899131 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-1-1791540899131 p{margin:0;}#publish-mermaid-1-1791540899131 .actor{stroke:#9370DB;fill:#ECECFF;stroke-width:1;}#publish-mermaid-1-1791540899131 rect.actor.outer-path[data-look=\”neo\”]{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 rect.note[data-look=\”neo\”]{stroke:#aaaa33;fill:#fff5ad;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 text.actor>tspan{fill:black;stroke:none;}#publish-mermaid-1-1791540899131 .actor-line{stroke:#9370DB;}#publish-mermaid-1-1791540899131 .innerArc{stroke-width:1.5;stroke-dasharray:none;}#publish-mermaid-1-1791540899131 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#publish-mermaid-1-1791540899131 .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#publish-mermaid-1-1791540899131 [id$=\”-arrowhead\”] path{fill:#333;stroke:#333;}#publish-mermaid-1-1791540899131 .sequenceNumber{fill:white;}#publish-mermaid-1-1791540899131 [id$=\”-sequencenumber\”]{fill:#333;}#publish-mermaid-1-1791540899131 [id$=\”-crosshead\”] path{fill:#333;stroke:#333;}#publish-mermaid-1-1791540899131 .messageText{fill:#333;stroke:none;}#publish-mermaid-1-1791540899131 .labelBox{stroke:#9370DB;fill:#ECECFF;filter:none;}#publish-mermaid-1-1791540899131 .labelText,#publish-mermaid-1-1791540899131 .labelText>tspan{fill:black;stroke:none;}#publish-mermaid-1-1791540899131 .loopText,#publish-mermaid-1-1791540899131 .loopText>tspan{fill:black;stroke:none;}#publish-mermaid-1-1791540899131 .sectionTitle,#publish-mermaid-1-1791540899131 .sectionTitle>tspan{fill:black;stroke:none;}#publish-mermaid-1-1791540899131 .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:#9370DB;fill:#9370DB;}#publish-mermaid-1-1791540899131 .note{stroke:#aaaa33;fill:#fff5ad;}#publish-mermaid-1-1791540899131 .noteText,#publish-mermaid-1-1791540899131 .noteText>tspan{fill:black;stroke:none;font-weight:normal;}#publish-mermaid-1-1791540899131 .activation0{fill:#f4f4f4;stroke:#666;}#publish-mermaid-1-1791540899131 .activation1{fill:#f4f4f4;stroke:#666;}#publish-mermaid-1-1791540899131 .activation2{fill:#f4f4f4;stroke:#666;}#publish-mermaid-1-1791540899131 .actorPopupMenu{position:absolute;}#publish-mermaid-1-1791540899131 .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#publish-mermaid-1-1791540899131 .actor-man circle,#publish-mermaid-1-1791540899131 line{fill:#ECECFF;stroke-width:2px;}#publish-mermaid-1-1791540899131 g rect.rect{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));stroke:#9370DB;}#publish-mermaid-1-1791540899131 .node .neo-node{stroke:#9370DB;}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node rect,#publish-mermaid-1-1791540899131 [data-look=\”neo\”].cluster rect,#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1791540899131 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}如果节点数不足,集群无法启动读取集群配置信息读取集群配置信息投票并检查集群状态投票并检查集群状态发送心跳信号返回心跳响应
此序列图描绘了 RAC 集群启动时的关键步骤,节点首先读取 OCR 中的配置,然后通过 Voting Disk 进行投票,最后通过心跳机制维持集群的连通性。
三、共享存储机制详解
3.1 共享存储类型与原理
RAC 的关键在于所有节点都能访问相同的数据库文件。Oracle 提供了多种共享存储解决方案,其中 ASM (Automatic Storage Management) 是最常用和推荐的方式。ASM 是一个卷管理器和文件系统,专为 Oracle 数据库设计。
#publish-mermaid-2-1791540899154{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-2-1791540899154 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-2-1791540899154 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-2-1791540899154 .error-icon{fill:#552222;}#publish-mermaid-2-1791540899154 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-2-1791540899154 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-2-1791540899154 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-2-1791540899154 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-2-1791540899154 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-2-1791540899154 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-2-1791540899154 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-2-1791540899154 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-2-1791540899154 .marker.cross{stroke:#333333;}#publish-mermaid-2-1791540899154 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-2-1791540899154 p{margin:0;}#publish-mermaid-2-1791540899154 g.classGroup text{fill:#9370DB;stroke:none;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:10px;}#publish-mermaid-2-1791540899154 g.classGroup text .title{font-weight:bolder;}#publish-mermaid-2-1791540899154 .cluster-label text{fill:#333;}#publish-mermaid-2-1791540899154 .cluster-label span{color:#333;}#publish-mermaid-2-1791540899154 .cluster-label span p{background-color:transparent;}#publish-mermaid-2-1791540899154 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-2-1791540899154 .cluster text{fill:#333;}#publish-mermaid-2-1791540899154 .cluster span{color:#333;}#publish-mermaid-2-1791540899154 .nodeLabel,#publish-mermaid-2-1791540899154 .edgeLabel{color:#131300;}#publish-mermaid-2-1791540899154 .noteLabel .nodeLabel,#publish-mermaid-2-1791540899154 .noteLabel .edgeLabel{color:black;}#publish-mermaid-2-1791540899154 .edgeLabel .label rect{fill:#ECECFF;}#publish-mermaid-2-1791540899154 .label text{fill:#131300;}#publish-mermaid-2-1791540899154 .labelBkg{background:#ECECFF;}#publish-mermaid-2-1791540899154 .edgeLabel .label span{background:#ECECFF;}#publish-mermaid-2-1791540899154 .classTitle{font-weight:bolder;}#publish-mermaid-2-1791540899154 .node rect,#publish-mermaid-2-1791540899154 .node circle,#publish-mermaid-2-1791540899154 .node ellipse,#publish-mermaid-2-1791540899154 .node polygon,#publish-mermaid-2-1791540899154 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1;}#publish-mermaid-2-1791540899154 .divider{stroke:#9370DB;stroke-width:1;}#publish-mermaid-2-1791540899154 g.clickable{cursor:pointer;}#publish-mermaid-2-1791540899154 g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#publish-mermaid-2-1791540899154 g.classGroup line{stroke:#9370DB;stroke-width:1;}#publish-mermaid-2-1791540899154 .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#publish-mermaid-2-1791540899154 .classLabel .label{fill:#9370DB;font-size:10px;}#publish-mermaid-2-1791540899154 .relation{stroke:#333333;stroke-width:1;fill:none;}#publish-mermaid-2-1791540899154 .dashed-line{stroke-dasharray:3;}#publish-mermaid-2-1791540899154 .dotted-line{stroke-dasharray:1 2;}#publish-mermaid-2-1791540899154 [id$=\”-compositionStart\”],#publish-mermaid-2-1791540899154 .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-compositionEnd\”],#publish-mermaid-2-1791540899154 .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-dependencyStart\”],#publish-mermaid-2-1791540899154 .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-dependencyEnd\”],#publish-mermaid-2-1791540899154 .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-extensionStart\”],#publish-mermaid-2-1791540899154 .extension{fill:transparent!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-extensionEnd\”],#publish-mermaid-2-1791540899154 .extension{fill:transparent!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-aggregationStart\”],#publish-mermaid-2-1791540899154 .aggregation{fill:transparent!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-aggregationEnd\”],#publish-mermaid-2-1791540899154 .aggregation{fill:transparent!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-lollipopStart\”],#publish-mermaid-2-1791540899154 .lollipop{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 [id$=\”-lollipopEnd\”],#publish-mermaid-2-1791540899154 .lollipop{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-2-1791540899154 .edgeTerminals{font-size:11px;line-height:initial;}#publish-mermaid-2-1791540899154 .classTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-2-1791540899154 .edgeLabel[data-look=\”neo\”]{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-2-1791540899154 .edgeLabel[data-look=\”neo\”] p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-2-1791540899154 .edgeLabel[data-look=\”neo\”] rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-2-1791540899154 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-2-1791540899154 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-2-1791540899154 .node .neo-node{stroke:#9370DB;}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node rect,#publish-mermaid-2-1791540899154 [data-look=\”neo\”].cluster rect,#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1791540899154 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1791540899154 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}管理包含
ASM_Instance
+启动
+管理磁盘组
+提供I/O服务
Disk_Group
+磁盘组名
+文件系统
+余模式(如 Normal, High)
ASM_Disk
+磁盘设备路径
+磁盘大小
+状态(online, offline)
该类图清晰地展示了 ASM 的核心组件结构,ASM 实例管理磁盘组,而磁盘组由多个 ASM 磁盘组成,为数据库提供统一的存储接口。
3.2 存储访问流程
当一个 RAC 节点需要读写数据库文件时,它通过其本地 ASM 实例与共享存储进行交互。ASM 负责将 I/O 请求分发到合适的物理磁盘上。
#publish-mermaid-3-1791540899241{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-3-1791540899241 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-3-1791540899241 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-3-1791540899241 .error-icon{fill:#552222;}#publish-mermaid-3-1791540899241 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-3-1791540899241 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-3-1791540899241 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-3-1791540899241 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-3-1791540899241 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-3-1791540899241 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-3-1791540899241 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-3-1791540899241 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-3-1791540899241 .marker.cross{stroke:#333333;}#publish-mermaid-3-1791540899241 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-3-1791540899241 p{margin:0;}#publish-mermaid-3-1791540899241 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-3-1791540899241 .cluster-label text{fill:#333;}#publish-mermaid-3-1791540899241 .cluster-label span{color:#333;}#publish-mermaid-3-1791540899241 .cluster-label span p{background-color:transparent;}#publish-mermaid-3-1791540899241 .label text,#publish-mermaid-3-1791540899241 span{fill:#333;color:#333;}#publish-mermaid-3-1791540899241 .node rect,#publish-mermaid-3-1791540899241 .node circle,#publish-mermaid-3-1791540899241 .node ellipse,#publish-mermaid-3-1791540899241 .node polygon,#publish-mermaid-3-1791540899241 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-3-1791540899241 .rough-node .label text,#publish-mermaid-3-1791540899241 .node .label text,#publish-mermaid-3-1791540899241 .image-shape .label,#publish-mermaid-3-1791540899241 .icon-shape .label{text-anchor:middle;}#publish-mermaid-3-1791540899241 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-3-1791540899241 .rough-node .label,#publish-mermaid-3-1791540899241 .node .label,#publish-mermaid-3-1791540899241 .image-shape .label,#publish-mermaid-3-1791540899241 .icon-shape .label{text-align:center;}#publish-mermaid-3-1791540899241 .node.clickable{cursor:pointer;}#publish-mermaid-3-1791540899241 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-3-1791540899241 .arrowheadPath{fill:#333333;}#publish-mermaid-3-1791540899241 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-3-1791540899241 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-3-1791540899241 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-3-1791540899241 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-3-1791540899241 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-3-1791540899241 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-3-1791540899241 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-3-1791540899241 .cluster text{fill:#333;}#publish-mermaid-3-1791540899241 .cluster span{color:#333;}#publish-mermaid-3-1791540899241 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-3-1791540899241 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-3-1791540899241 rect.text{fill:none;stroke-width:0;}#publish-mermaid-3-1791540899241 .icon-shape,#publish-mermaid-3-1791540899241 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-3-1791540899241 .icon-shape p,#publish-mermaid-3-1791540899241 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-3-1791540899241 .icon-shape .label rect,#publish-mermaid-3-1791540899241 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-3-1791540899241 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-3-1791540899241 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-3-1791540899241 .node .neo-node{stroke:#9370DB;}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node rect,#publish-mermaid-3-1791540899241 [data-look=\”neo\”].cluster rect,#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1791540899241 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1791540899241 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
应用请求
节点1
ASM Instance 1
应用请求
节点2
ASM Instance 2
Shared Disk 1
Shared Disk 2
数据库文件
此流程图演示了节点如何通过各自的 ASM 实例访问共享存储上的数据库文件,实现了数据的统一和一致性。
四、负载均衡与故障转移原理
4.1 负载均衡机制
RAC 通过连接负载均衡和服务器负载均衡来优化资源使用。客户端连接可以自动分发到负载较轻的节点上,从而提高整体性能。
#publish-mermaid-4-1791540899295{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-4-1791540899295 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-4-1791540899295 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-4-1791540899295 .error-icon{fill:#552222;}#publish-mermaid-4-1791540899295 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-4-1791540899295 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-4-1791540899295 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-4-1791540899295 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-4-1791540899295 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-4-1791540899295 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-4-1791540899295 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-4-1791540899295 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-4-1791540899295 .marker.cross{stroke:#333333;}#publish-mermaid-4-1791540899295 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-4-1791540899295 p{margin:0;}#publish-mermaid-4-1791540899295 .pieCircle{stroke:black;stroke-width:2px;opacity:0.7;}#publish-mermaid-4-1791540899295 .pieCircle.highlighted{scale:1.05;opacity:1;}#publish-mermaid-4-1791540899295 .pieCircle.highlightedOnHover:hover{transition-duration:250ms;scale:1.05;opacity:1;}#publish-mermaid-4-1791540899295 .pieOuterCircle{stroke:black;stroke-width:2px;fill:none;}#publish-mermaid-4-1791540899295 .pieTitleText{text-anchor:middle;font-size:25px;fill:black;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#publish-mermaid-4-1791540899295 .slice{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;fill:#333;font-size:17px;}#publish-mermaid-4-1791540899295 .legend text{fill:black;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:17px;}#publish-mermaid-4-1791540899295 .node .neo-node{stroke:#9370DB;}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node rect,#publish-mermaid-4-1791540899295 [data-look=\”neo\”].cluster rect,#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1791540899295 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1791540899295 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}50%50%连接负载分布Node 1Node 2
饼图直观地展示了在理想负载均衡状态下,客户端连接均匀分布在两个节点上的情况,每个节点承担 50% 的负载。
4.2 故障转移流程
当集群中的某个节点发生故障时,RAC 能够自动将该节点上的服务(如数据库实例)转移到其他健康节点上,这个过程称为故障转移。
#publish-mermaid-5-1791540899304{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-5-1791540899304 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-5-1791540899304 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-5-1791540899304 .error-icon{fill:#552222;}#publish-mermaid-5-1791540899304 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-5-1791540899304 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-5-1791540899304 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-5-1791540899304 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-5-1791540899304 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-5-1791540899304 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-5-1791540899304 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-5-1791540899304 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-5-1791540899304 .marker.cross{stroke:#333333;}#publish-mermaid-5-1791540899304 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-5-1791540899304 p{margin:0;}#publish-mermaid-5-1791540899304 defs [id$=\”-barbEnd\”]{fill:#333333;stroke:#333333;}#publish-mermaid-5-1791540899304 g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#publish-mermaid-5-1791540899304 g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#publish-mermaid-5-1791540899304 g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#publish-mermaid-5-1791540899304 g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#publish-mermaid-5-1791540899304 g.stateGroup line{stroke:#333333;stroke-width:1;}#publish-mermaid-5-1791540899304 .transition{stroke:#333333;stroke-width:1;fill:none;}#publish-mermaid-5-1791540899304 .stateGroup .composit{fill:white;border-bottom:1px;}#publish-mermaid-5-1791540899304 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#publish-mermaid-5-1791540899304 .state-note{stroke:#aaaa33;fill:#fff5ad;}#publish-mermaid-5-1791540899304 .state-note text{fill:black;stroke:none;font-size:10px;}#publish-mermaid-5-1791540899304 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#publish-mermaid-5-1791540899304 .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#publish-mermaid-5-1791540899304 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-5-1791540899304 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-5-1791540899304 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-5-1791540899304 .edgeLabel .label text{fill:#333;}#publish-mermaid-5-1791540899304 .label div .edgeLabel{color:#333;}#publish-mermaid-5-1791540899304 .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#publish-mermaid-5-1791540899304 .node circle.state-start{fill:#333333;stroke:#333333;}#publish-mermaid-5-1791540899304 .node .fork-join{fill:#333333;stroke:#333333;}#publish-mermaid-5-1791540899304 .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#publish-mermaid-5-1791540899304 .end-state-inner{fill:white;stroke-width:1.5;}#publish-mermaid-5-1791540899304 .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-5-1791540899304 .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-5-1791540899304 [id$=\”-barbEnd\”]{fill:#333333;}#publish-mermaid-5-1791540899304 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-5-1791540899304 .cluster-label,#publish-mermaid-5-1791540899304 .nodeLabel{color:#131300;}#publish-mermaid-5-1791540899304 .statediagram-cluster rect.outer{rx:5px;ry:5px;}#publish-mermaid-5-1791540899304 .statediagram-state .divider{stroke:#9370DB;}#publish-mermaid-5-1791540899304 .statediagram-state .title-state{rx:5px;ry:5px;}#publish-mermaid-5-1791540899304 .statediagram-cluster.statediagram-cluster .inner{fill:white;}#publish-mermaid-5-1791540899304 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#publish-mermaid-5-1791540899304 .statediagram-cluster .inner{rx:0;ry:0;}#publish-mermaid-5-1791540899304 .statediagram-state rect.basic{rx:5px;ry:5px;}#publish-mermaid-5-1791540899304 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#publish-mermaid-5-1791540899304 .note-edge{stroke-dasharray:5;}#publish-mermaid-5-1791540899304 .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#publish-mermaid-5-1791540899304 .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#publish-mermaid-5-1791540899304 .statediagram-note text{fill:black;}#publish-mermaid-5-1791540899304 .statediagram-note .nodeLabel{color:black;}#publish-mermaid-5-1791540899304 .statediagram .edgeLabel{color:red;}#publish-mermaid-5-1791540899304 [id$=\”-dependencyStart\”],#publish-mermaid-5-1791540899304 [id$=\”-dependencyEnd\”]{fill:#333333;stroke:#333333;stroke-width:1;}#publish-mermaid-5-1791540899304 .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].statediagram-cluster rect.outer{rx:5px;ry:5px;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1791540899304 .node .neo-node{stroke:#9370DB;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node rect,#publish-mermaid-5-1791540899304 [data-look=\”neo\”].cluster rect,#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1791540899304 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1791540899304 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}正常运行节点故障开始恢复重新加入集群彻底故障
Active
Failed
Recovery
状态图描述了节点故障后的状态转换过程,从正常运行到故障,再到尝试恢复或最终退出集群。
五、最小化示例与注意事项
5.1 环境实体关系
一个典型的两节点 RAC 环境包含以下核心实体及其关系。
#publish-mermaid-6-1791540899346{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-6-1791540899346 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-6-1791540899346 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-6-1791540899346 .error-icon{fill:#552222;}#publish-mermaid-6-1791540899346 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-6-1791540899346 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-6-1791540899346 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-6-1791540899346 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-6-1791540899346 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-6-1791540899346 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-6-1791540899346 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-6-1791540899346 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-6-1791540899346 .marker.cross{stroke:#333333;}#publish-mermaid-6-1791540899346 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-6-1791540899346 p{margin:0;}#publish-mermaid-6-1791540899346 .entityBox{fill:#ECECFF;stroke:#9370DB;}#publish-mermaid-6-1791540899346 .relationshipLabelBox{fill:hsl(80, 100%, 96.2745098039%);opacity:0.7;background-color:hsl(80, 100%, 96.2745098039%);}#publish-mermaid-6-1791540899346 .relationshipLabelBox rect{opacity:0.5;}#publish-mermaid-6-1791540899346 .labelBkg{background-color:rgba(248.6666666666, 255, 235.9999999999, 0.5);}#publish-mermaid-6-1791540899346 .edgeLabel{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-6-1791540899346 .edgeLabel .label rect{fill:rgba(232,232,232, 0.8);}#publish-mermaid-6-1791540899346 .edgeLabel .label text{fill:#333;}#publish-mermaid-6-1791540899346 .edgeLabel .label{fill:#9370DB;font-size:14px;}#publish-mermaid-6-1791540899346 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-6-1791540899346 .edge-pattern-dashed{stroke-dasharray:8,8;}#publish-mermaid-6-1791540899346 .node rect,#publish-mermaid-6-1791540899346 .node circle,#publish-mermaid-6-1791540899346 .node ellipse,#publish-mermaid-6-1791540899346 .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-6-1791540899346 .relationshipLine{stroke:#333333;stroke-width:1px;fill:none;}#publish-mermaid-6-1791540899346 .marker{fill:none!important;stroke:#333333!important;stroke-width:1;}#publish-mermaid-6-1791540899346 [data-look=neo].labelBkg{background-color:rgba(248.6666666666, 255, 235.9999999999, 0.5);}#publish-mermaid-6-1791540899346 .node .neo-node{stroke:#9370DB;}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node rect,#publish-mermaid-6-1791540899346 [data-look=\”neo\”].cluster rect,#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1791540899346 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1791540899346 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}包含运行使用
RAC_Cluster
Node
Database_Instance
Shared_Storage
ER图描绘了RAC环境中的核心实体及其关系,集群包含节点,节点运行数据库实例,集群使用共享存储。
5.2 关键配置与注意事项
| OCR/Voting Disk | 存储集群元数据 | 必须使用共享存储,且 Voting Disk 至少需要 3 份副本以保证高可用 |
| Private Interconnect | 节点间通信 | 建议使用专用高速网络(如 InfiniBand),避免与公共网络争抢带宽 |
| Public Network | 客户端连接 | 需配置负载均衡器(如 F5, HAProxy)以实现连接分发 |
| ASM Disk | 共享存储设备 | 所有节点必须能访问,且设备大小和性能需一致 |
| TAF (Transparent Application Failover) | 应用透明故障转移 | 需在客户端配置,确保应用能自动重连到新节点 |
最小示例(概念性):
注意事项:
- RAC 的部署和运维复杂度远高于单实例数据库,需要专业的 DBA 团队。
- 网络配置(私有和公共)是 RAC 成功的关键,必须保证低延迟和高带宽。
- 定期进行集群和数据库的健康检查与备份恢复演练至关重要。



