OCR and voting Disk backups in Oracle RAC are described in my blog: oracle RAC Common maintenance tools and commands , and now take it separately to make a note, because OCR and voting disk Is too important for a RAC system.
Oracle RAC Common maintenance tools and commands
Http://blog.csdn.net/tianlesoftware/archive/2010/03/09/5358573.aspx
a . Voting Disk
Voting Disk This file is mainly used to record node member status, in the event of a brain fissure, the decision that partion gain control, the other partion must be removed from the cluster. Voting disk uses a "Most available algorithm", if there are multiple voting disk, then more than half of the votedisk must be used at the same time, clusterware to normal use. For example, CONFIGURED 4 Votedisk, bad one votedisk, the cluster can work properly, if the bad 2, then can not meet more than half, the cluster will immediately go down, all nodes immediately restart, so if you add votedisk, try not to add only one, but should add 2. This is not the same as OCR. OCR requires only one configuration.
View Votedisk's Location:
[Email protected] ~]# crsctl query CSS Votedisk
0.0/dev/raw/raw2
Located 1 votedisk (s).
Backup Votedisk Disk:
[email protected] bin]# DD if=/dev/raw/raw2 Of=/home/oracle/voting_disk.bak
294912+0 Records in
294912+0 Records out
Recover Votedisk Disk:
[email protected] bin]# DD If=/home/oracle/voting_disk.bak OF=/DEV/RAW/RAW2
294912+0 Records in
294912+0 Records out
View the contents of voting disk with the strings command
[Email protected] oracle]# strings Voting_disk.bak |sort-u
Fslc
Sslckcot
Sslcllik
SSlcrEp0
}| {Z
two . OCR
Oracle Clusterware puts the configuration information for the entire cluster on the shared storage, which includes a list of cluster nodes, the mapping of cluster DB instances to nodes, and CRS application resource information. The storage location is on the OCR disk. In the entire cluster, only one node can read and write the OCR Disk, which is called Master node, and all nodes keep a copy of the OCR in memory, while an OCR Process reads the contents from this memory. When the OCR content changes, the OCR process from master node is responsible for synchronizing the OCR process to the other nodes.
Because the content of OCR is so important, Oracle backs it up every 4 hours and retains the last 3 backups, as well as the last backup of the previous week, the day before. This backup is done by the master Node CRSD process, the default location of the backup is $crs_home/crs/cdata/<cluster_name> directory, can be Ocrconfig-backuploc < The directory_name> command modifies the new directory. After each backup, the backup file name changes automatically to reflect the order of backup time, and the most recent backup is called BACKUP00.OCR. These backup files, in addition to being stored locally, should be retained by the DBA on other storage devices to prevent accidental storage failures.
[Email protected] crs]# pwd
/u01/app/oracle/product/crs/cdata/crs
[Email protected] crs]# LS-LRT
Total 22632
-rw-r--r--1 root root 4595712 Mar 9 01:03 BACKUP02.OCR
-rw-r--r--1 root root 4620288 Mar 9 21:20 BACKUP01.OCR
-rw-r--r--1 root root 4632576 Apr 8 19:46 BACKUP00.OCR
-rw-r--r--1 root root 4632576 Apr 8 19:46 DAY.OCR
-rw-r--r--1 root root 4632576 Apr 8 19:46 WEEK.OCR
During the installation of Clusterware, if you choose external redundancy redundancy, you can enter only one OCR disk location. However, Oracle allows the configuration of two OCR disks to mirror each other to prevent a single point of failure of the OCR disk. OCR disks are not the same as Votedisk disks, there can be up to two OCR disks, one primary OCR and one mirror OCR.
Oracle recommends that when tuning the cluster, such as adding, before deleting the node, before modifying the RAC IP, make a backup of the OCR, you can use export backup to the specified file, if you do a replace or restore operation, Oracle recommended to use the Cluvfy Comp ocr-n All command to do a full check. For the backup and recovery of OCR, we can use the Ocrconfig command.
[Email protected] 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 would be created in
$ORACLE _home/log/
You have a file creation privileges in the above directory before
Running this tool.
1. restoring OCR with export import backup
1) First turn off CRS for all nodes
[[email protected] bin]#./crsctl Stop CRS
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2) Export OCR content with root user
[Email protected] bin]#./ocrconfig-export/u01/ocr.exp
3) Restart CRS
[[email protected] bin]#./crsctl start CRS
Attempting to start CRS stack
The CRS stack would be started shortly
4) Check the CRS status
[[email protected] bin]#./CRSCTL Check CRS
CSS appears healthy
CRS appears healthy
EVM appears healthy
5) Destroy OCR content
[[email protected] 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
[Email protected] bin]#./ocrcheck
Prot-601:failed to initialize Ocrcheck
7) Check consistency with Cluvfy tool
[Email protected] cluvfy]#/runcluvfy.sh Comp Ocr-n All
Verifying OCR Integrity
Unable to retrieve nodelist from Oracle Clusterware.
Verification cannot proceed.
8) Restore OCR content using Import
[Email protected] bin]#./ocrconfig-import/u01/ocr.exp
Note: Use the RESTORE option to import only the physical backups that are automatically generated by OCR,
The import option only imports logical backups exported through the export option.
9) re-check OCR
[Email protected] 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) Check with the Cluvfy tool
[Email protected] cluvfy]#/runcluvfy.sh Comp Ocr-n All
2. Automatic Backup to restore OCR
(1) Close the CRS service program running on all nodes in the cluster database
/etc/init.d/init.crs stop
There are no INIT.CRS commands in Oracle 11gR2. Only through
#crsctl Stop CRS
command to turn off CRS.
(2). View recent backups with Ocrconfig's showbackup option
[Email protected] ~]# 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 via Ocrconfig's Restore or import option
Ocrconfig-restore filename_location
Such as:
Ocrconfig-restore/u01/app/11.2.0/grid/cdata/racnode-cluster/backup00.ocr
Note: Use the RESTORE option to import only the physical backups that are automatically generated by OCR,
The import option only imports logical backups exported through the export option.
(4) Check CRS
[Email protected] bin]#./ocrcheck
Use the Cluvfy tool to check
[Email protected] cluvfy]#/runcluvfy.sh Comp Ocr-n All
(5) Restart the CRS on all nodes
/etc/init.d/init.crs start
Used in Oracle 11GR2: #crsctl start CRS command to initiate CRS.
Summary:
Only the backup of OCR and voting Disk is mentioned here. In fact, for a database environment, there are many things to back up. But OCR is something that involves the bottom of the RAC, so be very careful before making changes that involve OCR. Before doing the operation, it is best to manually use Ocrconfig-export to back up the OCR.
For a database environment, you also need to backup things such as: Spfile,control file, data file location, and so on. Data file location, use the following command to view:
Elect File_name,tablespace_name from Dba_data_files;
Select File_name,tablespace_name from Dba_temp_files;
Sometimes this information is needed for recovery. We try to back up a bit more so that it's more beneficial for recovery.
Previous knowledge of the DBA:
1. Bold but cautious, don't panic
2. Develop a comprehensive backup strategy, before doing relevant operations, but also need to backup.
3. Before making any changes, make a document and follow the documentation. In the good memory and experience will inevitably be omitted, according to the document, step by step operation.
On the day of the discussion with the flock, he said a piece:
The risk of big things do not do, change the idea to reduce the risk to the lowest point of operation!
Ext.: http://blog.csdn.net/tianlesoftware/article/details/5467273
Backup and recovery of Oracle 10g RAC OCR and Votingdisk