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

智能推荐

Python医院挂号脚本-程序员宅基地

文章浏览阅读1k次,点赞13次,收藏15次。创建一个简单的医院挂号系统通常涉及患者注册、挂号功能,以及医生的安排。这里我们将使用 Python 来实现一个基本的命令行挂号系统。我们将使用字典来存储患者和医生的数据,以简化数据库操作。_挂号脚本

《Machine Learning(Tom M. Mitchell)》读书笔记——2、第一章_machine learning by tom m. mitchell-程序员宅基地

文章浏览阅读1.9k次。1. Introduction (about machine learning)2. Concept Learning and the General-to-Specific Ordering3. Decision Tree Learning4. Artificial Neural Networks5. Evaluating Hypotheses6. Bayesian Le_machine learning by tom m. mitchell

【小睿精选·第七期】基于STM32的DIY蓝牙机械键盘-程序员宅基地

文章浏览阅读1.8k次。【小睿精选】【小睿精选】第七弹来啦,本期共收录 6条 嵌入式资讯信息,希望可以帮到你。欢迎大家在文末留言,唠一唠你关注的话题,说不定下期就有你想要的惊喜!资讯类1、瑞萨推出RZ/V系列微..._stm32,diy蓝牙机械键盘

JVM----类加载和初始化_jvm 类加载 初始化-程序员宅基地

文章浏览阅读1.9w次。JVM-类加载和初始化类加载-初始化loading 把class文件加载到内存linkingVerification:校验class文件是否符合标准preparation:给静态变量赋默认值,如给static int i = 8赋值为i=0resolution:常量池中的用到的那些符号引用要准换成能访问到的内存地址initializing :这时候才会调用静态代码块给静态变量赋值类加载器loadingjvm中所有的class都是被classloader加载到内存以上几个类_jvm 类加载 初始化

家庭中文版升级专业版0xC004F069的解决方法_软件授权服务找不到产品sku-程序员宅基地

文章浏览阅读647次,点赞4次,收藏8次。本文章适用于Windows升级没有SKU导致的问题。_软件授权服务找不到产品sku

MSF恶意程序利用+CS上线_metasploit克隆网站-程序员宅基地

文章浏览阅读214次。我是dream,我在新课程培训学习网安方面的知识,下面是关于msf恶意程序利用以及CS的内容。_metasploit克隆网站

随便推点

QTableView行列大小的调整模式_qtableview设置列宽可拖动-程序员宅基地

文章浏览阅读3.7k次,点赞2次,收藏12次。QHeaderView 类中用于设置表头视图列或行的大小调整模式的枚举类型_qtableview设置列宽可拖动

RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should b-程序员宅基地

文章浏览阅读6.9k次,点赞3次,收藏9次。项目场景:手搓神经网络问题描述:RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same原因分析:没有把输入数据类型转为float类型解决方案:x = x.type(torch.cuda.FloatTensor)注意,加上 .cuda我参考的文章给了我思路,在我实践的时候,发现还需要添加.cuda参考链接链接: li_runtimeerror: input type (torch.cuda.doubletensor) and weight type (torch.cu

uni-app基础知识学习【5】上传图片、预览图片+跨域兼容+导航跳转_h5 uni.chooseimage拍照并预览-程序员宅基地

文章浏览阅读1.3k次。一、上传图片、预览图片1.上传图片uni.chooseImage方法从本地相册选择图片或使用相机拍照。案例代码<template> <view> <button @click="chooseImg" type="primary">上传图片</button> <view> <image v-for="item in imgArr" :src="item" :key="index"></image> _h5 uni.chooseimage拍照并预览

毕设项目分享 人脸识别系统-程序员宅基地

文章浏览阅读533次,点赞21次,收藏13次。今天学长向大家介绍一个机器视觉的毕设项目,基于深度学习的人脸识别系统毕业设计 opencv人脸识别系统。

Python对txt文档进行读,写,追加,修改操作(open,pandas,numpy)_open txt文件续写-程序员宅基地

文章浏览阅读1k次。Python对txt文档进行读,写,追加,修改操作上次写了一篇Python对csv文档进行读,写,追加操作,这次写一篇关于txt的操作。本文将使用open,pandas,numpy三种方式对txt文档进行读,写,追加,在此不推荐使用此方式操作 f = open(’test.txt’, ‘w’),因为该方法结束时候需要使用f.close(),如果忘记写close,则可能出现数据丢失的情况1.with open()方式读:with open("test.txt","r") as f: ._open txt文件续写

用cmd登录mysql怎么避免看见密码_命令行登录防止MySQL密码泄露的几个小妙招。...-程序员宅基地

文章浏览阅读418次。命令行登录防止MySQL密码泄露的几个小妙招。明知山有虎偏向虎山行的方案:1、可以通过如下环境变量强制Linux不记录敏感历史命令在命令行执行HISTCONTROL=ignorespace后,再输入带密码的命令的前面加一个空格登录,登录命令不会被记录到历史记录里。[root@oldboy~]# HISTCONTROL=ignorespace#<==这里是临时生效,要想永久生效,请放入/etc..._如何忽略mysql数据库在命令行使用密码不安全

推荐文章

热门文章

相关标签