Oracle 10g rac ocr and VotingDisk backup and recovery

Source: Internet
Author: User

The OCR and Voting Disk backups in Oracle RAC are described in my blog: common maintenance tools and commands of Oracle RAC. Now I will explain it separately, because OCR and Voting Disk are too important for the RAC system.
 
Oracle RAC commonly used maintenance tools and commands: http://www.bkjia.com/database/201202/120555.html
 
1. Voting Disk
The Voting Disk file is mainly used to record the node member status. When split-brain occurs, it is determined that the Partion gets control, and other Partion must be removed from the cluster. Voting disk uses a "majority of available algorithms". If multiple Voting disks exist, more than half of the votedisks must be used at the same time for Clusterware to work properly. For example, if four votedisks are configured and one Votedisk is broken, the cluster can work normally. If two votedisks are broken, more than half of them cannot be met. The cluster will be down immediately and all nodes will be restarted immediately, therefore, if you add a Votedisk, try not to add only one disk, but to add two disks. This is different from OCR. Only one OCR configuration is required.
 
View the location of votedisk:
[Root @ rac1 ~] # Crsctl query css votedisk
0. 0/dev/raw/raw2
Located 1 votedisk (s ).
 
Back up a votedisk:
[Root @ raw1 bin] # dd if =/dev/raw/raw2 of =/home/oracle/voting_disk.bak
294912 + 0 records in
294912 + 0 records out
 
Restore A votedisk:
[Root @ raw1 bin] # dd if =/home/oracle/voting_disk.bak of =/dev/raw/raw2
294912 + 0 records in
294912 + 0 records out
 
Use the Strings command to view the voting disk content
[Root @ raw1 oracle] # strings voting_disk.bak | sort-u
FSLC
SsLckcoT
SslcLlik
SSlcrEp0
} | {Z
 
 
Ii. OCR
 
Oracle Clusterware places the configuration information of the entire cluster on shared storage. The information includes the list of cluster nodes, the ing between cluster database instances and nodes, and the CRS Application resource information. The storage location is on the OCR Disk. in the entire cluster, only one Node can perform read and write operations on the OCR Disk. This Node is called the Master Node and all nodes will keep an OCR copy in the memory, at the same time, an OCR Process reads content from this memory. When the OCR content changes, the OCR Process of the Master Node is responsible for synchronizing the OCR Process to other nodes.
 
Because OCR content is so important, Oracle backs up it every four hours, and retains the last three backups, as well as the last backup of the previous day and the previous week. This backup is completed by the Master Node CRSD process. The default backup location is under the $ CRS_HOME/crs/cdata/<cluster_name> directory, you can use the ocrconfig-backuploc <directory_name> command to modify the directory. After each backup, the backup file name is automatically changed to reflect the backup time sequence. The last backup is called backup00.ocr. In addition to local backup files, DBA should keep one copy of the backup files on other storage devices to prevent accidental storage failures.
 
[Root @ raw1 crs] # pwd
/U01/app/oracle/product/crs/cdata/crs
[Root @ raw1 crs] # ls-lrt
Total 22632
-Rw-r -- 1 root 4595712 Mar 9 0:03 backup02.ocr
-Rw-r -- 1 root 4620288 Mar 9 21:20 backup01.ocr
-Rw-r -- 1 root 4632576 Apr 8 backup00.ocr
-Rw-r -- 1 root 4632576 Apr 8 day. ocr
-Rw-r -- 1 root 4632576 Apr 8 week. ocr
 
 
During clusterware installation, if you select the External Redundancy mode, you can only enter one OCR disk location. However, Oracle allows you to configure two OCR disks to mirror each other to prevent single point of failure of the OCR disk. The OCR disk is different from the Votedisk disk. The OCR disk can have only one Primary OCR and one Mirror OCR.
 
Oracle recommends that you back up OCR before adding or deleting a node and modifying the rac ip address when adjusting the cluster. You can use export to back up the cluster to a specified file, if replace or restore is performed, we recommend that you use the cluvfy comp ocr-n all command to perform a comprehensive check. For OCR backup and recovery, we can use the ocrconfig command.
 
[Root @ raw1 bin] #./ocrconfig -- help
Name:
Ocrconfig-Configuration tool for Oracle Cluster Registry.
Synopsis:
Ocrconfig [option]
Option:
-Export <filename> [-s online]
-Export cluster register contents to a file
-Import <filename>-Import cluster registry contents from a file
-Upgrade [<user> [<group>]
-Upgrade cluster registry from previous version
-Downgrade [-version <version string>]
-Downgrade cluster registry to the specified version
-Backuploc <dirname>-Configure periodic backup location
-Showbackup-Show backup information
-Restore <filename>-Restore from physical backup
-Replace ocr | ocrmirror [<filename>]-Add/replace/remove a OCR device/file
-Overwrite-Overwrite OCR configuration on disk
-Repair ocr | ocrmirror <filename>-Repair local OCR configuration
-Help-Print out this help information
Note:
A log file will be created in
$ ORACLE_HOME/log/You have file creation privileges in the above directory before
Running this tool.
 
 
1. Restore OCR with exported import backup
 
1) First, disable the CRS of all nodes.
[Root @ raw1 bin] #./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
 
2) use the root user to export OCR content
[Root @ raw1 bin] #./ocrconfig-export/u01/ocr. exp
 
3) Restart CRS
[Root @ raw1 bin] #./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
 
4) Check the CRS status
[Root @ raw1 bin] #./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
 
5) Damage OCR content
[Root @ raw1 bin] # dd if =/dev/zero of =/dev/raw/raw1 bs = 1024 count = 102400
102400 + 0 records in
102400 + 0 records out
 
6) Check OCR consistency
[Root @ raw1 bin] #./ocrcheck
PROT-601: Failed to initialize ocrcheck
 
7) use the cluvfy tool to check consistency
[Root @ raw1 cluvfy] #./runcluvfy. sh comp ocr-n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.
Verification cannot proceed.
 
8) use Import to restore OCR content
[Root @ raw1 bin] #./ocrconfig-import/u01/ocr. exp
 
Note: The restore option can only be used to import physical backups automatically generated by OCR,
The import option can only import logical backups exported using the export option.
 
9) Check OCR again
[Root @ raw1 bin] #./ocrcheck
Status of Oracle Cluster Registry is as follows:
Version: 2
Total space (kbytes): 147352
Used space (kbytes): 4364
Available space (kbytes): 142988
ID: 610419116
Device/File Name:/dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
 
10) use the cluvfy tool to check
[Root @ raw1 cluvfy] #./runcluvfy. sh comp ocr-n all
 
 
2. Automatic Backup Recovery OCR
 
(1) Close the CRS service program running on all nodes of the cluster database.
/Etc/init. d/init. crs stop
The init. crs command is no longer available in Oracle 11gR2. Only
# Crsctl stop crs
Command to disable CRS.
 
(2). view the latest backup using the showbackup option of ocrconfig
 
[Root @ racnode1 ~] # Ocrconfig-showbackup
Racnode1 2010/11/22 13:30:27/u01/app/11.2.0/grid/cdata/racnode-cluster/backup00.ocr
Racnode1 2010/11/22 09:30:27/u01/app/11.2.0/grid/cdata/racnode-cluster/backup01.ocr
Racnode1 2010/11/22 05:30:26/u01/app/11.2.0/grid/cdata/racnode-cluster/backup02.ocr
Racnode1 2010/11/21 05:30:23/u01/app/11.2.0/grid/cdata/racnode-cluster/day. ocr
Racnode1 2010/11/11 03:35:10/u01/app/11.2.0/grid/cdata/racnode-cluster/week. ocr
 
(3) import OCR data through the restore or import option of ocrconfig
Ocrconfig-restore filename_location
For example:
Ocrconfig-restore/u01/app/11.2.0/grid/cdata/racnode-cluster/backup00.ocr
 
Note: The restore option can only be used to import physical backups automatically generated by OCR,
The import option can only import logical backups exported using the export option.
 
(4) Check CRS
[Root @ raw1 bin] #./ocrcheck
 
Check with cluvfy
[Root @ raw1 cluvfy] #./runcluvfy. sh comp ocr-n all
 
 
(5) Restart CRS on all nodes
/Etc/init. d/init. crs start
 
Use the # crsctl start crs command in Oracle 11gR2 to start CRS.
 
 
 
Summary:
Only the backup of OCR and Voting Disk is mentioned here. In fact, there are many other things to back up in a database environment. Only OCR involves the underlying components of RAC, so be careful before making changes that involve OCR. Before performing this operation, it is best to manually back up the OCR with ocrconfig-export.
 
For a database environment, you also need to back up things such as spfile, control file, and data file location. The data file location can be viewed using the following command:
Elect file_name, tablespace_name from dba_data_files;
Select file_name, tablespace_name from dba_temp_files;
This information is sometimes required during recovery. We try to back up a little more, which is more advantageous for recovery.
 
Previous knowledge of DBA:
1. Be brave and be patient
2. Develop a complete backup policy. Backup is also required before relevant operations are performed.
3. Before making changes, sort out the documents and follow the instructions. When good memories and experiences are inevitable, follow the document and perform operations step by step.
 
 
That day, when he discussed it with the group ribbon, he said:
Do not do things with high risks. Change your mind to minimize the risks and try again!
 
Bu Dou gave me a lot of guidance on Oracle. I would like to express my gratitude to Bu Dou.
 
 
 
------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware

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.