`
tianshibaijia
  • 浏览: 1125782 次
文章分类
社区版块
存档分类
最新评论

RAC安装时需要执行4个脚本及意义

 
阅读更多

RAC安装时需要执行4个脚本

1)$ORACLE_BASE/oraInventory/orainstRoot.sh(clusterware结束时执行)

2)$CRS_HOME/root.sh(clusterware结束时执行)

3)$CRS_HOME/bin/vipca.sh(该脚本是在第二个节点执行$CRS_HOME/root.sh时被自动调用)

4)$ORACLE_HOME/root.sh(安装完数据库以后执行)

1.orainstRoot.sh脚本

1.1orainstRoot.sh脚本执行过程

root@node2#/oracle/oraInventory/orainstRoot.sh

Changingpermissionsof/oracle/oraInventoryto770.

Changinggroupnameof/oracle/oraInventorytooinstall.

Theexecutionofthescriptiscomplete

1.2orainstRoot.sh脚本内容

root@node1#more/oracle/oraInventory/orainstRoot.sh

#!/bin/sh

if[!-d"/var/opt/oracle"];then

mkdir-p/var/opt/oracle;

fi

if[-d"/var/opt/oracle"];then

chmod755/var/opt/oracle;

fi

if[-f"/oracle/oraInventory/oraInst.loc"];then

cp/oracle/oraInventory/oraInst.loc/var/opt/oracle/oraInst.loc;

chmod644/var/opt/oracle/oraInst.loc;

else

INVPTR=/var/opt/oracle/oraInst.loc

INVLOC=/oracle/oraInventory

GRP=oinstall

PTRDIR="`dirname$INVPTR`";

#Createthesoftwareinventorylocationpointerfile

if[!-d"$PTRDIR"];then

mkdir-p$PTRDIR;

fi

echo"CreatingtheOracleinventorypointerfile($INVPTR)";

echoinventory_loc=$INVLOC>$INVPTR

echoinst_group=$GRP>>$INVPTR

chmod644$INVPTR

#Createtheinventorydirectoryifitdoesn'texist

if[!-d"$INVLOC"];then

echo"CreatingtheOracleinventorydirectory($INVLOC)";

mkdir-p$INVLOC;

fi

fi

echo"Changingpermissionsof/oracle/oraInventoryto770.";

chmod-R770/oracle/oraInventory;

if[$?!=0];then

echo"OUI-35086:WARNING:chmodof/oracle/oraInventoryto770failed!";

fi

echo"Changinggroupnameof/oracle/oraInventorytooinstall.";

chgrpoinstall/oracle/oraInventory;

if[$?!=0];then

echo"OUI-10057:WARNING:chgrpof/oracle/oraInventorytooinstallfailed!";

fi

echo"Theexecutionofthescriptiscomplete"

从脚本我们可以看出,这个脚本主要是创建/var/opt/oracle目录(如果不存在的话),再在该目录下建oraInst.loc文件(该文件记录orainventory的位置和组)。并改变orainventory的属性。

root@node2#ls–rlt/var/opt/oracle/

total2

-rw-r--r--1rootroot55Apr214:42oraInst.loc

root@node2#moreoraInst.loc

inventory_loc=/oracle/oraInventory

inst_group=oinstall

在另一个节点上运行该脚本

root@node1#/oracle/oraInventory/orainstRoot.sh

Changingpermissionsof/oracle/oraInventoryto770.

Changinggroupnameof/oracle/oraInventorytooinstall.

Theexecutionofthescriptiscomplete

2.Root.sh脚本

2.1root.sh脚本执行过程

root@node2#/oracle/crs/root.sh

WARNING:directory'/oracle'isnotownedbyroot

CheckingtoseeifOracleCRSstackisalreadyconfigured

Checkingtoseeifany9iGSDisup

SettingthepermissionsonOCRbackupdirectory

SettingupNSdirectories

OracleClusterRegistryconfigurationupgradedsuccessfully

WARNING:directory'/oracle'isnotownedbyroot

SuccessfullyaccumulatednecessaryOCRkeys.

Usingports:CSS=49895CRS=49896EVMC=49898andEVMR=49897.

node<nodenumber>:<nodename><privateinterconnectname><hostname>

node0:node2node2-privnode2

node1:node1node1-privnode1

CreatingOCRkeysforuser'root',privgrp'root'..

Operationsuccessful.

Nowformattingvotingdevice:/oracle/ocrcfg1

Formatof1votingdevicescomplete.

Startupwillbequeuedtoinitwithin30seconds.

Addingdaemonstoinittab

ExpectingtheCRSdaemonstobeupwithin600seconds.

CSSisactiveonthesenodes.

node2

CSSisinactiveonthesenodes.

node1

Localnodecheckingcomplete.

Runroot.shonremainingnodestostartCRSdaemons.

从输出我们可以看出,该脚本主要执行crs的配置,格式化ocrdisk,更新/etc/inittab文件,启动css进程,在/var/opt/oracle/新建了ocr.loc文件及,scls_scroprocd文件夹。

2.2查看crs进程及/etc/inittab文件可以看出节点的变化。

root@node2#ps-ef|grepcrs|grep–vgrep

oracle1821218211014:47:28?0:00/oracle/crs/bin/ocssd.bin

oracle1819118180014:47:28?0:00/oracle/crs/bin/oclsmon.bin

oracle178861014:47:27?0:00/oracle/crs/bin/evmd.bin

oracle1818018092014:47:28?0:00/bin/sh-ccd/oracle/crs/log/node2/cssd/oclsmon;ulimit-cunlimited;/ora

root178891014:47:27?0:00/oracle/crs/bin/crsd.binreboot

oracle1821118093014:47:28?0:00/bin/sh-culimit-cunlimited;cd/oracle/crs/log/node2/cssd;/oracle/crs

root@node2#ls–rlt/var/opt/oracle/

total8

-rw-r--r--1rootroot55Apr214:42oraInst.loc

drwxrwxr-x5rootroot512Apr214:47oprocd

drwxr-xr-x3rootroot512Apr214:47scls_scr

-rw-r--r--1rootoinstall48Apr214:47ocr.loc

注意:新创建了ocr.locscls_scroprocd,但没有创建/var/opt/oracle/oratab

root@node1#moreinittab

#Copyright2004SunMicrosystems,Inc.Allrightsreserved.

#Useissubjecttolicenseterms.

#

#The/etc/inittabfilecontrolstheconfigurationofinit(1M);formore

#informationrefertoinit(1M)andinittab(4).Itisnolonger

#necessarytoeditinittab(4)directly;administratorsshouldusethe

#SolarisServiceManagementFacility(SMF)todefineservicesinstead.

#Refertosmf(5)andtheSystemAdministrationGuideformore

#informationonSMF.

#

#Formodifyingparameterspassedtottymon,usesvccfg(1m)tomodify

#theSMFrepository.Forexample:

#

##svccfg

#svc:>selectsystem/console-login

#svc:/system/console-login>setpropttymon/terminal_type="xterm"

#svc:/system/console-login>exit

#

#ident"@(#)inittab1.4104/12/14SMI"

ap::sysinit:/sbin/autopush-f/etc/iu.ap

sp::sysinit:/sbin/soconfig-f/etc/sock2path

smf::sysinit:/lib/svc/bin/svc.startd>/dev/msglog2<>/dev/msglog</dev/console

p3:s1234:powerfail:/usr/sbin/shutdown-y-i5-g0>/dev/msglog2<>/dev/msglog

h1:3:respawn:/etc/init.d/init.evmdrun>/dev/null2>&1</dev/null

h2:3:respawn:/etc/init.d/init.cssdfatal>/dev/null2>&1</dev/null

h3:3:respawn:/etc/init.d/init.crsdrun>/dev/null2>&1</dev/null

root@node1#ls-rlt/etc/inittab*

-rw-r--r--1rootroot1072Nov212:39inittab.cssd

-rw-r--r--1rootroot1206Mar2117:15inittab.pre10203

-rw-r--r--1rootroot1006Mar2117:15inittab.nocrs10203

-rw-r--r--1rootroot1040Apr214:50inittab.orig

-rw-r--r--1rootroot1040Apr214:50inittab.no_crs

-rw-r--r--1rootroot1240Apr214:50inittab

-rw-r--r--1rootroot1240Apr214:50inittab.crs

该脚本会将inittab复制为inittab.no_crs,修改后的inittab另复制一份为inittab.crs.

2.3在另外一个节点执行$CRS_HOME/root.sh

root@node1#/oracle/crs/root.sh

WARNING:directory'/oracle'isnotownedbyroot

CheckingtoseeifOracleCRSstackisalreadyconfigured

Checkingtoseeifany9iGSDisup

SettingthepermissionsonOCRbackupdirectory

SettingupNSdirectories

OracleClusterRegistryconfigurationupgradedsuccessfully

WARNING:directory'/oracle'isnotownedbyroot

clscfg:EXISTINGconfigurationversion3detected.

clscfg:version3is10GRelease2.

SuccessfullyaccumulatednecessaryOCRkeys.

Usingports:CSS=49895CRS=49896EVMC=49898andEVMR=49897.

node<nodenumber>:<nodename><privateinterconnectname><hostname>

node0:node2node2-privnode2

node1:node1node1-privnode1

clscfg:Argumentscheckoutsuccessfully.

NOKEYSWEREWRITTEN.Supply-forceparametertooverride.

-forceisdestructiveandwilldestroyanypreviousclusterconfiguration.

OracleClusterRegistryforclusterhasalreadybeeninitialized

Startupwillbequeuedtoinitwithin30seconds.

Addingdaemonstoinittab

ExpectingtheCRSdaemonstobeupwithin600seconds.

CSSisactiveonthesenodes.

node2

node1

CSSisactiveonallnodes.

WaitingfortheOracleCRSDandEVMDtostart

OracleCRSstackinstalledandrunningunderinit(1M)

Runningvipca(silent)forconfiguringnodeapps

CreatingVIPapplicationresourceon(2)nodes...

CreatingGSDapplicationresourceon(2)nodes...

CreatingONSapplicationresourceon(2)nodes...

StartingVIPapplicationresourceon(2)nodes...

StartingGSDapplicationresourceon(2)nodes...

StartingONSapplicationresourceon(2)nodes...

Done.

3.在第二个节点上运行时会多比在第一个节点上运行多执行一个任务

-------运行$CRS_HOME/bin/vipca.sh


VIPCA.sh主要是配置vip并启动crs的默认资源(未建库时默认为6个),多启动三个后台进程。

root@node1#ps-ef|grepcrs|grep-vgrep

oracle1834717447014:51:06?0:00/oracle/crs/bin/evmlogger.bin-o/oracle/crs/evm/log/evmlogger.info-l/oracle/

oracle174471014:50:47?0:00/oracle/crs/bin/evmd.bin

oracle1776317756014:50:48?0:00/oracle/crs/bin/ocssd.bin

oracle1775617643014:50:48?0:00/bin/sh-culimit-cunlimited;cd/oracle/crs/log/node1/cssd;/oracle/crs

oracle212161014:52:28?0:00/oracle/crs/opmn/bin/ons-d

oracle2121721216014:52:28?0:00/oracle/crs/opmn/bin/ons-d

oracle1777117642014:50:48?0:00/bin/sh-ccd/oracle/crs/log/node1/cssd/oclsmon;ulimit-cunlimited;/ora

oracle1777317771014:50:48?0:00/oracle/crs/bin/oclsmon.bin

root174491014:50:47?0:01/oracle/crs/bin/crsd.binreboot

root@node2#ps-ef|grepcrs|grep-vgrep

oracle1821218211014:47:28?0:00/oracle/crs/bin/ocssd.bin

oracle2746727466014:52:25?0:00/oracle/crs/opmn/bin/ons-d

oracle2525217886014:51:16?0:00/oracle/crs/bin/evmlogger.bin-o/oracle/crs/evm/log/evmlogger.info-l/oracle/

oracle274661014:52:25?0:00/oracle/crs/opmn/bin/ons-d

oracle1819118180014:47:28?0:00/oracle/crs/bin/oclsmon.bin

oracle178861014:47:27?0:00/oracle/crs/bin/evmd.bin

oracle1818018092014:47:28?0:00/bin/sh-ccd/oracle/crs/log/node2/cssd/oclsmon;ulimit-cunlimited;/ora

root178891014:47:27?0:00/oracle/crs/bin/crsd.binreboot

oracle1821118093014:47:28?0:00/bin/sh-culimit-cunlimited;cd/oracle/crs/log/node2/cssd;/oracle/crs

从现在node2上的进程就能看出,执行完vipca.sh后,会多出三个后台进程。

root@node1#crs_stat-t

NameTypeTargetStateHost

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

ora....c03.gsdapplicationONLINEONLINEnode1

ora....c03.onsapplicationONLINEONLINEnode1

ora....c03.vipapplicationONLINEONLINEnode1

ora....c04.gsdapplicationONLINEONLINEnode2

ora....c04.onsapplicationONLINEONLINEnode2

ora....c04.vipapplicationONLINEONLINEnode1

4.安装数据库软件(binary)时需在最后一步:执行$ORACLE_HOME/root.sh

root@node2#$ORACLE_HOME/root.sh

RunningOracle10root.shscript...

Thefollowingenvironmentvariablesaresetas:

ORACLE_OWNER=oracle

ORACLE_HOME=/oracle/10g

Enterthefullpathnameofthelocalbindirectory:[/usr/local/bin]:

Thefile"dbhome"alreadyexistsin/usr/local/bin.Overwriteit?(y/n)[n]:y

Copyingdbhometo/usr/local/bin...

Thefile"oraenv"alreadyexistsin/usr/local/bin.Overwriteit?(y/n)[n]:y

Copyingoraenvto/usr/local/bin...

Thefile"coraenv"alreadyexistsin/usr/local/bin.Overwriteit?(y/n)[n]:y

Copyingcoraenvto/usr/local/bin...

Creating/var/opt/oracle/oratabfile...

Entrieswillbeaddedtothe/var/opt/oracle/oratabfileasneededby

DatabaseConfigurationAssistantwhenadatabaseiscreated

Finishedrunninggenericpartofroot.shscript.

Nowproduct-specificrootactionswillbeperformed.

该脚本的作用在于在指定的目录(默认为/usr/local/bin)下创建dbhome,oraenv,coraenv,/var/opt/oracle/里创建oratab文件。

root@node2#ls–rlt/usr/local/bin

total18

-rwxr-xr-x1oracleroot2428Apr215:07dbhome

-rwxr-xr-x1oracleroot2560Apr215:07oraenv

-rwxr-xr-x1oracleroot2857Apr215:07coraenv

root@node2#ls–rlt/var/opt/oracle/

total10

-rw-r--r--1rootroot55Apr214:42oraInst.loc

drwxrwxr-x5rootroot512Apr214:47oprocd

drwxr-xr-x3rootroot512Apr214:47scls_scr

-rw-r--r--1rootoinstall48Apr214:47ocr.loc

-rw-rw-r--1oracleroot678Apr215:07oratab

root@node1#/oracle/10g/root.sh

RunningOracle10root.shscript...

Thefollowingenvironmentvariablesaresetas:

ORACLE_OWNER=oracle

ORACLE_HOME=/oracle/10g

Enterthefullpathnameofthelocalbindirectory:[/usr/local/bin]:

Thefile"dbhome"alreadyexistsin/usr/local/bin.Overwriteit?(y/n)[n]:y

Copyingdbhometo/usr/local/bin...

Thefile"oraenv"alreadyexistsin/usr/local/bin.Overwriteit?(y/n)[n]:y

Copyingoraenvto/usr/local/bin...

Thefile"coraenv"alreadyexistsin/usr/local/bin.Overwriteit?(y/n)[n]:y

Copyingcoraenvto/usr/local/bin...

Creating/var/opt/oracle/oratabfile...

Entrieswillbeaddedtothe/var/opt/oracle/oratabfileasneededby

DatabaseConfigurationAssistantwhenadatabaseiscreated

Finishedrunninggenericpartofroot.shscript.

Nowproduct-specificrootactionswillbeperformed.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics