Oracle 10g RAC 维护工具完全详解_rac olsnodes-程序员宅基地

技术标签: RAC 管理维护  crs_stat  Oracle 10g RAC  crsctl  Oracle 10g  srvctl  

节点层:olsnodes
网络层:oifcfg
集群层:crsctl、ocrcheck、ocrdump、ocrconfig
应用层:srvctl、onsctl、crs_stat


一、olsnodes 的使用
[root@rac22 ~]# olsnodes -h
Usage: olsnodes [-n] [-p] [-i] [<node> | -l] [-g] [-v]
        where
                -n print node number with the node name
                -p print private interconnect name with the node name
                -i print virtual IP name with the node name
                <node> print information for the specified node
                -l print information for the local node 
                -g turn on logging 
                -v run in verbose mode 
-----------显示每个节点的node id
[root@rac22 ~]# olsnodes -n 
rac11   1
rac22   2
[root@rac22 ~]# olsnodes -n rac22
rac22   2


------------显示节点用于 private interconnect 的网卡名称及节点信息
[root@rac22 ~]# olsnodes -p
rac11   priv11
rac22   priv22
[root@rac22 ~]# olsnodes -p -n rac22
rac22   2       priv22


------------显示节点的 VIP
[root@rac22 ~]# olsnodes -n -p -i
rac11   1       priv11  vip11
rac22   2       priv22  vip22
[root@rac22 ~]# olsnodes -p -i -n rac22
rac22   2       priv22  vip22


------------显示详细的node信息
[root@rac22 ~]# olsnodes -v
prlslms: Initializing LXL global
prlsndmain: Initializing CLSS context
prlsmemberlist: No of cluster members configured = 256
prlsmemberlist: Getting information for nodenum = 1
prlsmemberlist: node_name = rac11
prlsmemberlist: ctx->lsdata->node_num = 1
prls_printdata: Printing the node data
rac11
prlsmemberlist: Getting information for nodenum = 2
prlsmemberlist: node_name = rac22
prlsmemberlist: ctx->lsdata->node_num = 2
prls_printdata: Printing the node data
rac22
prlsndmain: olsnodes executed successfully
prlsndterm: Terminating LSF


二、oifcfg 命令的使用
[root@rac22 ~]# oifcfg


Name:
        oifcfg - Oracle Interface Configuration Tool.


Usage:  oifcfg iflist [-p [-n]]
        oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
        oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
        oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]]
        oifcfg [-help]


        <nodename> - name of the host, as known to a communications network
        <if_name>  - name by which the interface is configured in the system
        <subnet>   - subnet address of the interface
        <if_type>  - type of the interface { cluster_interconnect | public | storage }
--------iflist 显示网口列表
[root@rac22 ~]# oifcfg iflist
eth0  192.168.10.0
eth1  10.10.10.0


[root@rac22 ~]# oifcfg iflist -p -n
eth0  192.168.10.0  PRIVATE  255.255.255.0
eth1  10.10.10.0  PRIVATE  255.255.255.0


--------gettif 可以获得单个网口的信息
[root@rac22 ~]# oifcfg getif
eth0  192.168.10.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
------ -node 查询节点特定的信息,仅当节点有区别于global的配置时才会有结果显示
[root@rac22 ~]# oifcfg getif -node rac11
[root@rac22 ~]# oifcfg getif -node rac22
------ -global 查询节点的 global 类型设置
[root@rac22 ~]# oifcfg getif -global rac22
eth0  192.168.10.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
[root@rac22 ~]# oifcfg getif -global rac11
eth0  192.168.10.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
[root@rac22 ~]# oifcfg getif -global
eth0  192.168.10.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
------ -type  查看public 类型的网卡配置
[root@rac22 ~]# oifcfg getif -type public
eth0  192.168.10.0  global  public
------ -type  查看public 类型的网卡配置
[root@rac22 ~]# oifcfg getif -type cluster_interconnect
eth1  10.10.10.0  global  cluster_interconnect


--------setif 配置单个网口
------ 通过 setif 添加向集群新的网卡
usage:oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
其中 -global/node 必须指定
[root@rac22 ~]# oifcfg setif -global eth2/10.10.11.11:public
[root@rac22 ~]# oifcfg setif -node rac22 eth3/10.10.11.12:public
[root@rac22 ~]# oifcfg getif -global 
eth0  192.168.10.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
eth2  10.10.11.11  global  public
[root@rac22 ~]# oifcfg getif -node rac22
eth3  10.10.11.12  rac22  public


注意这里的添加网卡命令并不会校验网卡是否真的存在,即使是没有这两个网卡,也是可以添加成功的,但是setif命令已经修改了相应的配置文件
并生效。


--------delif 删除网口
------ 使用delif 删除刚刚添加的不存在网卡
[root@rac22 ~]# oifcfg delif -global
[root@rac22 ~]# oifcfg delif -node rac22
上面的两个命令会删除所有的网卡设置不推荐使用,通常我们会特指相应的网卡进行删除
[root@rac22 ~]# oifcfg delif -global eth2/10.10.11.11
[root@rac22 ~]# oifcfg delif -node rac22 /eth3/10.10.11.12




网络故障及解决办法:RAC 环境无法识别心跳网络的故障
新装 RAC 环境,数据库启动日志中发现:No cluster interconnect
首先查看初始化参数 cluster_interconnects 是否设置
SQL> show parameter cluster


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     TRUE
cluster_database_instances           integer     2
cluster_interconnects                string


然后查看如下视图:
SQL> col host_name for a20
SQL> select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,NAME_KSXPIA network_interface,IP_KSXPIA private_ip from x$ksxpia cross join v$instance where PUB_KSXPIA= 'N';


INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME            NETWORK_INTERFA PRIVATE_IP
--------------- ---------------- -------------------- --------------- ----------------
              2 PROD2            rac22                eth1            10.10.10.22
注意,这里是正常情况下查询结果,如果是故障情况下,此查询将无结果。


在用 oifcfg iflist -p -v
[oracle@rac22 ~]$ oifcfg  iflist -p -n
eth0  192.168.10.0  PRIVATE  255.255.255.0
eth1  10.10.10.0  PRIVATE  255.255.255.0


如果上面的命令和连接查询均查不到结果,则表示,cluster在安装配置过程中,未将 cluster_interconnect 信息注册到 OCR 中,要解决此问题
我们并不需要重新安装和配置集群环境,只需使用 oifcfg 命令稍作配置即可
我们需要先停止数据库
[root@rac11 ~]# srvctl stop database -d prod
然后使用 oifcfg setif 命令添加一个 cluster_interconnect 网卡(必须存在)即可
[root@rac11 ~]# oifcfg setif -global eth1/10.10.10.11:cluster_interconnect
然后查看添加结果:
[root@rac11 ~]# oifcfg getif -global
eth0  192.168.10.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
最后重启节点上的所有 CRS 资源(或服务),然后再重启数据库。
[root@rac11 ~]# crsctl stop crs


---------------- crsctl 命令的用法
集群层的命令包括 crsctl\ocrcheck\ocrdump\ocrconfig ,其中后三个都是针对 OCR 磁盘操作的命令
crsctl 可以用来查看 CRS 进程栈,每个CRS进程的状态,管理 voting disk,跟踪 CRS 进程等功能。
可以不带任何参数查询其用法:
[root@rac11 ~]# crsctl
Usage: crsctl check  crs          - checks the viability of the CRS stack
       crsctl check  cssd         - checks the viability of CSS
       crsctl check  crsd         - checks the viability of CRS
       crsctl check  evmd         - checks the viability of EVM
       crsctl set    css <parameter> <value> - sets a parameter override
       crsctl get    css <parameter> - gets the value of a CSS parameter
       crsctl unset  css <parameter> - sets CSS parameter to its default
       crsctl query  css votedisk    - lists the voting disks used by CSS
       crsctl add    css votedisk <path> - adds a new voting disk
       crsctl delete css votedisk <path> - removes a voting disk
       crsctl enable  crs    - enables startup for all CRS daemons
       crsctl disable crs    - disables startup for all CRS daemons
       crsctl start crs  - starts all CRS daemons.
       crsctl stop  crs  - stops all CRS daemons. Stops CRS resources in case of cluster.
       crsctl start resources  - starts CRS resources. 
       crsctl stop resources  - stops  CRS resources. 
       crsctl debug statedump evm  - dumps state info for evm objects
       crsctl debug statedump crs  - dumps state info for crs objects
       crsctl debug statedump css  - dumps state info for css objects
       crsctl debug log css [module:level]{,module:level} ... 
                             - Turns on debugging for CSS 
       crsctl debug trace css - dumps CSS in-memory tracing cache
       crsctl debug log crs [module:level]{,module:level} ... 
                             - Turns on debugging for CRS 
       crsctl debug trace crs - dumps CRS in-memory tracing cache
       crsctl debug log evm [module:level]{,module:level} ... 
                             - Turns on debugging for EVM
       crsctl debug trace evm - dumps EVM in-memory tracing cache
       crsctl debug log res <resname:level> turns on debugging for resources
       crsctl query crs softwareversion [<nodename>] - lists the version of CRS software installed
       crsctl query crs activeversion - lists the CRS software operating version
       crsctl lsmodules css - lists the CSS modules that can be used for debugging
       crsctl lsmodules crs - lists the CRS modules that can be used for debugging
       crsctl lsmodules evm - lists the EVM modules that can be used for debugging


 If necesary any of these commands can be run with additional tracing by
 adding a "trace" argument at the very front.
 Example: crsctl trace check css
 
------ 查看整个 CRS 栈状态
 [root@rac11 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy


------ 查看 CRS 栈中各个组件(cssd\crsd\evmd)的状态
[root@rac11 ~]# crsctl check cssd
CSS appears healthy
[root@rac11 ~]# crsctl check crsd
CRS appears healthy
[root@rac11 ~]# crsctl check evmd
EVM appears healthy


------ 设置 CRS 栈是否自动启动
       crsctl enable  crs    - enables startup for all CRS daemons
       crsctl disable crs    - disables startup for all CRS daemons
       有时出于维护需要,可能要关闭 CRS 栈自动启动
[root@rac11 ~]# crsctl disable crs
[root@rac11 ~]# crsctl enable crs


------ 启动和停止 CRS 栈
在 Oracle 10.1 中必须重启 clusterware,在 Oracle 10.2 以后的版本中可以通过如下命令进行启动和关闭 CRS 栈的操作:
[root@rac11 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued
------ 执行上述命令后的结果
[oracle@rac22 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora....D1.inst application    0/5    0/0    ONLINE    OFFLINE               
ora....D2.inst application    0/5    0/0    ONLINE    ONLINE    rac22       
ora.PROD.db    application    0/1    0/1    ONLINE    ONLINE    rac22       
ora....SM1.asm application    0/5    0/0    ONLINE    OFFLINE               
ora....11.lsnr application    0/5    0/0    ONLINE    OFFLINE               
ora.rac11.gsd  application    0/5    0/0    ONLINE    OFFLINE               
ora.rac11.ons  application    0/3    0/0    ONLINE    OFFLINE               
ora.rac11.vip  application    0/0    0/0    ONLINE    OFFLINE               
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac22       
ora....22.lsnr application    0/5    0/0    ONLINE    ONLINE    rac22       
ora.rac22.gsd  application    0/5    0/0    ONLINE    ONLINE    rac22       
ora.rac22.ons  application    0/3    0/0    ONLINE    ONLINE    rac22       
ora.rac22.vip  application    0/0    0/0    ONLINE    ONLINE    rac22
注意在一个node上执行,只会停止该节点上的 CRS 
[root@rac11 ~]# crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly
------经crs_stat -t -v 观察启动过程会很慢,暂不清楚其具体过程


------ 查看 votedisk 磁盘的位置
[oracle@rac22 ~]$ crsctl query css votedisk
 0.     0    /dev/raw/raw2


located 1 votedisk(s).


------ 查看和修改 CRS 参数
使用 get 命令查看参数
[oracle@rac22 ~]$ crsctl get css misscount
60
使用 set 命令修改参数(慎用,必须以 root 用户执行)
[root@rac11 ~]# crsctl set css misscount 100
Configuration parameter misscount is now set to 100.
[root@rac11 ~]# crsctl set css misscount 60
Configuration parameter misscount is now set to 60.


CRS 由 CRS\CSS\EVM 3 个服务组成,每个服务又由一系列的 module 组成, 可以使用 crsctl对每个module进行跟踪,并把跟踪内容记录到日志中。
[root@rac11 ~]# crsctl lsmodules css
The following are the CSS modules :: 
    CSSD
    COMMCRS
    COMMNS
[root@rac11 ~]# crsctl lsmodules evm
The following are the EVM modules :: 
   EVMD
   EVMDMAIN
   EVMCOMM
   EVMEVT
   EVMAPP
   EVMAGENT
   CRSOCR
   CLUCLS
   CSSCLNT
   COMMCRS
   COMMNS
[root@rac11 ~]# crsctl lsmodules crs
The following are the CRS modules :: 
    CRSUI
    CRSCOMM
    CRSRTI
    CRSMAIN
    CRSPLACE
    CRSAPP
    CRSRES
    CRSCOMM
    CRSOCR
    CRSTIMER
    CRSEVT
    CRSD
    CLUCLS
    CSSCLNT
    COMMCRS
    COMMNS


以下以跟踪 CSSD 模块为例讲述如何操作(必须以root用户执行):
[root@rac11 ~]# crsctl debug log css "CSSD:1"
Configuration parameter trace is now set to 1.
Set CRSD Debug Module: CSSD  Level: 1
查看跟踪产生的日志信息:
[root@rac11 ~]# tail -f /u01/crs10.2.0/log/rac11/cssd/ocssd.log 
[    CSSD]2012-07-16 10:45:06.480 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb6707fb8) proc(0xb6728e50) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:45:57.613 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb67269c0) proc(0xb6727af8) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:46:58.567 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb6707fb8) proc(0xb67087c0) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:47:59.701 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb6707fb8) proc(0xb6708848) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:49:01.148 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb6707fb8) proc(0xb6708848) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:50:02.570 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb6707fb8) proc(0xb6708848) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:51:03.946 [100371360] >TRACE:   clssgmClientConnectMsg: Connect from con(0xb6707fb8) proc(0xb6708848) pid() proto(10:2:1:1)
[    CSSD]2012-07-16 10:51:19.703 [40508320] >TRACE:   clssscSetDebugLevel: The logging level is set to 1 ,the cache level is set to


------- 维护 votedisk
图形化界面安装 clusterware 过程中,配置 votedisk 时,如果选择 external redundancy 策略,则只能选一个 votedisk
其实,即使选择了该选项也可以使用crsctl 命令添加多块 votedisk 盘,这些 votedisk 盘可以互为镜像。
votedisk 采用多数可用算法,如果存在多个 votedisk ,则必须有一半以上的 votedisk 可用时集群才能正常工作。
例如,如果一个cluster配置了4个 votedisk ,当其中有一个votedisk 损坏时,集群能够正常工作,但是当其中有两个 votedisk 损坏时,
集群就无法工作了,会立即宕机。
votedisk 的添加原则:奇数个,操作前必须先停止数据库、ASM、CRS Stack ,操作时必须加上 -force 参数。


------- 添加 votedisk 示例:
1、创建共享磁盘:
在Windows主机上进入Oracle Virtual Box 的安装路径:
VBoxManage createhd --filename G:\share2\share2.vdi --size 4000 --format VDI --variant Fixed
在G:\Shared2目录下创建共享磁盘,大小为4g
将刚刚创建的共享磁盘添加到node1和node2虚拟主机
      首先,关闭两个节点主机node1和node2,然后执行以下两条语句
    VBoxManage storageattach rac11 --storagectl "IDE 控制器" --port 1 --device 1 --type hdd --medium G:\share2\share3.vdi --mtype shareable
    VBoxManage storageattach rac22 --storagectl "IDE 控制器" --port 0 --device 1 --type hdd --medium G:\share2\share3.vdi --mtype shareable
      --storagectl "IDE 控制器" :在虚拟机看到的名称,如果是英文版的,可能名称不一样
         --port 0  :第一个IDE接口
         --device 1  :IDE接口的辅盘,主盘为 0
启用共享磁盘
       VBoxManage modifyhd G:\share2\share2.vdi --type shareable


2、当前 votedisk 的位置:
[root@rac22 ~]# crsctl query css votedisk
 0.     0    /dev/raw/raw2


located 1 votedisk(s).
3、停止所有节点上的 CRS
[root@rac11 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac11 ~]# crsctl check crs
Failure 1 contacting CSS daemon
Cannot communicate with CRS
Cannot communicate with EVM 


4、添加 votedisk (添加两个使votedisk 个数为奇数)
[root@rac11 ~]# crsctl add css votedisk /dev/raw/raw5
Cluster is not in a ready state for online disk addition
即使是在 CRS 关闭后,也必须指定 -force 参数来添加或删除 votedisk。且 -force 参数只有在 CRS 关闭时使用才安全。
[root@rac11 ~]# crsctl add css votedisk -force /dev/raw/raw5
Now formatting voting disk: /dev/raw/raw5
successful addition of votedisk /dev/raw/raw5.
[root@rac11 ~]# crsctl add css votedisk -force /dev/raw/raw6
Now formatting voting disk: /dev/raw/raw6
successful addition of votedisk /dev/raw/raw6.


5、查询添加结果
[root@rac22 ~]# crsctl query css votedisk
 0.     0    /dev/raw/raw2
 1.     0    /dev/raw/raw5
 2.     0    /dev/raw/raw6


located 3 votedisk(s).


6、启动 CRS
[root@rac22 ~]# crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly
[root@rac11 ~]# crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly


-------- 删除 votedisk 示例:
1、查看 votedisk 路径
[root@rac11 ~]# crsctl query css votedisk
 0.     0    /dev/raw/raw2
 1.     0    /dev/raw/raw5
 2.     0    /dev/raw/raw6
2、停止所有节点上的 crs
[root@rac11 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac22 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
3、删除 votedisk
[root@rac11 ~]# crsctl | grep votedisk
       crsctl query  css votedisk    - lists the voting disks used by CSS
       crsctl add    css votedisk <path> - adds a new voting disk
       crsctl delete css votedisk <path> - removes a voting disk
[root@rac11 ~]# crsctl delete css votedisk /dev/raw/raw6 -force
successful deletion of votedisk /dev/raw/raw6.
4、查看是否删除成功
[root@rac11 ~]# crsctl query css votedisk
 0.     0    /dev/raw/raw2
 1.     0    /dev/raw/raw5


located 2 votedisk(s).


---------- OCR 命令
OCR disk 是用于存放整个集群的配置信息共享存储。在整个集群中只能有一个节点对 OCR DISK 进行写操作,叫 Master Node。
所有节点在内存中都会保留一份OCR的副本,同时有一个 OCR process 从这个内存中读取内容。OCR 内容发生改变时,由Master Node 的 OCR
process 负责同步到其他节点的 OCR process。


OCR 的内容非常重要,Oracle 每 4 个小时会对其做一次备份,并保留最近的3个备份以及前一天、前一周的最后一个备份,备份工作有 Master Node 的 CRSD
进程来完成。默认备份路径为:$CRS_HOME/crs/cdata/cluster_name


OCR 维护相关的命令
--------ocrdump 的用法
ocrdump 可以按 ASCII 的方式打印输出 OCR 的内容,但这个命令不能用作 OCR 的备份恢复,仅供阅读 OCR 不供恢复 OCR。
[root@rac22 ~]# ocrdump -h
Name:
        ocrdump - Dump contents of Oracle Cluster Registry to a file.


Synopsis:
        ocrdump [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]


Description:
        Default filename is OCRDUMPFILE. Examples are:


        prompt> ocrdump
        writes cluster registry contents to OCRDUMPFILE in the current directory


        prompt> ocrdump MYFILE
        writes cluster registry contents to MYFILE in the current directory


        prompt> ocrdump -stdout -keyname SYSTEM
        writes the subtree of SYSTEM in the cluster registry to stdout


        prompt> ocrdump -stdout -xml
        writes cluster registry contents to stdout in xml format


Notes:
        The header information will be retrieved based on best effort basis.
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
        you have file creation privileges in the above directory before
        running this tool.


-------- 将 SYSTEM.css 键的内容以 .xml 格式打印输出到屏幕
OCR key 主要有三类:SYSTEM、DATABASE、CRS
[oracle@rac11 ~]$ ocrdump -stdout -keyname SYSTEM.css -xml | more
<OCRDUMP>


<TIMESTAMP>07/16/2012 10:12:34</TIMESTAMP>
<COMMAND>ocrdump -stdout -keyname SYSTEM.css -xml </COMMAND>


<KEY>
<NAME>SYSTEM.css</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><![CDATA[]]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
<GROUP_PERMISSION>PROCR_READ</GROUP_PERMISSION>
<OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
<USER_NAME>root</USER_NAME>
<GROUP_NAME>root</GROUP_NAME>
..................................
..................................


该命令将在 $CRS_HOME/log/node_name/client目录下产生日志文件,格式为 ocrdump_pid.ora,pid 为进程号
--------- 将 SYSTEM.css key 的内容以文件形式打印输出
[root@rac11 client]# ocrdump '/home/oracle/ocrdump_test.log' -keyname SYSTEM.css -xml


---------------ocrcheck 命令
ocrcheck 命令用于检查 OCR 内容的一致性:命令执行过程中会在此目录下产生日志 $ORACLE_HOME/log/<hostname>/client/ocrcheck_<pid>.log 
ocrcheck 命令不需要参数
[oracle@rac11 ~]$ ocrcheck -h
Name:
        ocrcheck - Displays health of Oracle Cluster Registry.


Synopsis:
        ocrcheck 


Description:
        prompt> ocrcheck
        Displays current usage, location and health of the cluster registry


Notes:
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrcheck_<pid>.log. Please ensure
        you have file creation privileges in the above directory before
        running this tool.

如果 OCR 内容一致,则产生的输出如下:
[root@rac22 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     204712
         Used space (kbytes)      :       3840
         Available space (kbytes) :     200872
         ID                       : 1788954814
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded


                                    Device/File not configured


         Cluster registry integrity check succeeded
如果不一致则产生如下输出:
[root@rac22 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     204712
         Used space (kbytes)      :       3840
         Available space (kbytes) :     200872
         ID                       : 1788954814
         Device/File Name         : /dev/raw/raw1
                                    Device/File need to be synchronized with the other device


                                    Device/File not configured


         Cluster registry integrity check succeeded


------------- ocrconfig 命令
ocrconfig 命令用于维护 OCR 磁盘。
在安装 clusterware 过程中如果选择 external redundancy ,则只能指定一个 OCR disk。但是 Oracle 允许且只允许配置两个 OCR disk 互为
镜像,以防止 OCR 磁盘发生单点故障。OCR 磁盘和 votedisk 不一样,最多只能有两个,一个为 Primary OCR 一个为 Mirror OCR。
[root@rac22 ~]# ocrconfig -h
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/<hostname>/client/ocrconfig_<pid>.log. Please ensure
        you have file creation privileges in the above directory before
        running this tool.


---------使用 ocrconfig 查看自动备份
[root@rac22 ~]# ocrconfig -showbackup


---------修改 OCR 自动备份的位置
默认位置为:$OCR_HOME/crs/cdata/cluster_name/
[root@rac22 ~]# ocrconfig -backuploc /home/oracle/backup


---------使用导出、导入进行备份和恢复
Oracle建议在对集群做调整(增加、删除节点)之前,对OCR进行备份,可以使用 export 备份到指定文件。如果做了 replace 或 restore 操作,Oracle
还建议使用 cluvfy compocr-n all 做一次全面的检查。
1、首先关闭所有节点的 CRS
[root@rac22 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2、导出 OCR 的内容(必须以 root 权限)
[root@rac22 ocr_backup]# ocrconfig -export ocrexp.exp  /home/oracle/ocr_backup/ocrexp.exp
3、重启 CRS
[root@rac11 ~]# crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly


[root@rac22 ~]# crsctl start crs
Attempting to start CRS stack 
The CRS stack will be started shortly


4、检查 CRS 状态
[root@rac11 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[root@rac22 ~]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy


5、破坏 OCR 内容
[root@rac11 ~]# dd if=/dev/zero of=/dev/raw/raw1 bs=1024 count=200
200+0 records in
200+0 records out


6、运行 cluvfy 工具检查 OCR 一致性(失败)
[root@rac11 ~]# /soft/clusterware/cluvfy/runcluvfy.sh comp ocr -n all


Verifying OCR integrity 


ERROR: 
User equivalence unavailable on all the nodes.
Verification cannot proceed.




Verification of OCR integrity was unsuccessful on all the nodes. 
7、使用ocrcheck 检查 OCR 的一致性
[root@rac11 ~]# ocrcheck
PROT-601: Failed to initialize ocrcheck


8、使用 import 恢复 OCR 的内容
[root@rac11 ~]# ocrconfig -import /home/oracle/ocr_backup/ocrexp.exp 
PROT-19: Cannot proceed while clusterware is running. Shutdown clusterware first
先关闭 CRS,然后再执行 import 恢复
在本例中,因为是在打开 CRS 的时候破坏了 OCR,因此是无法成功关闭 CRS 的,关闭时会报错。只能重启系统,重启后CRS将无法启动这时
执行上述命令即可成功:
[root@rac11 ~]# ocrconfig -import /home/oracle/ocr_backup/ocrexp.exp
9、再次使用 ocrcheck 检查一致性状态(通过)
[root@rac11 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     204712
         Used space (kbytes)      :       3840
         Available space (kbytes) :     200872
         ID                       :  825485411
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded


                                    Device/File not configured


         Cluster registry integrity check succeeded
10、使用cluvfy工具检查(通过)。
[root@rac11 ~]# /soft/clusterware/cluvfy/runcluvfy.sh comp ocr -n all
Verifying OCR integrity 


ERROR: 
User equivalence unavailable on all the nodes.
Verification cannot proceed.




Verification of OCR integrity was unsuccessful on all the nodes. 
----------这里检测的结果不成功,不知何因。


11、启动 CRS
crsctl start crs

crsctl check crs



如需转载,请注明出处及原文链接

http://blog.csdn.net/xiangsir/article/details/8576849




















版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xiangsir/article/details/8576849

智能推荐

分布式光纤传感器的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告_预计2026年中国分布式传感器市场规模有多大-程序员宅基地

文章浏览阅读3.2k次。本文研究全球与中国市场分布式光纤传感器的发展现状及未来发展趋势,分别从生产和消费的角度分析分布式光纤传感器的主要生产地区、主要消费地区以及主要的生产商。重点分析全球与中国市场的主要厂商产品特点、产品规格、不同规格产品的价格、产量、产值及全球和中国市场主要生产商的市场份额。主要生产商包括:FISO TechnologiesBrugg KabelSensor HighwayOmnisensAFL GlobalQinetiQ GroupLockheed MartinOSENSA Innovati_预计2026年中国分布式传感器市场规模有多大

07_08 常用组合逻辑电路结构——为IC设计的延时估计铺垫_基4布斯算法代码-程序员宅基地

文章浏览阅读1.1k次,点赞2次,收藏12次。常用组合逻辑电路结构——为IC设计的延时估计铺垫学习目的:估计模块间的delay,确保写的代码的timing 综合能给到多少HZ,以满足需求!_基4布斯算法代码

OpenAI Manager助手(基于SpringBoot和Vue)_chatgpt网页版-程序员宅基地

文章浏览阅读3.3k次,点赞3次,收藏5次。OpenAI Manager助手(基于SpringBoot和Vue)_chatgpt网页版

关于美国计算机奥赛USACO,你想知道的都在这_usaco可以多次提交吗-程序员宅基地

文章浏览阅读2.2k次。USACO自1992年举办,到目前为止已经举办了27届,目的是为了帮助美国信息学国家队选拔IOI的队员,目前逐渐发展为全球热门的线上赛事,成为美国大学申请条件下,含金量相当高的官方竞赛。USACO的比赛成绩可以助力计算机专业留学,越来越多的学生进入了康奈尔,麻省理工,普林斯顿,哈佛和耶鲁等大学,这些同学的共同点是他们都参加了美国计算机科学竞赛(USACO),并且取得过非常好的成绩。适合参赛人群USACO适合国内在读学生有意向申请美国大学的或者想锻炼自己编程能力的同学,高三学生也可以参加12月的第_usaco可以多次提交吗

MySQL存储过程和自定义函数_mysql自定义函数和存储过程-程序员宅基地

文章浏览阅读394次。1.1 存储程序1.2 创建存储过程1.3 创建自定义函数1.3.1 示例1.4 自定义函数和存储过程的区别1.5 变量的使用1.6 定义条件和处理程序1.6.1 定义条件1.6.1.1 示例1.6.2 定义处理程序1.6.2.1 示例1.7 光标的使用1.7.1 声明光标1.7.2 打开光标1.7.3 使用光标1.7.4 关闭光标1.8 流程控制的使用1.8.1 IF语句1.8.2 CASE语句1.8.3 LOOP语句1.8.4 LEAVE语句1.8.5 ITERATE语句1.8.6 REPEAT语句。_mysql自定义函数和存储过程

半导体基础知识与PN结_本征半导体电流为0-程序员宅基地

文章浏览阅读188次。半导体二极管——集成电路最小组成单元。_本征半导体电流为0

随便推点

【Unity3d Shader】水面和岩浆效果_unity 岩浆shader-程序员宅基地

文章浏览阅读2.8k次,点赞3次,收藏18次。游戏水面特效实现方式太多。咱们这边介绍的是一最简单的UV动画(无顶点位移),整个mesh由4个顶点构成。实现了水面效果(左图),不动代码稍微修改下参数和贴图可以实现岩浆效果(右图)。有要思路是1,uv按时间去做正弦波移动2,在1的基础上加个凹凸图混合uv3,在1、2的基础上加个水流方向4,加上对雾效的支持,如没必要请自行删除雾效代码(把包含fog的几行代码删除)S..._unity 岩浆shader

广义线性模型——Logistic回归模型(1)_广义线性回归模型-程序员宅基地

文章浏览阅读5k次。广义线性模型是线性模型的扩展,它通过连接函数建立响应变量的数学期望值与线性组合的预测变量之间的关系。广义线性模型拟合的形式为:其中g(μY)是条件均值的函数(称为连接函数)。另外,你可放松Y为正态分布的假设,改为Y 服从指数分布族中的一种分布即可。设定好连接函数和概率分布后,便可以通过最大似然估计的多次迭代推导出各参数值。在大部分情况下,线性模型就可以通过一系列连续型或类别型预测变量来预测正态分布的响应变量的工作。但是,有时候我们要进行非正态因变量的分析,例如:(1)类别型.._广义线性回归模型

HTML+CSS大作业 环境网页设计与实现(垃圾分类) web前端开发技术 web课程设计 网页规划与设计_垃圾分类网页设计目标怎么写-程序员宅基地

文章浏览阅读69次。环境保护、 保护地球、 校园环保、垃圾分类、绿色家园、等网站的设计与制作。 总结了一些学生网页制作的经验:一般的网页需要融入以下知识点:div+css布局、浮动、定位、高级css、表格、表单及验证、js轮播图、音频 视频 Flash的应用、ul li、下拉导航栏、鼠标划过效果等知识点,网页的风格主题也很全面:如爱好、风景、校园、美食、动漫、游戏、咖啡、音乐、家乡、电影、名人、商城以及个人主页等主题,学生、新手可参考下方页面的布局和设计和HTML源码(有用点赞△) 一套A+的网_垃圾分类网页设计目标怎么写

C# .Net 发布后,把dll全部放在一个文件夹中,让软件目录更整洁_.net dll 全局目录-程序员宅基地

文章浏览阅读614次,点赞7次,收藏11次。之前找到一个修改 exe 中 DLL地址 的方法, 不太好使,虽然能正确启动, 但无法改变 exe 的工作目录,这就影响了.Net 中很多获取 exe 执行目录来拼接的地址 ( 相对路径 ),比如 wwwroot 和 代码中相对目录还有一些复制到目录的普通文件 等等,它们的地址都会指向原来 exe 的目录, 而不是自定义的 “lib” 目录,根本原因就是没有修改 exe 的工作目录这次来搞一个启动程序,把 .net 的所有东西都放在一个文件夹,在文件夹同级的目录制作一个 exe._.net dll 全局目录

BRIEF特征点描述算法_breif description calculation 特征点-程序员宅基地

文章浏览阅读1.5k次。本文为转载,原博客地址:http://blog.csdn.net/hujingshuang/article/details/46910259简介 BRIEF是2010年的一篇名为《BRIEF:Binary Robust Independent Elementary Features》的文章中提出,BRIEF是对已检测到的特征点进行描述,它是一种二进制编码的描述子,摈弃了利用区域灰度..._breif description calculation 特征点

房屋租赁管理系统的设计和实现,SpringBoot计算机毕业设计论文_基于spring boot的房屋租赁系统论文-程序员宅基地

文章浏览阅读4.1k次,点赞21次,收藏79次。本文是《基于SpringBoot的房屋租赁管理系统》的配套原创说明文档,可以给应届毕业生提供格式撰写参考,也可以给开发类似系统的朋友们提供功能业务设计思路。_基于spring boot的房屋租赁系统论文