Basic Introduction to orcle rac (1) OCR and VOTEDISK

Source: Internet
Author: User

 

1. Oracle Cluster Registry (OCR)

 

 

 

OCR is used to solve the amnesia problem in the cluster,

 

The Cluster Environment configuration file is not stored in a centralized manner, but each node has a local copy. When the cluster runs normally, you can change the cluster configuration on any node, in addition, this change will be automatically synchronized to other nodes.

 

There is A special situation: node A is shut down normally, modify the configuration on Node B, close node A, and Start Node B. In this case, the modified configuration file is lost, which is called amnesia.

 

OCR is deployed on a shared disk, and only one process in the cluster can operate data in OCR.

 

 

 

The Oracle RAC configuration information repository that manages information about the cluster node list and instance-to-node mapping information. The OCR also manages information about Oracle Clusterware resource profiles for customized applications.

 

Oracle's OCR (Oracle Cluster Registry) is called the Oracle Cluster Registry. OCR provides a way to share information between Cluster software and other application processes. OCR records the information of the resources managed by the cluster software and stores them in a key-value tree structure.

Oracle provides an ocrdump tool for obtaining OCR content. It helps you to gain a deep understanding of OCR by understanding its structure and content.

 

The ocr position is recorded in/etc/oracle/OCR. loc in SUSE 10.

 

 

2. Obtain the OCR Backup Directory Information

 

 

Oracle @ asm1: ~> Ocrconfig-showbackup

 

Asm1 16:41:25/opt/oracle/crs/oracle/product/11.1.0/crs/cdata/asm_cluster/backup00.ocr

 

Asm1 12:41:25/opt/oracle/crs/oracle/product/11.1.0/crs/cdata/asm_cluster/backup01.ocr

 

Asm1 08:41:25/opt/oracle/crs/oracle/product/11.1.0/crs/cdata/asm_cluster/backup02.ocr

 

Asm1 16:41:24/opt/oracle/crs/oracle/product/11.1.0/crs/cdata/asm_cluster/day. ocr

 

Asm1 20:41:21/opt/oracle/crs/oracle/product/11.1.0/crs/cdata/asm_cluster/week. ocr

 

 

 

 

3. Tree Structure of OCR

After comprehensively viewing the OCR content, we can summarize the following tree structure.

 

Key-values

 

 

Root

Snapshot-SYSTEM

│ ├ ── Css

│ ├ ── Language

│ ├ ── Version

│ ─ ── ORA_CRS_HOME

│ ─ ── Local_only

│ ├ ── Evm

│ WeChat-crs

│ ─ ── OCR

├ ── DATABASE

│ ─ ── NODEAPPS

│ Mongo── LOG

│ ├ ── ASM

│ ├ ── DATABASES

│ ├ ── SERVICE

│ └ ── INSTANCE

│ └ ── ONS

Certificate-CRS

 

Briefly describe the functions of the above three types of key values:

1) The SYSTEM key contains data related to the CSSD, CRSD, and EVMD processes of Oracle Clusterware;

2) The DATABASE key contains data related to the rac database registered in Oracle Clusterware;

3) The OCR key records information related to the resource profile and maintains the availability of other applications registered with Oracle Clusterware.

 

The above structure information can be obtained through the mongoel OCRDUMP tool.

 

OCRDUMP Utility Examples

 

The following ocrdump utility examples extract varous types of OCR information and write it to various targets:

 

Ocrdump

 

Writes the OCR content to a file called OCRDUMPFILE in the current directory.

 

Ocrdump MYFILE

 

Writes the OCR content to a file called MYFILE in the current directory.

 

Ocrdump-stdout-keyname SYSTEM

 

Writes the OCR content from the subtree of the key SYSTEM to stdout.

 

Ocrdump-stdout-xml

 

Writes the OCR content to stdout in XML format

 

 

 

 

Restore OCR from backup

 

 

 

1. Close the CRS service program running on all nodes of the cluster database.

/Etc/init. d/init. crs stop

 

2. view the latest backup using the showbackup option of ocrconfig

Ocrconfig-showbackup

 

3. import OCR data through the restore or import option of ocrconfig

Ocrconfig-restore filename_location

Ocrconfig-import filename_location

 

Note: The restore option can only be used to import physical backups automatically generated by OCR. Likewise, the import option can only be used to import logical backups exported using the export option.

 

4. Restart CRS on all nodes

 

/Etc/init. d/init. crs start

 

 

Common commands:

Ocrcheck

Ocrconfig

Ocrdump

Ocrpatch

 

 

 

VOTEDISK

 

VOTEDISK is used to solve the Split Brain problem.

 

In a cluster, nodes learn the health status of each other through a certain mechanism (Heartbeat) to ensure that each node coordinates the work. Assume that only the "Heartbeat" node is faulty and each node is still running normally. At this time, each node considers other nodes to be down, you are the "only creator" in the entire cluster environment, and you should gain "control" of the entire cluster ". In the cluster environment, storage devices are shared, which means data disaster. This situation is split-brain"

 

The usual solution to this problem is to use the voting Algorithm (Quorum Algorithm). Its Algorithm mechanism is as follows:

 

Each node in the cluster needs a heartbeat mechanism to notify each other of the "Health Status". If each node receives a "notification", it means one vote. For clusters with three nodes, each node has three tickets during normal operation. When the heartbeat of node A fails but node A is still running, the entire cluster is split into two small partitions. Node A is one, and the remaining two are one. This requires removing a partition to ensure the healthy operation of the cluster.

 

For A cluster with three nodes, after A heartbeat problem occurs, B and C are A partition with two votes and A has only one vote. According to the voting algorithm, clusters composed of B and C obtain control, and A is removed.

 

If there are only two nodes, the voting algorithm becomes invalid. Because each node has only one vote. In this case, you need to introduce the third Device: Quorum Device. Quorum Device usually uses a shared disk, which is also called Quorum disk. This Quorum Disk also represents one ticket. When the heartbeat of the two nodes fails, the two nodes fight for the Quorum Disk ticket at the same time, and the first request to arrive will be satisfied first. Therefore, the first node to obtain Quorum Disk will receive two tickets. The other node will be removed.

 

 

 

View the storage information of votedisk:

Erpdb1 $ [/home/oracle] crsctl query css votedisk

0. 0/dev/jcerp_vote_disk3

1. 0/dev/jcerp_vote_disk1

2. 0/dev/jcerp_vote_disk2

 

Located 3 votedisk (s ).

 

Back up votedisk: dd if =/dev/raw/votediskcopied of =/dev/raw/raw1

Restore votedisk: dd if =/dev/raw/raw1 of =/dev/raw/votediskcopied

From the wangjiuyong Column

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.