管理Oracle clusterware ( OCR )


管理Oracle clusterware ( OCR )

Oracle Clusterware把整个集群的配置信息放在共享存储上,这些信息包括了集群节点的列表、集群数据库实例到节点的映射以及CRS应用程序资源信息。存放的位置就在OCR Disk上. 在整个集群中,只有一个节点能对OCR Disk 进行读写操作,这个节点叫作Master Node,所有节点都会在内存中保留一份OCR的拷贝,同时有一个OCR Process 从这个内存中读取内容。 OCR 内容发生改变时,由Master Node的OCR Process负责同步到其他节点的OCR Process。

If you already mirror the OCR, then you do not need to add an OCR location; Oracle automatically manages two OCRs when it mirrors the OCR. Oracle RAC environments do not support more than two OCRs, a primary OCR and a second OCR.

[sql]
  1. --ocrconfig语法   
  2. [root@rac1 ~]# ocrconfig -help  
  3. Name:  
  4.         ocrconfig - Configuration tool for Oracle Cluster Registry.  
  5.   
  6. Synopsis:  
  7.         ocrconfig [option]  
  8.         option:  
  9.                 -export <filename> [-s online]  
  10.                                                     - Export cluster register contents to a file  
  11.                 -import <filename>                  - Import cluster registry contents from a file  
  12.                 -upgrade [<user> [<group>]]  
  13.                                                     - Upgrade cluster registry from previous version  
  14.                 -downgrade [-version <version string>]  
  15.                                                     - Downgrade cluster registry to the specified version  
  16.                 -backuploc <dirname>                - Configure periodic backup location  
  17.                 -showbackup                         - Show backup information  
  18.                 -restore <filename>                 - Restore from physical backup  
  19.                 -replace ocr|ocrmirror [<filename>] - Add/replace/remove a OCR device/file  
  20.                 -overwrite                          - Overwrite OCR configuration on disk  
  21.                 -repair ocr|ocrmirror <filename>    - Repair local OCR configuration  
  22.                 -help                               - Print out this help information  
  23.   
  24. Note:  
  25.         A log file will be created in  
  26.         $ORACLE_HOME/log/<hostname>/client/ocrconfig_<pid>.log. Please ensure  
  27.         you have file creation privileges in the above directory before  
  28.         running this tool.  
自动备份 OCR
– 每 4 小时:CRS 会保留最后 3 个副本。  
– 每天结束时:CRS 会保留最后 2 个副本。  
– 每周结束时:CRS 会保留最后 2 个副本。
自动备份由Master Node CRSD进程完成,备份的默认位置是$CRS_HOME/crs/cdata/<cluster_name>目录下,可以通过ocrconfig -backuploc <directory_name> 命令修改到新的目录。

示例:

[sql]
  1. --显示备份信息   
  2. [root@rac1 ~]# ocrconfig -showbackup  
  3.   
  4. rac1     2012/02/20 20:45:32     /u01/crs1020/cdata/crs  
  5.   
  6. rac1     2012/02/19 16:45:47     /u01/crs1020/cdata/crs  
  7.   
  8. rac1     2012/02/18 22:18:40     /u01/crs1020/cdata/crs  
  9.   
  10. rac1     2012/02/19 16:45:47     /u01/crs1020/cdata/crs  
  11.   
  12. rac1     2012/02/19 16:45:47     /u01/crs1020/cdata/crs  
  13. [root@rac1 ~]# ll /u01/crs1020/cdata/crs/  
  14. total 28296  
  15. -rw-r--r-- 1 root root 4816896 Feb 20 20:45 backup00.ocr   
  16. -rw-r--r-- 1 root root 4816896 Feb 19 16:45 backup01.ocr   
  17. -rw-r--r-- 1 root root 4816896 Feb 18 22:18 backup02.ocr   
  18. -rw-r--r-- 1 root root 4816896 Feb 20 20:45 day_.ocr   
  19. -rw-r--r-- 1 root root 4816896 Feb 19 16:45 day.ocr   
  20. -rw-r--r-- 1 root root 4816896 Feb 19 16:45 week.ocr   
  21.   
  22. --更改备份位置   
  23. [root@rac1 ~]# ocrconfig -backuploc /oracle/backup/ocr  
使用物理备份恢复 OCR  
1. 找到物理备份:
   $ ocrconfig –showbackup  
2. 检查其内容:
   # ocrdump  file_name –backupfile
3. 停止所有节点上的 Oracle Clusterware:  
   # crsctl stop crs  
4. 还原 OCR 物理备份:
   # ocrconfig –restore <CRS HOME>/cdata/jfv_clus/day.ocr   
5. 重新启动所有节点上的 Oracle Clusterware:  
   # crsctl start crs  
6. 检查 OCR 完整性:  
   $ cluvfy comp ocr -n all 
示例:

[sql]
  1. --找到物理备份:    
  2. [root@rac1 ~]# ocrconfig -showbackup  
  3.   
  4. --检查其内容,dump不成功:      
  5. [root@rac1 crs]# ocrdump  -backupfile day.ocr  
  6. PROT-302: Failed to initialize ocrdump  
  7.   
  8. --停止所有节点上的 Oracle Clusterware:     
  9. [root@rac2 ~]# crsctl stop crs  
  10. [root@rac1 ~]# crsctl stop crs  
  11.    
  12. --还原 OCR 物理备份:    
  13. [root@rac1 ~]# ocrconfig -restore /u01/crs1020/cdata/crs/backup00.ocr  
  14. --重新启动所有节点上的 Oracle Clusterware:     
  15. [root@rac2 ~]# crsctl start crs  
  16. [root@rac1 ~]# crsctl start crs  
  17.   
  18. --检查 OCR 完整性:     
  19. RACDB1@rac1 /home/oracle$ cluvfy comp ocr -n all  
手动备份 OCR  
每天都应将 OCR 自动备份备份到其他存储设备:  
  – 使用首选备份工具。  
在进行重大更改之前和之后应对 OCR 进行逻辑备份
  # ocrconfig –export file name  
确保还原与当前系统配置相匹配的 OCR 备份。
  • 1
  • 2
  • 下一页

相关内容