【ORACLE RAC】root.sh原理,ocr管理

来源:互联网 发布:webstorm js 格式化 编辑:程序博客网 时间:2024/06/07 23:56

****************************************************************************原文:blog.csdn.net/clark_xu  徐长亮的专栏************************************************************************Root.sh的原理

1.      In root.sh script, it will addCRS related entry in /etc/inittab,

2.      Root.sh运行

/oracle/product/crs/install/rootinstall

/oracle/product/crs/install/rootconfig

3.      Rootinstall作用:

a)        /oracle/product/crs/bin/crs*的程序改成root 555

b)        /oracle/product/crs/bin/crsd改为 744

c)        建立路径:/oracle/product/crs/crs/init

d)        /oracle/product/crs/crs/public被所有读写 777.

e)        Crs/evm  crs/evm/init 750

f)         Crs/css crs/css/initcrs/css/log  crs/css/auth  711

4.      Rootconfig的作用

a)        概述:

                        i.             1) Stop if any GSDs are runningfrom 9.x oracle homes

                      ii.             2) Initialize new OCR device orupgrade the existing OCR device

                     iii.             3) Setup OCR for running CRSstack

                     iv.             4) Copy the CRS init script toinit.d for init process to start

                      v.              5) Start the CRS stack

                     vi.              6) Configure NodeApps if CRS is up and runningon all nodes

b)        Setup ocr

                        i.             $CH/bin/clscfg -install -nn$CRS_NODE_NAME_LIST -pn $CRS_PRIVATE_NAME_LIST \

      $HOSTNAMES_ARGS-o $CH -c $CRS_CLUSTER_NAME -l "$CRS_LANGUAGE_ID" -q $CRS_V

OTING_DISKS \

      $CLSCFG_MISCNT

c)        更改/tmp/.oracle的属性

                        i.             复杂# basic copies first...

                      ii.             $CP $CH/evm/admin/init.evmd$ID/init.evmd || { $ECHO $?; exit 1; }

                     iii.             $CP $CH/css/admin/init.cssd $ID/init.cssd|| { $ECHO $?; exit 1; }

                     iv.             $CP $CH/crs/admin/init.crsd$ID/init.crsd || { $ECHO $?; exit 1; }

                      v.             $CP $CH/crs/admin/init.crs$ID/init.crs || { $ECHO $?; exit 1; }

d)        启动crs stack过程

                        i.             # Prepare to start the daemons.    /init.crs start

                      ii.             #Check to see if they are goingto start.

$ID/init.cssd startcheck CSS

          $CRSCTL check install -wait 600

     检查VIP$CH/bin/vipca -silent -nodelist $CRS_NODELIST -nodevips$CRS_NODEVIPS

5.      Init.crs

a)        概述

                        i.             #    init.crs start       manual startup of the CRS stack

                      ii.             #    init.crs stop        shuts down the CRS stack

                     iii.             #    init.crs disable     prevents CRS stack from starting at boottime

                     iv.             #    init.crs enable      allows CRS stack to start at boot time

b)        cssd and evmd. evmd should beshutdown before crsd.

6.      Init.cssd

a)        [root@host1 etc]# ps -ef | grep-v grep | grep init.cssd

b)        root      2598    1  0 08:16 ?        00:00:11 /bin/sh /etc/init.d/init.cssdfatal

c)        root      3014 2598  0 08:17 ?        00:00:00 /bin/sh /etc/init.d/init.cssddaemon

d)        [root@host1 etc]# pstree 2598-a

OCR

1.定义

集群注册表(Oracle ClusterRegistryOCR):维护集群的配置信息及集群中任何集群数据库的配置信息。OCR也管理那些Oracle Clusterware控制的相关进程的相关信息。OCR将配置信息存储在一个目录树结构中的一系列关键字-值对中(key-value pairs)。OCR必须位于集群中所有结点可同时访问的共享磁盘中。Oracle Clusterware可使用多重OCRmultiplex或称为多路复用)。Oracle建议使用此特性以保证高可用性。你可以在联机时替换一个故障的OCR,可通过支持的API(如企业管理器、srvctldbca)来更新OCR

备份

[root@host1 crs]# ls

backup00.ocr  backup01.ocr day_.ocr  day.ocr  OCRDUMPFILE week.ocr

[root@host1 crs]# pwd

/oracle/product/crs/cdata/crs

Oracle 4个小时对其做一次备份,并且保留最后的3个备份,以及前一天,前一周的最后一个备份。只有一个节点能对OCR Disk进行读写操作,这个节点叫作Master Node,所有节点都会在内存中保留一份OCR的拷贝。

日志

/oracle/product/crs/log/host1/client/路径下面

OCR磁盘最多只能有两个,一个PrimaryOCR和一个Mirror OCR

/oracle/product/crs/cdata/crs /OCRDUMPFILE文件中存放ocr注册表信息。

检测

cluvfy comp ocr -n all

导入与恢复

[root@host1 oracle]#/oracle/product/crs/bin/ocrconfig -import /oracle/ocr.exp

 [root@host1oracle]# /oracle/product/crs/bin/ocrconfig -export /oracle/ocr.exp

恢复OCR文件:ocrconfig-restore /u01/app/oracle/product/10.2.0/crs_1/cdata/crs/backup00.ocr

添加OCR文件,crs必须启动,否则会遇到PROT-1错误:(PROT-1:Failed to initialize ocrconfig

查看主和镜像

[oracle@host1 crs]$ cat /etc/oracle/ocr.loc

ocrconfig_loc=/dev/raw/raw1

ocrmirrorconfig_loc=/dev/raw/raw2

local_only=FALSE

voting disk

查看

[oracle@host1 crs]$ crsctl query cssvotedisk

 0.    0    /dev/raw/raw3

 1.    0    /dev/raw/raw4

 2.    0    /dev/raw/raw5

 

located 3 votedisk(s).

VIPCA

出于种种原因我们可能需要为已安装的Oracle集群软件修改其使用的公用或私有网络所使用的网络接口(How to Change Interconnect/Public Interface IP or Subnet in OracleClusterware),这些共有或私有网络(public/private network)被保存在ocr中,我们需要以root用户的身份执行oifcfg命令来对这些网络接口信息进行修改:

/* 使用ocrdump命令转储ocr信息 */

 

[oracle@vrh1 ~]$ ocrdump ocr

 

[oracle@vrh1 ~]$ cat ocr

 

[SYSTEM.css.interfaces]UNDEF

[SYSTEM.css.interfaces.global]UNDEF

[SYSTEM.css.interfaces.global.eth0]UNDEF

[SYSTEM.css.interfaces.global.eth0.131|d32|d1|d0]UNDEF

[SYSTEM.css.interfaces.global.eth0.131|d32|d1|d0]ORATEXT: public

 

[SYSTEM.css.interfaces.global.eth1]UNDEF

[SYSTEM.css.interfaces.global.eth1.131|d33|d1|d0]UNDEF:

[SYSTEM.css.interfaces.global.eth1.131|d33|d1|d0]ORATEXT: cluster_interconnect

 

.............

 

/* 实际上cssmisscount参数和votingdisk所在的位置也存在ocr文件中  */

 

[SYSTEM.css.misscount]UB4 (10) : 60

[SYSTEM.css.diskfile]ORATEXT :/dev/raw/raw2

 

1.首先我们可以通过oifcfg getif了解当前的public/interconnect网络配置情况:

[root@vrh1 ~]# who am i

root    pts/1        2011-04-18 18:23(192.168.0.1)

 

[root@vrh1 ~]# cd $ORA_CRS_HOME/bin

 

[root@vrh1 bin]# oifcfg getif

eth0 131.32.1.0  global  public

eth1 131.33.1.0  global  cluster_interconnect

 

/* 可以看到这里分别用131.32.1/2网段配置了publiccluster_interconnect网络  */

 

2.确认在/etc/hosts文件中为新的网络接口IP做了必要的修改,之后我们要保证当前CRS已经启动(否则将出现PRIF-10: failed to initialize the cluster registry错误而无法配置),使用oifcfgsetif命令首先添加新的public公用网络接口:

[root@vrh1 bin]# oifcfg delif -global eth0

 

/* 首先删除旧有的公用网络接口信息  */

 

[root@vrh1 bin]# oifcfg setif -globaleth0/192.168.1.0:public

 

/* 注意这里制定192.168.1.0这个网段即可,不用输入完整的ip */

 

/* 因为以上操作是global全局操作,在单个节点完成即可 */

 

3.修改内联网络(cluster_interconnect)接口的方法也是类似的:

[root@vrh1 bin]# oifcfg delif -global eth1

 

[root@vrh1 bin]# oifcfg setif -globaleth1/192.168.0.0:cluster_interconnect

 

/* public network配置时类似指定网段即可  */

 

4.确认网络接口的修改情况,以及当前数据库使用的inter connecter状况:

[oracle@vrh1 ~]$ oifcfg getif

eth0 192.168.1.0  global  public

eth1 192.168.0.0  global  cluster_interconnect

 

SQL> select * from x$skgxpia;

 

ADDR           INDX    INST_ID PUB_SKGXPI PICKED_SKGXPIA

-------- ---------- ---------- ---------------------------------------------

NAME_SKGXPIA    IP_SKGXPIA

--------------- ----------------

4572EC54          0          1 N          OSD

eth1            131.33.1.107

 

/* 可以看到当前数据库实例仍使用旧有的interconnect网络 */

 

[root@vrh1 ~]# crsctl stop crs

 

[root@vrh1 ~]# crsctl start crs

 

[oracle@vrh1 ~]$ sqlplus / as sysdba

 

Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - Production

With the Partitioning, Real ApplicationClusters, OLAP, Data Mining

and Real Application Testing options

 

SQL>

SQL> select * from x$skgxpia;

 

ADDR           INDX    INST_ID PUB_SKGXPI PICKED_SKGXPIA

-------- ---------- ---------- ---------------------------------------------

NAME_SKGXPIA    IP_SKGXPIA

--------------- ----------------

4572EC54          0          1 N          OSD

eth1            192.168.0.107

 

/* 这里需要重启CRS后实例才能正确使用更新后的clusterinterconnect网络接口 */

0 0
原创粉丝点击