好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

【ORACLERAC】root.sh原理,ocr管理

************************************************************************ ****原文: blog.csdn.net/clark_xu 徐长亮的专栏 ************************************************************************ Root.sh的原理 1. In root.sh script, it will ad

************************************************************************ ****原文: 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 ? 0 /bin/sh /etc/init.d/init.cssddaemon

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

OCR

1. 定义

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

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

/* 实际上 css 的 misscount 参数和 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 网段配置了 public 和 cluster_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 网络接口 */

查看更多关于【ORACLERAC】root.sh原理,ocr管理的详细内容...

  阅读:36次