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

智能推荐

使用JDBC连接数据库出现 The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more than one解决方案_jdbc.properties timezone-程序员宅基地

文章浏览阅读553次。在 jdbc.properties 文件中的 url 后面加上 ?serverTimezone=UTC加入之前的jdbc.properties文件:user=rootpassword=12345678url=jdbc:mysql://localhost:3306/testdriverClass=com.mysql.cj.jdbc.Driver加入之后:user=rootpassword=12345678url=jdbc:mysql://localhost:3306/test?serv_jdbc.properties timezone

计算机图形学孔令德基础知识,计算机图形学基础教程孔令德答案-程序员宅基地

文章浏览阅读1.4k次。计算机图形学基础教程孔令德答案【篇一:大学计算机图形学课程设】息科学与工程学院课程设计任务书题目:小组成员:巴春华、焦国栋成员学号:专业班级:计算机科学与技术、2009级本2班课程:计算机图形学指导教师:燕孝飞职称:讲师完成时间: 2011年12 月----2011年 12 月枣庄学院信息科学与工程学院制2011年12 月20日课程设计任务书及成绩评定12【篇二:计算机动画】第一篇《计算机图形学》..._计算机图形学基础教程 孔令德 答案

python xlwings追加数据_大数据分析Python库xlwings提升Excel工作效率教程-程序员宅基地

文章浏览阅读1k次。原标题:大数据分析Python库xlwings提升Excel工作效率教程Excel在当今的企业中非常非常普遍。在AAA教育,我们通常建议出于很多原因使用代码,并且我们的许多数据科学课程旨在教授数据分析和数据科学的有效编码。但是,无论您偏爱使用大数据分析Python的程度如何,最终,有时都需要使用Excel来展示您的发现或共享数据。但这并不意味着仍然无法享受大数据分析Python的某些效率!实际上,..._xlwings通过索引添加数据

java8u211_jre864位u211-程序员宅基地

文章浏览阅读911次。iefans为用户提供的jre8 64位是针对64位windows平台而开发的java运行环境软件,全称为java se runtime environment 8,包括Java虚拟机、Java核心类库和支持文件,不包含开发工具--编译器、调试器和其它工具。jre需要辅助软件--JavaPlug-in--以便在浏览器中运行applet。本次小编带来的是jre8 64位官方版下载,版本小号u211版..._jre8是什么

kasp技术原理_KASP基因分型-程序员宅基地

文章浏览阅读5k次。KASP基因分型介绍KASP(Kompetitive Allele-Specific PCR),即竞争性等位基因特异性PCR,原理上与TaqMan检测法类似,都是基于终端荧光信号的读取判断,每孔反应都是采用双色荧光检测一个SNP位点的两种基因型,不同的SNP对应着不同的荧光信号。KASP技术与TaqMan法类似,它与TaqMan技术不同的是,它不需要每个SNP位点都合成特异的荧光引物,它基于独特的..._kasp是什么

华为p50预装鸿蒙系统,华为p50会不会预装鸿蒙系统_华为p50会预装鸿蒙系统吗-程序员宅基地

文章浏览阅读154次。华为现在比较火的还真就是新开发的鸿蒙系统了,那么在即将上市的华为p50手机上会不会预装鸿蒙系统呢?接下来我们就来一起了解一下华为官方发布的最新消息吧。1.华为p50最新消息相信大家都知道,随着华为鸿蒙OS系统转正日期临近,似乎全网的花粉们都在关注华为鸿蒙OS系统优化、生态建设等等,直接忽略了不断延期发布的华为P50手机,如今华为P50系列手机终于传来了最新的好消息,在经过一系列方案修改以后,终于被..._华为手机p50直接预装鸿蒙系统

随便推点

python用什么软件编程好-初学python编程,有哪些不错的软件值得一用?-程序员宅基地

文章浏览阅读2.1k次。Python编程的软件其实许多,作为一门面向大众的编程言语,许多修正器都有对应的Python插件,当然,也有特地的PythonIDE软件,下面我简单引见几个不错的Python编程软件,既有修正器,也有IDE,感兴味的朋友可以本人下载查验一下:1.VSCode:这是一个轻量级的代码修正器,由微软规划研发,免费、开源、跨途径,轻盈活络,界面精练,支撑常见的自动补全、语法提示、代码高亮、Git等功用,插..._python入门学什么好

pytorch一步一步在VGG16上训练自己的数据集_torch vgg训练自己的数据集-程序员宅基地

文章浏览阅读3.2w次,点赞30次,收藏307次。准备数据集及加载,ImageFolder在很多机器学习或者深度学习的任务中,往往我们要提供自己的图片。也就是说我们的数据集不是预先处理好的,像mnist,cifar10等它已经给你处理好了,更多的是原始的图片。比如我们以猫狗分类为例。在data文件下,有两个分别为train和val的文件夹。然后train下是cat和dog两个文件夹,里面存的是自己的图片数据,val文件夹同train。这样我们的..._torch vgg训练自己的数据集

毕业论文管理系统设计与实现(论文+源码)_kaic_论文系统设计法-程序员宅基地

文章浏览阅读968次。论文+系统+远程调试+重复率低+二次开发+毕业设计_论文系统设计法

在python2与python3中转义字符_Python 炫技操作:五种 Python 转义表示法-程序员宅基地

文章浏览阅读134次。1. 为什么要有转义?ASCII 表中一共有 128 个字符。这里面有我们非常熟悉的字母、数字、标点符号,这些都可以从我们的键盘中输出。除此之外,还有一些非常特殊的字符,这些字符,我通常很难用键盘上的找到,比如制表符、响铃这种。为了能将那些特殊字符都能写入到字符串变量中,就规定了一个用于转义的字符 \ ,有了这个字符,你在字符串中看的字符,print 出来后就不一定你原来看到的了。举个例子>..._pytyhon2、python3对%转义吗

java jar 文件 路径问题_「问答」解决jar包运行时相对路径问题-程序员宅基地

文章浏览阅读1.3k次。我这几天需要做一个Java程序,需要通过jar的形式运行,还要生成文件。最终这个程序是要给被人用的,可能那个用的人还不懂代码。于是我面临一个问题:生成的文件一定不能存绝对路径。刚开始我想得很简单,打绝对路径改成相对路径不就行了吗?于是有了这样的代码:String path = "../test.txt";File file = new File(path);……这个写法本身并没有问题,直接运行代码..._jar启动文件路径中存在!

微信读书vscode插件_曾经我以为 VSCode 是程序员专属的工具,直到发现了这些……...-程序员宅基地

文章浏览阅读598次。如果你知道 VSCode,一说起它,你可能第一个想到的就是把它当做一个代码编辑器,而它的界面应该可能大概率是这样的——如果你恰好又是个程序员,那你可能经常会用到它,不管是 Python、JS 还是 C++ 等各种语言对应的文件,都可以用它来进行简单的编辑和整理,甚至是运行和 debug......但是今天要讲的显然不是这些,经过小美的多方研究,发现了即使是对于大多数并不了解 VSCode,也完全不..._vscode weixin read

推荐文章

热门文章

相关标签