Oracle Clusterware puts the entire cluster's configuration information on shared storage, which includes a list of cluster nodes, a cluster database instance to a node map, and CRS application resource information. It is also stored on an OCR disk (or OCFS file). Therefore, the importance of this configuration file is self-evident. Any action that makes an OCR configuration change is recommended to back up OCR immediately between operations or after. This paper is mainly based on Oracle 10g RAC Environment to describe the backup and recovery of OCR.
First, the concept of backup and recovery of OCR
Similar to Oracle database backup recovery, OCR backups have the concept of physical or logical backups, so there are two ways to backup, two ways to recover.
Physical Backup and Recovery:
By default, Oracle backs it up every 4 hours and retains the last 3 copies, as well as the last backup copy of the previous week.
Users cannot customize the frequency of backups and the number of copies of backup files.
The backup backup for OCR is done by the master Node CRSD process, so the default location for the backup is in the $crs_home/crs/cdata/<cluster_name> directory.
The backed-up files are automatically renamed to respond to the backup-time sequence, and the most recent backup is called BACKUP00.OCR.
Because backups are made on top of the node in master node, the backup file exists only in the master node node.
The node crash for master node is then taken over by the remaining node.
The backup directory can be modified via the Ocrconfig-backuploc <directory_name> command.
There can be up to two OCR disks, one primary OCR and one mirror OCR. The two mirrors each other to avoid a single point of failure.
For physical backup recovery, it is not easy to use operating system-level replication commands (when using OCR files) to complete, which will cause OCR to be unavailable.
Logical Backup and Recovery:
A backup generated using the Ocrconfig-export method is called a logical backup.
Logical backups are recommended for significant OCR configuration changes, such as adding delete nodes, modifying cluster resources, creating databases, and so on.
In cases where OCR is corrupted due to an incorrect configuration, we can use the Ocrconfig-import method for recovery.
You can also restore a missing or corrupted OCR disk (file) for this logical approach.
Backup recommendations:
Copy the files produced by an automatic backup of Oracle to a shared or other available storage device.
The OCR configuration information is exported at least once a day.
Second, backup OCR
Automatic backup of OCR
#使用ocrconfig-showbackup View the node and path of the OCR backup
Oracle@bo2dbp:~> Ocrconfig-showbackup
BO2DBP 2013/02/25 06:23:15/u01/oracle/crs/cdata/crs
BO2DBP 2013/02/25 02:23:13/u01/oracle/crs/cdata/crs
BO2DBP 2013/02/24 22:23:13/u01/oracle/crs/cdata/crs
BO2DBP 2013/02/24 02:23:09/u01/oracle/crs/cdata/crs
BO2DBP 2013/02/22 18:23:04/u01/oracle/crs/cdata/crs
Oracle@bo2dbp:~> Ls-hltr/u01/oracle/crs/cdata/crs
Total 40M
-rw-r--r--1 root root 6.7M 2013-02-22 18:23 WEEK.OCR
-rw-r--r--1 root root 6.7M 2013-02-24 02:23 DAY.OCR
-rw-r--r--1 root root 6.7M 2013-02-24 22:23 BACKUP02.OCR
-rw-r--r--1 root root 6.7M 2013-02-25 02:23 BACKUP01.OCR
-rw-r--r--1 root root 6.7M 2013-02-25 02:23 DAY_.OCR
-rw-r--r--1 root root 6.7M 2013-02-25 06:23 BACKUP00.OCR
#改变物理备份路径
Ocrconfig-backuploc <new_dirname>
#使用物理备份恢复ocr
Ocrconfig-restore <backup_file_name>
For physical backups, restores can only be done using the Restore method, not the Import method
2, the manual backup of OCR
The manual backup of OCR is also a logical backup, using the-export method to implement
Ocrconfig-export <backup_file_name>
#备份示例
#建议在不同的节点导出ocr, the export location is kept as much as possible on the shared disk so that any node can recover from the disk
Oracle@bo2dbp:~> sudo-s/u01/oracle/crs/bin/ocrconfig-export/u02/crs_bak/ocr_bak/exp/bo2dbp/ocr_bak.dmp
Root ' s password:
Oracle@bo2dbp:/u02/crs_bak/ocr_bak/exp/bo2dbp> ls-hltr/u02/crs_bak/ocr_bak/exp/bo2dbp/ocr_bak.dmp
-rw-r--r--1 root root 144K 2013-02-25 10:10/u02/crs_bak/ocr_bak/exp/bo2dbp/ocr_bak.dmp
Oracle@bo2dbs:~> sudo-s/u01/oracle/crs/bin/ocrconfig-export/u02/crs_bak/ocr_bak/exp/bo2dbs/ocr_bak.dmp
Root ' s password:
Third, the restoration of OCR
1. Recover the damaged OCR from the available OCR images
A, first analog OCR damage
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/