Oracle集群维护1维护层次概述层次命令节点层olsnodes网络层oifcfg集群层Crsctlocrcheckocrdumporcconfig应用层Srvctlonsctlcrs_statcrs_stop2维护命令详解:2.1olsnodes:2.1.1用途:显示集群节点信息2.1.2参数说明:-n显示节点编号-p显示每个节点用于privateinterconnect的网络接口名称-I显示每个节点的VIP2.1.3示例:/opt/oracle/crs/bin/olsnodes–n–p–irac011rac01-privrac01-viprac022rac02-privrac02-vip2.2oifcfg2.2.1用途:用来定义和修改集群需要的网卡属性2.2.2参数说明:iflist显示网卡列表getif获取单个网卡信息setif配置单个网卡delif删除网卡2.2.3示例:oifcfgiflisteth1172.168.0.0eth0192.168.0.0oifcfggetifeth1172.168.0.0globalcluster_interconnecteth0192.168.0.0globalpublicoifcfggetif–typepublicoifcfggetif–typecluster_interconnect2.3crsctl2.3.1不带任何参数执行crsctl可查看该命令的全部参数:crsctlUsage:crsctlcheckcrs-checkstheviabilityoftheCRSstackcrsctlcheckcssd-checkstheviabilityofCSScrsctlcheckcrsd-checkstheviabilityofCRScrsctlcheckevmd-checkstheviabilityofEVMcrsctlsetcssparametervalue-setsaparameteroverridecrsctlgetcssparameter-getsthevalueofaCSSparametercrsctlunsetcssparameter-setsCSSparametertoitsdefaultcrsctlquerycssvotedisk-liststhevotingdisksusedbyCSScrsctladdcssvotediskpath-addsanewvotingdiskcrsctldeletecssvotediskpath-removesavotingdiskcrsctlenablecrs-enablesstartupforallCRSdaemonscrsctldisablecrs-disablesstartupforallCRSdaemonscrsctlstartcrs-startsallCRSdaemons.crsctlstopcrs-stopsallCRSdaemons.StopsCRSresourcesincaseofcluster.crsctlstartresources-startsCRSresources.crsctlstopresources-stopsCRSresources.crsctldebugstatedumpevm-dumpsstateinfoforevmobjectscrsctldebugstatedumpcrs-dumpsstateinfoforcrsobjectscrsctldebugstatedumpcss-dumpsstateinfoforcssobjectscrsctldebuglogcss[module:level]{,module:level}...-TurnsondebuggingforCSScrsctldebugtracecss-dumpsCSSin-memorytracingcachecrsctldebuglogcrs[module:level]{,module:level}...-TurnsondebuggingforCRScrsctldebugtracecrs-dumpsCRSin-memorytracingcachecrsctldebuglogevm[module:level]{,module:level}...-TurnsondebuggingforEVMcrsctldebugtraceevm-dumpsEVMin-memorytracingcachecrsctldebuglogresresname:levelturnsondebuggingforresourcescrsctlquerycrssoftwareversion[nodename]-liststheversionofCRSsoftwareinstalledcrsctlquerycrsactiveversion-liststheCRSsoftwareoperatingversioncrsctllsmodulescss-liststheCSSmodulesthatcanbeusedfordebuggingcrsctllsmodulescrs-liststheCRSmodulesthatcanbeusedfordebuggingcrsctllsmodulesevm-liststheEVMmodulesthatcanbeusedfordebugging2.3.2查看crs状态:crsctlcheckcrsCSSappearshealthyCRSappearshealthyEVMappearshealthyCrs_stat(条目形式):NAME=ora.rac01.ASM1.asmTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac01NAME=ora.rac01.LISTENER_RAC01.lsnrTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac01NAME=ora.rac01.gsdTYPE=applicationTARGET=ONLINESTATE=OFFLINENAME=ora.rac01.onsTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac01NAME=ora.rac01.vipTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac01NAME=ora.rac02.ASM2.asmTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02NAME=ora.rac02.LISTENER_RAC02.lsnrTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02NAME=ora.rac02.gsdTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02NAME=ora.rac02.onsTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02NAME=ora.rac02.vipTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02NAME=ora.racdb.dbTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02NAME=ora.racdb.racdb1.instTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac01NAME=ora.racdb.racdb2.instTYPE=applicationTARGET=ONLINESTATE=ONLINEonrac02Crs_stat–t(列表形式):ora....SM1.asmapplicationONLINEONLINErac01ora....01.lsnrapplicationONLINEONLINErac01ora.rac01.gsdapplicationONLINEOFFLINEora.rac01.onsapplicationONLINEONLINErac01ora.rac01.vipapplicationONLINEONLINErac01ora....SM2.asmapplicationONLINEONLINErac02ora....02.lsnrapplicationONLINEONLINErac02ora.rac02.gsdapplicationONLINEONLINErac02ora.rac02.onsapplicationONLINEONLINErac02ora.rac02.vipapplicationONLINEONLINErac02ora.racdb.dbapplicationONLINEONLINErac02ora....b1.instapplicationONLINEOFFLINEora....b2.instapplicationONLINEONLINErac02如果crs已经关闭或异常,系统将出现如下提示:Failure1contactingCSSdaemonCannotcommunicatewithCRSCannotcommunicatewithEVM2.3.3启动crsCrsctlstartcrs(需要root权限)2.3.4关闭crsCrsctlstopcrs(需要root权限)2.3.5配置crs随着系统启动而自动启动Crsctlenablecrs(需要root权限)Crsctldisablecrs(需要root权限)验证修改结果,可以查看:Cat/etc/oracle/scls_scr/rac01/root/crsstart该文件中只有一句话:enable或disable2.3.5验证crs进程是否存在:Ps–ef|grepd.bin当crs状态正常时,应该能够看到如下三个进程:root36641219:37?00:00:08/opt/oracle/crs/bin/crsd.binrebootoracle40463661019:38?00:00:01/opt/oracle/crs/bin/evmd.binoracle41964164119:38?00:00:02/opt/oracle/crs/bin/ocssd.bin说明:在集群环境中,如果需要关闭主机,需要首先关闭crs.在适用crs_stat命令,能够显示信息,无论是online或者是offline,都说明CRS进程都在服务。此时需要在确认相关资源offline后,执行crsctlstopcrs关闭CRS.并且在执行Ps–ef|grepd.bin没有CRS进程后,在执行主机的关闭,重启2.4srvctl集群维护中,最常用,最重要的命令使用srvctl–h查看该命令的帮助2.4.1参数说明:2.4.1.1-d数据库名称(racdb)-n节点名称(rac01)-i实例名称(racdb1)2.4.2常用命令组合:2.4.2.1srvctlconfig2.4.2.2srvctlstart2.4.2.3srvctlstop2.4.2.4srvctlstatus2.4.3使用srvctl关闭数据库Srvctlstopdatabase–dracdb关闭集群数据库,各节点的实例将同时关闭2.4.4使用srvctl关闭一个节点的实例srvctlstopinstance-dracdb-iracdb12.4.5使用srvctl启动一个节点的实例Srvctlstartinstance–dracdb–iracdb12.4.5使用srvctl关闭节点nodeappsNodeapps包括GSDONSVIPLISTENRASMSrvctlstopnodeapps–nrac012.4.6使用srvctl启动节点nodeappsSrvctlstartn