RAC root.sh

读书笔记:(这篇文章太长了,还是建议读者复制到自己word文档里面去看,root.sh这个脚本很重要,是在安装RAC的时候的核心。)

 

root.sh脚本

root.sh脚本可以说是安装集群管理软件过程当中最重要的,同时也是最容易出问题的,这个脚本要完成对集群的初始化和很多配置任务。

 

1.root.sh脚本

root.sh脚本:(root.sh脚本位置/u01/app/11.2.0/grid/root.sh)

[root@RAC1 ~]# cat /u01/app/11.2.0/grid/root.sh

#!/bin/sh

. /u01/app/11.2.0/grid/install/utl/rootmacro.sh "$@"

. /u01/app/11.2.0/grid/install/utl/rootinstall.sh

#

# Root Actions related to network

#

/u01/app/11.2.0/grid/network/install/sqlnet/setowner.sh

#

# Invoke standalone rootadd_rdbms.sh

#

/u01/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh

/u01/app/11.2.0/grid/rdbms/install/rootadd_filemap.sh

/u01/app/11.2.0/grid/crs/config/rootconfig.sh

EXITCODE=$?

if [ $EXITCODE -ne 0 ]; then

exit $EXITCODE

fi

 

下面是对上面标绿色的脚本作用的解释:

1. /u01/app/11.2.0/grid/install/utl/rootmacro.sh "$@"

负责一些和gi_home相关的验证工作

2. /u01/app/11.2.0/grid/install/utl/rootinstall.sh

负责创建一些本地文件

3./u01/app/11.2.0/grid/network/install/sqlnet/setowner.sh

负责创建GI相关的文件

4./u01/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh

负责验证文件的一些权限

5./u01/app/11.2.0/grid/rdbms/install/rootadd_filemap.sh

负责验证文件的一些权限

 

2.root.sh详细信息

root.sh脚本核心部分是/u01/app/11.2.0/grid/crs/config/rootconfig.sh脚本,这个脚本是通过调用<gi_home>/crs/install/rootcrs.pl脚本来初始化和配置集群,以下是rootconfig.sh脚本部分片段。

SU=/bin/su

SW_ONLY=false

ADDNODE=false

GI_WIZARD=false

HA_CONFIG=false

RAC9I_PRESENT=false

CMDLLROOTSH_CMD=$ORACLE_HOME/crs/install/cmdllroot.sh

CONFIGSH_CMD="$ORACLE_HOME/crs/config/config.sh"

ROOTHASPL="$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl"

ROOTCRSPL="$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/rootcrs.pl"

 

可以看到,完成初始化和配置集群工作的是root.pl脚本。接下来,通过该脚本的一个日志文件来了解一下脚本做了什么。rootcrs.pl脚本的日志文件是<gi_home>/cfgtoollogs/rootcrs/<节点名>.log。

[grid@RAC1 crsconfig]$ pwd

/u01/app/11.2.0/grid/cfgtoollogs/crsconfig

[grid@RAC1 crsconfig]$ more  rootcrs_rac1.log

 

(1)集群配置信息读取

--在配置集群之前,root.sh开始读取集群初始化配置参数文件/u01/app/11.2.0/grid/crs/install/crsconfig_params

2018-07-20 13:01:15: The configuration parameter file /u01/app/11.2.0/grid/crs/install/crsconfig_params is valid

2018-07-20 13:01:15: ### Printing the configuration values from files:

2018-07-20 13:01:15:    /u01/app/11.2.0/grid/crs/install/crsconfig_params

2018-07-20 13:01:15:    /u01/app/11.2.0/grid/crs/install/s_crsconfig_defs

2018-07-20 13:01:15: ASM_AU_SIZE=1

2018-07-20 13:01:15: ASM_DISCOVERY_STRING=

2018-07-20 13:01:15: ASM_DISKS=/dev/raw/raw4

2018-07-20 13:01:15: ASM_DISK_GROUP=VOTE

2018-07-20 13:01:15: ASM_REDUNDANCY=EXTERNAL

2018-07-20 13:01:15: ASM_SPFILE=

2018-07-20 13:01:15: ASM_UPGRADE=false

2018-07-20 13:01:15: CLSCFG_MISSCOUNT=

2018-07-20 13:01:15: CLUSTER_GUID=

2018-07-20 13:01:15: CLUSTER_NAME=rac-cluster

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

2018-07-20 13:01:15: CRS_NODEVIPS='rac1-vip/255.255.255.0/eth0,rac2-vip/255.255.255.0/eth0'  --集群节点VIP信息。

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

2018-07-20 13:01:15: HOST_NAME_LIST=rac1,rac2 --集群节点列表的信息

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

2018-07-20 13:01:15: MSGFILE=/var/adm/messages --更多集群网络配置信息

2018-07-20 13:01:15: NETWORKS="eth0"/192.168.56.0:public,"eth1"/10.10.10.0:cluster_interconnect

2018-07-20 13:01:15: NEW_HOST_NAME_LIST=

2018-07-20 13:01:15: NEW_NODEVIPS='rac1-vip/255.255.255.0/eth0,rac2-vip/255.255.255.0/eth0'

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

2018-07-20 13:01:15: TZ=Asia/Chungking --集群的时区信息,从11G R2开始GI开始拥有自己的时区。

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

2018-07-20 13:01:15: user_is_superuser=1 --集群配置信息读取完

2018-07-20 13:01:15: ### Printing of configuration values complete ###

2018-07-20 13:01:15: writing /u01/app/11.2.0:grid:oinstall:0755 to /u01/app/11.2

.0/grid/crs/install/ParentDirPerm_rac1.txt

2018-07-20 13:01:15: writing /u01/app:grid:oinstall:0755 to /u01/app/11.2.0/grid

/crs/install/ParentDirPerm_rac1.txt

2018-07-20 13:01:15: writing /u01:root:root:0755 to /u01/app/11.2.0/grid/crs/ins

tall/ParentDirPerm_rac1.txt

2018-07-20 13:01:15: Installing Trace File Analyzer

>End Command output

2018-07-20 13:02:22: Performing few checks before running scripts

2018-07-20 13:02:22: Attempt to get current working directory

2018-07-20 13:02:22: Running as user grid: pwd

2018-07-20 13:02:22: s_run_as_user2: Running /bin/su grid -c ' pwd '

2018-07-20 13:02:22: Removing file /tmp/fileLq2oZN

2018-07-20 13:02:22: Successfully removed file: /tmp/fileLq2oZN

2018-07-20 13:02:22: /bin/su successfully executed

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

2018-07-20 13:02:22: Pre-checkes for running scripts passed--集群配置前检查完成

 

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

2018-07-20 13:02:24: Succeeded in writing the checkpoint:'ROOTCRS_STACK' with st

atus:START --root.sh的检查点(checkpoint)被更新

从11.2.0.2版本开始,root.sh会在运行的时候产生一个检查点(chheck point),在每一个执行的阶段的操作过程中,root.sh都会把对应阶段的操作状态记录到检查点文件中,以便下一次运行root.sh时候能够清楚的的了解上一次运行所处的阶段,以及对应阶段的状态,从而决定从哪重新开始。这也是为什么oracle从11.2.0.2版本开始宣传,root.sh脚本可以重复运行的原因。这意味着用户再也不需要像之前版本那样,当root.sh脚本运行失败后需要将之前配置彻底删除,才能重新运行root.sh,极大节省GI部署时间。

 

2018-07-20 13:02:24: CkptFile: /u01/app/grid/Clusterware/ckptGridHA_rac1.xml

2018-07-20 13:02:24: Sync the checkpoint file '/u01/app/grid/Clusterware/ckptGri

dHA_rac1.xml'

2018-07-20 13:02:24: Sync '/u01/app/grid/Clusterware/ckptGridHA_rac1.xml' to the

 physical disk

2018-07-20 13:02:24: Running as user grid: /u01/app/11.2.0/grid/bin/cluutil -ckp

t -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_STACK -pname VERSION -pvalu

e 11.2.0.4.0

2018-07-20 13:02:24: s_run_as_user2: Running /bin/su grid -c ' /u01/app/11.2.0/g

rid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_STACK -

pname VERSION -pvalue 11.2.0.4.0 '

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

 

 

 

2018-07-20 13:02:39: checkpoint ROOTCRS_OLR does not exist

2018-07-20 13:02:39: Initializing OLR now..

2018-07-20 13:02:39: Running as user grid: /u01/app/11.2.0/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_OLR -state START

2018-07-20 13:02:39: s_run_as_user2: Running /bin/su grid -c ' /u01/app/11.2.0/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_OLR -state START '

2018-07-20 13:02:40: Removing file /tmp/fileRvcUAF

2018-07-20 13:02:40: Successfully removed file: /tmp/fileRvcUAF

2018-07-20 13:02:40: /bin/su successfully executed

 

2018-07-20 13:02:40: Succeeded in writing the checkpoint:'ROOTCRS_OLR' with status:START--OLR被创建成功,同时对应的检查点文件被更新。

 

 

 

2018-07-20 13:02:45: Creating local GPnP setup for clustered node...

2018-07-20 13:02:45: Oracle CRS home = /u01/app/11.2.0/grid

2018-07-20 13:02:45: Oracle GPnP wallets home = /u01/app/11.2.0/grid/gpnp/rac1/wallets

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

2018-07-20 13:04:14: GPnP Wallets ownership/permissions successfully set.

2018-07-20 13:04:14: GPnP Wallets successfully created.

2018-07-20 13:04:14: <--- GPnP wallets successfully created

2018-07-20 13:04:14: Creating GPnP peer profile --->

............................................................................................................................................................2018-07-20 13:04:15: GPnP peer profile create successfully completed.

2018-07-20 13:04:15: <--- GPnP peer profile successfully created

2018-07-20 13:04:15: GPnP local setup successfully created

.............................................................................................................................................................2018-07-20 13:04:16: Succeeded in writing the checkpoint:'ROOTCRS_GPNPSETUP' with status:SUCCESS--gpnp wallet和profille被成功创建。

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

2018-07-20 13:04:17: checkpoint ROOTCRS_OHASD does not exist

2018-07-20 13:04:17: Running as user grid: /u01/app/11.2.0/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_OHASD -state START

2018-07-20 13:04:17: s_run_as_user2: Running /bin/su grid -c ' /u01/app/11.2.0/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_OHASD -state START '

2018-07-20 13:04:18: Removing file /tmp/file4rormJ

2018-07-20 13:04:18: Successfully removed file: /tmp/file4rormJ

2018-07-20 13:04:18: /bin/su successfully executed

2018-07-20 13:04:18: Succeeded in writing the checkpoint:'ROOTCRS_OHASD' with status:START--集群启动脚本

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

2018-07-20 13:04:19: 'ohasd' is now registered

2018-07-20 13:04:19: Starting ohasd

2018-07-20 13:04:19: Checking the status of ohasd

2018-07-20 13:04:19: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl check has

2018-07-20 13:04:19: Checking the status of ohasd

2018-07-20 13:04:24: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl check has

2018-07-20 13:04:24: Checking the status of ohasd

2018-07-20 13:04:29: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl check has

2018-07-20 13:04:30: Checking the status of ohasd

2018-07-20 13:04:35: ohasd is not already running.. will start it now

2018-07-20 13:04:35: Executing cmd: /bin/rpm -qf /sbin/init

2018-07-20 13:04:35: Command output:

2018-07-20 13:04:40: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl start has

2018-07-20 13:04:55: Command output:

>  CRS-4123: Oracle High Availability Services has been started. --ohasd被启动,准备开始配置集群

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

.2018-07-20 13:05:05: Executing /u01/app/11.2.0/grid/bin/crsctl add resource ora.mdnsd -attr "ACL='owner:grid:rw-,pgrp:oinstall:rw-,other::r--,user:grid:rwx'" -type ora.mdns.type -

init

2018-07-20 13:05:05: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add resource ora.mdnsd -attr "ACL='owner:grid:rw-,pgrp:oinstall:rw-,other::r--,user:grid:rwx'" -type ora.mdns.t

ype -init

2018-07-20 13:05:05: Executing /u01/app/11.2.0/grid/bin/crsctl add resource ora.gpnpd -attr "ACL='owner:grid:rw-,pgrp:oinstall:rw-,other::r--,user:grid:rwx',START_DEPENDENCIES='we

ak(ora.mdnsd)'" -type ora.gpnp.type -init

2018-07-20 13:05:05: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add resource ora.gpnpd -attr "ACL='owner:grid:rw-,pgrp:oinstall:rw-,other::r--,user:grid:rwx',START_DEPENDENCIE

S='weak(ora.mdnsd)'" -type ora.gpnp.type -init

2018-07-20 13:05:05: Executing /u01/app/11.2.0/grid/bin/crsctl add resource ora.gipcd -attr "ACL='owner:grid:rw-,pgrp:oinstall:rw-,other::r--,user:grid:rwx',START_DEPENDENCIES='ha

rd(ora.gpnpd)',STOP_DEPENDENCIES=hard(intermediate:ora.gpnpd)" -type ora.gipc.type -init

2018-07-20 13:05:05: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add resource ora.gipcd -attr "ACL='owner:grid:rw-,pgrp:oinstall:rw-,other::r--,user:grid:rwx',START_DEPENDENCIE

S='hard(ora.gpnpd)',STOP_DEPENDENCIES=hard(intermediate:ora.gpnpd)" -type ora.gipc.type -init--集群的初始化资源被加入到OLR中

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

2018-07-20 13:09:04: Starting CSS in exclusive mode

2018-07-20 13:09:04: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl start resource ora.cssd -init -env CSSD_MODE=-X --css以exclusive模式被启动(Oracle GI的启动模式有两种,即集群模式,这是正常模式和exclusive模式,这个是维护模式。如果集群某个节点以exclusive模式启动,则意味着整个集群中只有这个节点能够运行,其他节点必须保持关闭模式。Oracle设计这种模式的主要原因是:某些特定的操作只能在这种模式下运行,例如格式化表决磁盘(VF),这种模式很少被使用)。

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

2018-07-20 13:09:26: Command output:

>  CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'

>  CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded

>  CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'

>  CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded

>  CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'

>  CRS-2672: Attempting to start 'ora.gipcd' on 'rac1'

>  CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded

>  CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded

>  CRS-2672: Attempting to start 'ora.cssd' on 'rac1'

>  CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'

>  CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded--集群资源被启动

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

2018-07-20 13:09:29: Executing as grid: /u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName VOTE -diskList '/dev/raw/raw4' -redundancy EXTERNAL -configureLocalASM -au_size 1

2018-07-20 13:09:29: Running as user grid: /u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName VOTE -diskList '/dev/raw/raw4' -redundancy EXTERNAL -configureLocalASM -au_size 1

2018-07-20 13:09:29:   Invoking "/u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName VOTE -diskList '/dev/raw/raw4' -redundancy EXTERNAL -configureLocalASM -au_size 1" as user "

grid"

2018-07-20 13:09:29: Executing /bin/su grid -c "/u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName VOTE -diskList '/dev/raw/raw4' -redundancy EXTERNAL -configureLocalASM -au_si

ze 1"

2018-07-20 13:09:29: Executing cmd: /bin/su grid -c "/u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName VOTE -diskList '/dev/raw/raw4' -redundancy EXTERNAL -configureLocalASM -

au_size 1"

2018-07-20 13:10:31: Command output:

>  

>  ASM created and started successfully.

>  

>  Disk Group VOTE created successfully.--ASM实例被启动,而且用于保存OCR和VF磁盘组被创建,之后OCR被初始化成功。

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

2018-07-20 13:10:44: Creating voting files

2018-07-20 13:10:44: Creating voting files in ASM diskgroup VOTE

2018-07-20 13:10:44: Executing crsctl replace votedisk '+VOTE'

2018-07-20 13:10:44: Executing /u01/app/11.2.0/grid/bin/crsctl replace votedisk '+VOTE'

2018-07-20 13:10:44: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl replace votedisk '+VOTE'

2018-07-20 13:10:46: Command output:

>  CRS-4256: Updating the profile

>  Successful addition of voting disk 01caad9458c84f02bf723b72b443c473.

>  Successfully replaced voting disk group with +VOTE.

>  CRS-4256: Updating the profile

>  CRS-4266: Voting file(s) successfully replaced

>End Command output

2018-07-20 13:10:46: Executing /u01/app/11.2.0/grid/bin/crsctl query css votedisk

2018-07-20 13:10:46: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl query css votedisk

2018-07-20 13:10:46: Command output:

>  ##  STATE    File Universal Id                File Name Disk group

>  --  -----    -----------------                --------- ---------

>   1. ONLINE   01caad9458c84f02bf723b72b443c473 (/dev/raw/raw4) [VOTE]

>  Located 1 voting disk(s). --表决盘被创建成功。

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

2018-07-20 13:10:53: Stopping CSS which is running exclusive mode

2018-07-20 13:10:53: Exiting exclusive mode--集群退出exclusive模式

.............................................................................................................................................................2018-07-20 13:11:28: Starting --集群重新以正常模式启动

2018-07-20 13:11:28: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl start resource ora.mdnsd -init

2018-07-20 13:11:30: Command output:

>  CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'

>  CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded

>End Command output

2018-07-20 13:11:30: Start of resource "ora.mdnsd" Succeeded

2018-07-20 13:11:30: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl start resource ora.gpnpd -init

2018-07-20 13:11:31: Command output:

>  CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'

>  CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded

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

2018-07-20 13:13:26: Invoking "/u01/app/11.2.0/grid/bin/srvctl add nodeapps -n rac1 -A "rac1-vip/255.255.255.0/eth0" "

2018-07-20 13:13:26: trace file=/u01/app/11.2.0/grid/cfgtoollogs/crsconfig/srvmcfg0.log

2018-07-20 13:13:26: Executing /u01/app/11.2.0/grid/bin/srvctl add nodeapps -n rac1 -A "rac1-vip/255.255.255.0/eth0"

2018-07-20 13:13:26: Executing cmd: /u01/app/11.2.0/grid/bin/srvctl add nodeapps -n rac1 -A "rac1-vip/255.255.255.0/eth0"

2018-07-20 13:13:44: add nodeapps -n rac1 -A rac1-vip/255.255.255.0/eth0 on node=rac1 ... passed

2018-07-20 13:13:44: nodes_to_start=rac1

2018-07-20 13:13:44: Configuring first node

2018-07-20 13:13:44: DHCP_flag=0

2018-07-20 13:13:44: nodes_to_start=rac1

2018-07-20 13:13:44: Running as user grid: /u01/app/11.2.0/grid/bin/oifcfg setif -global "eth0"/192.168.56.0:public "eth1"/10.10.10.0:cluster_interconnect

2018-07-20 13:13:44: s_run_as_user2: Running /bin/su grid -c ' /u01/app/11.2.0/grid/bin/oifcfg setif -global "eth0"/192.168.56.0:public "eth1"/10.10.10.0:cluster_interconnect '

2018-07-20 13:13:46: Removing file /tmp/file2wLczV

2018-07-20 13:13:46: Successfully removed file: /tmp/file2wLczV

2018-07-20 13:13:46: /bin/su successfully executed

...

2018-07-20 13:14:15: Succeeded in writing the checkpoint:'ROOTCRS_NODECONFIG' with status:SUCCESS--CRS层面的资源被添加到集群当中。

 

2018-07-20 13:25:15: Configure Oracle Grid Infrastructure for a Cluster ... succeeded--root.sh脚本完成相应的工作。

 

小结

根据之前的描述,可以看到root.sh会完成以下几个阶段工作。

阶段1:完成配置集群的一些杂项工作

阶段2:节点的初始化配置

阶段3:初始化OLR

阶段4:初始化gpnp wallet和gpnp profile

阶段5:配置init.ohasd脚本并启动ohasd

阶段6:向集群添加初始化资源

阶段7:将CSS启动到exclusive模式并且格式化VF。

阶段8:以正常模式启动集群

阶段9:向集群添加CRS相关资源

阶段10:重新启动集群

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值