首页 > 代码库 > 10gR2-11gR1,11gR2如何干净的清除并重建OCR和表决磁盘

10gR2-11gR1,11gR2如何干净的清除并重建OCR和表决磁盘

下面分别讨论10gR2-11gR1和11gR2干净的清除并重建OCR和表决磁盘的方法。

一.10gR2-11gR1干净的清除并重建OCR和表决磁盘的方法

参考METALINK文章:ID 399482.1

How to Recreate OCR/Voting Disk Accidentally Deleted [ID 399482.1]

 修改时间 13-JUN-2011     类型 HOWTO     状态 PUBLISHED 

In this Document
  Goal
  Solution
  References


 

 

Applies to:

Oracle Server - Standard Edition - Version: 10.2.0.1 to 11.1.0.7 - Release: 10.2 to 11.1
Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.7   [Release: 10.2 to 11.1]
Generic UNIX
Generic Linux
Oracle Clusterware

Goal

The goal of this document is to help customers who have accidentally deleted the OCR, voting disk or the files that are required for the operation of Oracle clusterware.

Depending on the issue, it may or may not be good idea to execute the steps provided.

  • OCR 
    • If the OCR has been deleted, then check if the OCR mirror is OK and vice versa. It may be prudent to use the OCR mirror to create the OCR. For steps on this check the documentation:  Oracle Database   Oracle Clusterware and Oracle Real Application Clusters Administration and Deployment Guide 
    • If the OCR mirror and OCR have been deleted, then it may be faster to restore the OCR using the OCR backups. For steps on this check the documentation: Oracle Database   Oracle Clusterware and Oracle Real Application Clusters Administration and Deployment Guide
  • Voting Disk  
    • If there are multiple voting disks and one was accidentally deleted, then check if there are any backups of this voting disk. If there are no backups then we can add one using the crsctl add votedisk command. The complete steps are in the: Oracle Database   Oracle Clusterware and Oracle Real Application Clusters Administration and Deployment Guide
  • SCLS directories
    • These are internal only directories which are created by root.sh, if this directory is accidentally removed then they can only be created by the steps documented below
  • Socket files in /tmp/.oracle or /var/tmp/.oracle
    • If these files are accidentally deleted, then stop the Oracle Clusterware on that node and restart it again. This will  recreate these socket files. If the socket files for cssd is deleted then the Oracle Clusterware stack may not come down in which case the node has to be bounced.

Solution

If none of the steps documented above can be used to restore the file that was accidentally deleted or is corrupted, then the following steps can be used to re-create/reinstantiate these files. The following steps require complete downtime on all the nodes.

  1. Shutdown the Oracle Clusterware stack on all the nodes using command crsctl stop crs as root user.
  2. Backup the entire Oracle Clusterware home.
  3. Execute <CRS_HOME>/install/rootdelete.sh on all nodes
  4. Execute <CRS_HOME>/install/rootdeinstall.sh on the node which is supposed to be the first node
  5. The following commands should return nothing
    • ps -e | grep -i ‘ocs[s]d‘
    • ps -e | grep -i ‘cr[s]d.bin‘
    • ps -e | grep -i ‘ev[m]d.bin‘
  6. Execute <CRS_HOME>/root.sh on first node
  7. After successful root.sh execution on first node Execute root.sh on the rest of the nodes of the cluster
  8. For 10gR2, use racgons. For 11g use onsconfig command. Examples for each are provided below.

    For 10g
    Execute as owner (generally oracle) of CRS_HOME command 
    <CRS_HOME>/bin/racgons add_config hostname1:port hostname2:port
    $/u01/crs/bin/racgons add_config halinux1:6251 halinux2:6251

    For 11g
    Execute as owner (generally oracle) of CRS_HOME command
    <CRS_HOME>/install/onsconfig add_config hostname1:port hostname2:port
    $/u01/crs/install/onsconfig add_config halinux1:6251 halinux2:6251
  9. Execute as owner of CRS_HOME (generally oracle)  <CRS_HOME>/bin/oifcfg setif -global. Please review Note 283684.1 for details.

    $/u01/crs/bin/oifcfg setif -global  eth0/192.168.0.0:cluster_interconnect eth1/10.35.140.0:public
  10. Add listener using netca. This may give errors if the listener.ora contains the entries already. If this is the case, move the listener.ora to /tmp from the $ORACLE_HOME/network/admin or from the $TNS_ADMIN directory if the TNS_ADMIN environmental is defined and then run netca. Add all the listeners that were added earlier.
  11. Add ASM & database resource to the OCR using the appropriate srvctl add database command as the user who owns the ASM & database resource. Please ensure that this is not run as root user
  12. Add  Instance, services using appropriate srvctl add commands. Please refer to the documentation for the exact commands.
  13. execute cluvfy stage -post crsinst -n node1,node2    ### Please ensure to replace node1,node2 with the node names of the cluster

 


 

References

NOTE:557178.1 - RAC on Windows: How To Reinitialize the OCR and Vote Disk (without a full reinstall of Oracle Clusterware)


二.11gR2干净的清除并重建OCR和表决磁盘的方法

        11gR2是新版本的数据库,清除并重建OCR和表决磁盘的方法变得更加简单:
执行:$GRID_HOME/crs/install/rootcrs.pl -deconfig -force
如果是RAC的最后一个节点,那么执行:$GRID_HOME/crs/install/rootcrs.pl -deconfig -force -lastnode

注意:
        1).如果在RAC中有任何节点是正常工作的,那么在问题节点执行以上命令来清除本节点的OCR和表决磁盘信息,然后重建,不必直接删除OCR和表决磁盘文件进行重建。

        2).如果RAC所有节点都出现问题,需要所有节点重建OCR和表决磁盘,那么也不能直接将OCR和表决磁盘删除,重新执行root.sh进行重建,必须同样的执行以上命令,如果将OCR和表决磁盘文件之间删除,执行root.sh脚本会收到如下信息:

[root@niccl02 grid]# ./root.sh
Performing root user operation for Oracle 11g
 
The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/11.2.0/grid
 
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
 
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
User ignored Prerequisites during installation
Configure Oracle Grid Infrastructure for a Cluster ... succeeded

上面代码显示是成功的,实际上什么也没做。

结论:
        因为在现有的系统中的很多地方都保存有OCR和表决磁盘的相关配置信息,在重建OCR和表决磁盘之前要将其清除干净,不清除干净这些配置信息将无法很好的重建OCR和表决磁盘。10gR2-11gR1和11gR2在清除方法上是不同的,11gR2进行的简化,之前的版本要复杂一些。


        另外,清除OCR和表决磁盘并未删除安装好的Oracle软件,而是在现有的基础上重建OCR和表决磁盘。如果要连Oracle相关软件都需要重新安装,10gR2-11gR1请参考文章:http://space.itpub.net/23135684/viewspace-682913 ,11gR2也简化了这个过程,使用GI和Oracle软件Home目录下的deinstall/deinstall命令即可轻松、干净的清除相关配置信息,及Oracle安装的软件。

http://blog.itpub.net/23135684/viewspace-721081/

10gR2-11gR1,11gR2如何干净的清除并重建OCR和表决磁盘