Oracle RAC OCR 与健忘症
OCR就好比Windows的一个注册表,存储了所有与集群,RAC数据库相关的配置信息。而且是公用的配置,也就是说多个节点共享相同的配置
OCR就好比Windows的一个注册表,存储了所有与集群,,RAC数据库相关的配置信息。而且是公用的配置,也就是说多个节点共享相同的配置信息。因此该配置应当存储于共享磁盘。本文主要基于Oracle 10g RAC描述了集群的OCR以及OCR产生的健忘问题。
一、OCR的特点
类似于Windows注册表,用于存储所有与集群,RAC数据库相关的配置信息
被多个节点所共享,因此,只能存储于共享磁盘。支持单disk以及镜像方式来存放。大小通常100MB-1GB。
在Oracle 10g中,只能存储于裸设备或者ocfs文件系统,以及nfs,gfs文件系统。Oracle 11g中可以直接存放在asm中。
整个集群及RAC数据库配置需要在OCR中来进行维护。换句话说,就像windows注册表的导入导出,修改、更新键值等。
通常情况下,OCR中的配置信息会随着使用工具对其进行自动更新。如SRVCTL,DBCA,OEM,NETCA等。
而OCR的配置与维护则通常包括OCR的校验,备份,查看OCR的内容,添加移出OCR文件,重定位,修复OCR文件。
OCR磁盘最多只能有两个,一个Primary OCR 和一个Mirror OCR,两个OCR 磁盘互为镜像,以防止OCR 磁盘的单点故障。
注:集群,我们通常指的是clusterware,而RAC数据库,即是基于集群之上的数据库。
二、OCR包含的内容
OCR中通常包含下列内容
节点成员信息
数据库实例,节点,以及其他的映射关系
ASM
资源配置信息(vip,services等等)
服务特性(Service characteristics)
Oracle集群中相关进程的信息
CRS控制的第三方应用程序信息
三、OCR的工作过程
由于OCR存放于共享存储,因此在Cluster中的每个节点都通过本地OCR进程访问OCR缓存在其内存中维护着的一个副本。同时由于对OCR
的所有操作必须确保OCR内容完整性,所以在ORACLE Clusterware运行过程中,并不是所有结点都能操作OCR Disk。 只有一个OCR进程对共
享存储中的OCR进行读写操作。这个节点叫作OCR Master结点。此进程负责刷新(refresh)其自己拥有的本地缓存以及Cluster中其他节点
的OCR cache。也就是说,OCR客户端查询都是通过本地OCR进程来查询本地的一个OCR副本,而当客户端需要更新OCR时,它们将通过本地OCR
进程与那个扮演读写OCR文件的进程OCR Master进行交互。
#下面是一个两节点的RAC,可以看出ocr master节点起初在第一个节点,后来转移到第二个节点,再后来又到第一个节点。
#这是由于节点一关闭或节点一上的集群处于不可用状态导致ocr master节点发生了转移。
oracle@bo2dbp:/u01/oracle/crs/log/bo2dbp/cssd> cat ocssd.log | grep "master node"
[ CSSD]CLSS-3001: local node number 1, master node number 1
[ CSSD]CLSS-3001: local node number 1, master node number 1
[ CSSD]CLSS-3001: local node number 1, master node number 1
[ CSSD]CLSS-3001: local node number 1, master node number 1
[ CSSD]CLSS-3001: local node number 1, master node number 2
[ CSSD]CLSS-3001: local node number 1, master node number 1
oracle@bo2dbp:~> grep -i "master node" $ORA_CRS_HOME/log/bo2dbp/cssd/ocssd.log | tail -1
[ CSSD]CLSS-3001: local node number 1, master node number 1
OCR客户端应用有:Oracle通用安装器(OUI)、SRVCTL、企业管理器(EM)、DBCA、DBUA、NetCA和虚拟网络协议助理(VIPCA)。
此外,OCR维护管理着CRS内部中定义的各种应用程序的资源的依赖和状态信息,特别是Database、Instance、Services和节点的应用程序。
OCR配置文件的名字是ocr.loc,Linux下位于/etc/oracle/ocr.loc。
后附OCR结构图

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.
