




已阅读5页,还剩24页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
RAC日常维护手册一、OCR和Voting disk的管理Votingdisk(表决磁盘方面):Votingdisk记录节点成员信息,如包含哪些节点成员、节点的添加删除信息记录,大小为20MB查看votingdisk位置:crsctlquerycssvotedisk$crsctlquerycssvotedisk0.0/dev/rhdisk3如果CRS安装过程失败,需要重新安装则需要初始化votingdisk盘,可用DD或重建卷ddif=/dev/zeroof=/dev/rhdisk3bs=8192count=2560备份votedisk:ddif=/dev/rhdisk3of=/tmp/votedisk.bak恢复votedisk:ddif=/tmp/votedisk.bakof=/dev/rhdisk3添加votingdisk镜像盘:crsctladdcssvotedisk/dev/rhdisk7-forceVotedisk不像OCR,必须是一半以上可用,否则集群会宕掉,所以不应该只添加一块。在添加voting disk的时候必须停掉CRS删除votingdisk镜像盘crsctldeletecssvotedisk/dev/rhdisk7 -forceOCR方面OCR记录节点成员的配置信息,如database、ASM、instance、listener、VIP等CRS资源的配置信息,可存储于裸设备或者群集文件系统上,推荐设置大小为100MB如以RAW的方式,则划分一个RAW,例如:/dev/rhdisk2如果CRS安装过程失败,需要重新安装则需要初始化OCR盘(RAW方式),可用DD或重建卷ddif=/dev/zeroof=/dev/rhdisk2bs=8192count=12800Oracle每四个小时自动发起备份,并保存三个版本,但只存在一个节点上$ocrconfig-showbackuppoaisdb12008/04/1022:53:29/u01/app/oracle/product/10.2.0/crs/cdata/crspoaisdb12008/04/1018:53:28/u01/app/oracle/product/10.2.0/crs/cdata/crspoaisdb12008/04/1014:53:27/u01/app/oracle/product/10.2.0/crs/cdata/crspoaisdb12008/04/0906:53:20/u01/app/oracle/product/10.2.0/crs/cdata/crspoaisdb22008/04/0303:31:28/u01/app/oracle/product/10.2.0/crs/cdata/crs恢复OCR:ocrconfig-restore/u01/app/oracle/product/10.2.0/crs/cdata/crs/backup01.ocrOCR手动导出:ocrconfig-export/tmp/ocr_bakOCR手动导入:ocrconfig-import/tmp/ocr_bak添加OCR镜像盘一:1.用crsctlstopcrs停掉所有节点CRS服务2.创建用于镜像OCR的RAW设备,比如为:/dev/rhdisk63.用ocrconfigexport导出OCR的信息4.编辑/etc/oracle/ocr.loc文件,添加ocrmirrorconfig_loc行$catocr.lococrconfig_loc=/dev/rhdisk2ocrmirrorconfig_loc=/dev/rhdisk6local_only=FALSE5.用ocrconfigimport导入OCR的信息6.检查ocr设置信息$ocrcheckStatusofOracleClusterRegistryisasfollows:Version:2Totalspace(kbytes):103724Usedspace(kbytes):3824Availablespace(kbytes):99900ID:1086971606Device/FileName:/dev/rhdisk2Device/FileintegritychecksucceededDevice/FileName:/dev/rhdisk6Device/FileintegritychecksucceededClusterregistryintegritychecksucceeded7.最后用crsctlstartcrs启动CRS服务使用导出,导入进行备份和恢复Oracle推荐在对集群做调整时,比如增加,删除节点之前,应该对OCR做一个备份,可以使用export备份到指定文件,如果做了replace或者restore等操作,Oracle建议使用cluvfycompocr-nall命令来做一次全面的检查。该命令在clusterware的安装软件里。1)首先关闭所有节点的CRSrootraw1bin#./crsctlstopcrsStoppingresources.SuccessfullystoppedCRSresourcesStoppingCSSD.ShuttingdownCSSdaemon.Shutdownrequestsuccessfullyissued.2)用root用户导出OCR内容rootraw1bin#./ocrconfig-export/u01/ocr.exp3)重启CRSrootraw1bin#./crsctlstartcrsAttemptingtostartCRSstackTheCRSstackwillbestartedshortly4)检查CRS状态rootraw1bin#./crsctlcheckcrsCSSappearshealthyCRSappearshealthyEVMappearshealthy)破坏OCR内容rootraw1bin#ddif=/dev/zeroof=/dev/raw/raw1bs=1024count=102400102400+0recordsin102400+0recordsout6)检查OCR一致性rootraw1bin#./ocrcheckPROT-601:Failedtoinitializeocrcheck7)使用cluvfy工具检查一致性rootraw1cluvfy#./runcluvfy.shcompocr-nallVerifyingOCRintegrityUnabletoretrievenodelistfromOracleclusterware.Verificationcannotproceed.8)使用Import恢复OCR内容rootraw1bin#./ocrconfig-import/u01/ocr.exp9)再次检查OCRrootraw1bin#./ocrcheckStatusofOracleClusterRegistryisasfollows:Version:2Totalspace(kbytes):147352Usedspace(kbytes):4364Availablespace(kbytes):142988ID:610419116Device/FileName:/dev/raw/raw1Device/FileintegritychecksucceededDevice/FilenotconfiguredClusterregistryintegritychecksucceeded10)使用cluvfy工具检查rootraw1cluvfy#./runcluvfy.shcompocr-nallVerifyingOCRintegrityWARNING:Thesenodescannotbereached:raw2Verificationwillproceedwithnodes:raw1ERROR:Userequivalenceunavailableonallthenodes.Verificationcannotproceed.VerificationofOCRintegritywasunsuccessfulonallthenodes.注:此处不成功是因为我的机器卡,故raw2节点没有启动移动OCR文件位置实例演示将OCR从/dev/raw/raw1移动到/dev/raw/raw3上。1)查看是否有OCR备份rootraw1bin#./ocrconfig-showbackup如果没有备份,可以立即执行一次导出作为备份:rootraw1bin#./ocrconfig-export/u01/ocrbackup-sonline2)查看当前OCR配置rootraw1bin#./ocrcheckStatusofOracleClusterRegistryisasfollows:Version:2Totalspace(kbytes):147352Usedspace(kbytes):4364Availablespace(kbytes):142988ID:610419116Device/FileName:/dev/raw/raw1Device/FileintegritychecksucceededDevice/FilenotconfiguredClusterregistryintegritychecksucceeded输出显示当前只有一个PrimaryOCR,在/dev/raw/raw1。没有MirrorOCR。因为现在只有一个OCR文件,所以不能直接改变这个OCR的位置,必须先添加镜像后在修改,否则会报:Failedtoinitializeocrconfig.3)添加一个MirrorOCRrootraw1bin#./ocrconfig-replaceocrmirror/dev/raw/raw44)确认添加成功rootraw1bin#./ocrcheck5)改变primaryOCR位置rootraw1bin#./ocrconfig-replaceocr/dev/raw/raw3确认修改成功:rootraw1bin#./ocrcheck6)使用ocrconfig命令修改后,所有RAC节点上的/etc/oracle/ocr.loc文件内容也会自动同步了,如果没有自动同步,可以手工的改成以下内容。rootraw1bin#more/etc/oracle/ocr.lococrconfig_loc=/dev/raw/raw1Ocrmirrorconfig_loc=/dev/raw/raw3local_only=FALSE指定新的备份目录 ocrconfig -backuploc 新的目录二、常用命令1、$ORACLE_HOME/bin/localconfig add|delete 添加删除CSS服务不管你是RAC or non-RAC,如果使用了ASM,那么OCSSD 就是必须的,因为ASM中使用的Group Services (GS)是OCSSD提供的.执行$ORACLE_HOME/bin/localconfig add 就是安装ocssd执行$ORACLE_HOME/bin/localconfig delete 就是删除ocssd2、olsnodes集群是由哪些节点组成的# olsnodes -i -n -prac1 1 rac1-priv rac1-viprac2 2 rac2-priv rac2-vip查看OCR所在的位置:/etc/oracle/ocr.loc或者ocrcheck查看VoteDisk所在的位置:crsctl query css votediskoracleorac-b: srvctl status database -d racInstance rac1 is running on node orac-aInstance rac2 is running on node orac-boracleorac-b: srvctl stop instance -d rac -i rac1 -o abort3、oifcfg网络层由各个节点的网络组件组成,包括2个物理网卡和3个IP地址。网络层仅此命令。oifcfg命令用来定义和修改Oracle集群需要的网卡属性,这些属性包括网卡的网段地址,子网掩码,接口类型等。要想正确的使用这个命令,必须先知道Oracle是如何定义网络接口的,Oracle的每个网络接口包括名称,网段地址,接口类型3个属性。Oifcfg命令的格式如下:interface_name/subnet:interface_type这些属性中没有IP地址,但接口类型有两种,public和private,前者说明接口用于外部通信,用于OracleNet和VIP地址,而后者说明接口用于Interconnect。接口的配置方式分为两类:global和node-specific。前者说明集群所有节点的配置信息相同,也就是说所有节点的配置是对称的;而后者意味着这个节点的配置和其他节点配置不同,是非对称的。Iflist:显示网口列表Getif:获得单个网口信息Setif:配置单个网口Delif:删除网口rac2:/dev/raw # oifcfg -helpName: oifcfg - Oracle Interface Configuration Tool.Usage: oifcfg iflist -p -n oifcfg setif -node | -global /:. oifcfg getif -node | -global -if / -type oifcfg delif -node | -global / oifcfg -help - name of the host, as known to a communications network - name by which the interface is configured in the system - subnet address of the interface - type of the interface cluster_interconnect | public | storage 使用iflist显示网口列表rac1: # oifcfg iflisteth0 192.168.1.0eth1 192.168.2.0使用getif查看每个网卡的属性rac1: # oifcfg getifeth0 192.168.1.0 global publiceth1 192.168.2.0 global cluster_interconnect以上输出说明eth0网段地址是192.168.1.0,网卡类型是public,也就是用于Oracle NET和VIP。配置类型global说明所有节点的eth0网卡都属于192.168.1.0网段,并且都是public类型。rac1: # oifcfg getif -global rac1eth0 192.168.1.0 global publiceth1 192.168.2.0 global cluster_interconnectrac1: # oifcfg getif -node rac1删除网卡接口配置rootraw1bin#./oifcfgdelif-global添加接口配置#./oifcfgsetif-globaleth0/192.168.1.119:public#./oifcfgsetif-globaleth1/10.85.10.119:cluster_interconnect4、crsctlrac2:/ # crsctlUsage: crsctl check crs - checks the viability of the Oracle Clusterwarecrsctl check cssd - checks the viability of Cluster Synchronization Services crsctl check crsd - checks the viability of Cluster Ready Services crsctl check evmd - checks the viability of Event Manager crsctl check cluster -node - checks the viability of CSS across nodes crsctl set css - sets a parameter override crsctl get css - sets the value of a Cluster Synchronization Services parameter crsctl unset css - sets the Cluster Synchronization Services parameter to its default crsctl query css votedisk - lists the voting disks used by Cluster Synchronization Services crsctl add css votedisk - adds a new voting disk crsctl delete css votedisk - removes a voting disk crsctl enable crs - enables startup for all Oracle Clusterware daemons crsctl disable crs - disables startup for all Oracle Clusterware daemons crsctl start crs -wait - starts all Oracle Clusterware daemons crsctl stop crs -wait - stops all Oracle Clusterware daemons. Stops Oracle Clusterware managed resources in case of cluster. crsctl start resources - starts Oracle Clusterware managed resources crsctl stop resources - stops Oracle Clusterware managed resources是否开机启动crs crsctl enable/disable crs检查crs栈状态 crsctl check crsCrsctl check crsdCrsctl check cssdCrsctl check evmd启动停止crs crsctl start |stop crs或者/etc/init.d/init.crs start|stop查看votedisk位置 crsctl query css votediskrac2:/ # crsctl query css votedisk 0. 0 /dev/raw/raw2Located 1 voting disk(s).查看和修改crs参数:Crsctl get css miscountCrsctl set css miscount 1005、crs_statrac2:/ # crs_stat -lsName Owner Primary PrivGrp Permission -ora._FAQ.cs oracle oinstall rwxrwxr-ora.db1.srv oracle oinstall rwxrwxr-ora.db2.srv oracle oinstall rwxrwxr-ora.oradb.db oracle oinstall rwxrwxr-ora.b1.inst oracle oinstall rwxrwxr-ora.b2.inst oracle oinstall rwxrwxr-ora.SM1.asm oracle oinstall rwxrwxr-ora.C1.lsnr oracle oinstall rwxrwxr-ora.rac1.gsd oracle oinstall rwxr-xr-ora.rac1.ons oracle oinstall rwxr-xr-ora.rac1.vip root oinstall rwxr-xr-ora.SM2.asm oracle oinstall rwxrwxr-ora.C2.lsnr oracle oinstall rwxrwxr-ora.rac2.gsd oracle oinstall rwxr-xr-ora.rac2.ons oracle oinstall rwxr-xr-ora.rac2.vip root oinstall rwxr-xrcrs_stat tcrs_stat ora.rac1.vip6、onsctl7、srvctl启动停止数据库或者实例Srvctl start|stop database -d oradb -o open|mount|nomountSrvctl start|stop instance -d oradb -i oradb1 -o open|mount|nomountSrvctl status database -d oradbInstance oradb2 is not running on node rac2Instance oradb1 is not running on node rac1启动停止serviceSrvctl start|stop service -d oradb -s SS_FAQ -i oradb1Srvctl status service -d oradb -s SS_FAQ# srvctl status service -d oradb -s SS_FAQService SS_FAQ is running on instance(s) oradb1, oradb2启动停止ASMSrvctl start|stop asm -n rac1 -I oradb1srvctl status asm -n rac1启动停止监听Srvctl start|stop listener -n rac1 -l listener_nameSrvctl status listener -n rac1启动停止nodeappsSrvctl start|stop|status nodeapps -n rac1# srvctl stop nodeapps -n rac1此命令停掉ons listener VIP GSD以及该节点上的服务# srvctl status nodeapps -n rac1VIP is not running on node: rac1GSD is not running on node: rac1Listener is not running on node: rac1ONS daemon is not running on node: rac1开机是否启动数据库和实例Srvctl enable|disable database -d oradbSrvctl enable|disable instance -d oradb -i oradb1开机是否启动ASMSrvctl enable|disable asm -n rac1开机是否启动serviceSrvctl enable|disable service -d oradb -s SS_FAQ显示在OCR中注册的所有数据库Srvctl config database# srvctl config databaseoradb# srvctl config database -d oradbrac2 oradb2 /opt/oracle/product/11g/db_1rac1 oradb1 /opt/oracle/product/11g/db_1# srvctl config database -d oradb -arac2 oradb2 /opt/oracle/product/11g/db_1rac1 oradb1 /opt/oracle/product/11g/db_1DB_UNIQUE_NAME: oradbDB_NAME: oradbORACLE_HOME: /opt/oracle/product/11g/db_1SPFILE: +DG1/oradb/spfileoradb.oraDOMAIN: nullDB_ROLE: nullSTART_OPTIONS: nullPOLICY: AUTOMATICENABLE FLAG: DB ENABLED查看nodeapps的配置# srvctl config nodeapps -n rac1 -aVIP exists.: /rac1-vip/192.168.1.106/255.255.255.0/eth0# srvctl config nodeapps -n rac1 -gGSD exists.# srvctl config nodeapps -n rac1 -lListener exists.# srvctl config nodeapps -n rac1 -sONS daemon exists.查看listener的配置# srvctl config listener -n rac1rac1 LISTENER_RAC1# srvctl config listener -n rac2rac2 LISTENER_RAC2查看ASM# srvctl config asm -n rac1+ASM1 /opt/oracle/product/11g/db_1# srvctl config asm -n rac2+ASM2 /opt/oracle/product/11g/db_1查看service# srvctl config service -d oradbSS_FAQ PREF: oradb1 oradb2 AVAIL:添加删除对象Srvctl add database -d abc -o $ORACLE_HOMESrvctl add instance -d abc -n rac1 -i abc1Srvctl add instance -d abc -n rac1 -i abc1Srvctl add service -d abc -s SSFAQ -r abc1 -a abc2 -P basicSrvctl remove service -d abc -s SSFAQSrvctl remove instance -d abc -I abc1Srvctl remove database -d abc 删除数据库后,数据库对象不会被删除,只是删除了数据库在OCR中的定义,以后可通过ADD再次添加到OCR中三 RAC的失败切换和负载均衡LB1、配置RAC FailoverRAC Failover分为三种:客户端Connect time Failover, Transparent Application Failover, 服务器端Transparent Application Failover客户端connect_time_failover是通过tnsnames.ora文件中FAILOVER=ON实现的,即便是不设置,默认是打开的。在客户端tnsnames.ora中体现如下,如果一个连接不可用,则尝试另一个连接:ORADB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521) (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradb) ) )通过srvctl配置管理server_side FAQ:1) srvctl命令创建服务# srvctl add service -d oradb -s server_side_FAQ -r oradb2 -a oradb1 -P basic(注意:srvctl add service中,只有perferred才会创建服务。 即在OCR中注册一个ora.oradb.server_side_FAQ.oradb2.srv和ora.oradb.server_side_FAQ.cs服务。)2)查看FAQ服务# srvctl config service -d oradbserver_side_FAQ PREF: oradb2 AVAIL: oradb1# srvctl config service -d oradb -s server_side_FAQserver_side_FAQ PREF: oradb2 AVAIL: oradb1# srvctl config service -d oradb -s server_side_FAQ -aserver_side_FAQ PREF: oradb2 AVAIL: oradb1 TAF: basic(如果这里不指定-s service-name,就会显示所有Service的配置,这些配置包括preferred 和available instance. 使用-a 选项,还会显示TAF 相关信息。)3)是否自动运行service数据库启动时,会自动启动所有的Service。有时为了为了维护需要,需要禁用这个特性,在维护完成后再启动这个特性。# srvctl enable service -d oradb -s server_side_FAQ -i oradb24)启停FAQ服务srvctl start service -d oradb -s server_side_FAQ -i oradb2 srvctl stop service -d oradb -s server_side_FAQ -i oradb2 其中-f 选项可以强制关闭service,并中断了其所有用户的连接。5)使用srvctl 这个工具时,命令只更新OCR中的配置,不会更新data dctionary 和 listener 中的信息,因此还需要使用dbma_servie 包来更新data dictionary,手工更改listener配置文件。 Begin Dbms_service.modify_service( Service_name= server_side_FAQ , Failover_method=dbms_service.failover_method_basic, Failover_type=dbms_service.failover_type_select, Failover_retries=180, Failover_delay=5 );End;6)查看已经配置的FAQ并且做测试SQL show parameter service;NAME TYPE VALUE- - -service_names string oradb,server_side_FAQSQL select name,failover_method,failover_type,clb_goal from dba_services;NAME FAILOVER_M FAILOVER_T CLB_G- - - -SYS$BACKGROUND SHORTSYS$USERS SHORTseeddataXDB LONGseeddata LONGoradbXDB LONGoradb BASIC SELECT LONGserver_side_FAQ BASIC SELECT LONGSQLsqlplus lgto/lgtooradbSQL select failover_type,failover_method,failed_over from v$SESSION;FAILOVER_TYPE FAILOVER_M FAI- - -SELECT BASIC NO5)删除servicesrvctl stop service -d oradb -s server_side_FAQsrvctl disable service -d oradb -s server_side_FAQ清除数据字典里的内容begindbms_service.delete_service(service_name=SS_FAQ);end;SQLselect name,failover_method,failover_type,clb_goal from dba_services;2、配置RAC的Load BalanceLoad Balance分为connection Balance和service BalanceConnection Balance分为客户端LB和服务器端LB1、客户端的TNSNAMES.ORA中设置load_balanceyes(默认就是yes)ORADB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521) (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oradb) ) )2、服务器端:设置remote_listenerLISTENERS_ORADB,通过静态注册和动态注册相结合可以实现一个监听器监听多个例程。只有采用服务器端负载均衡的时候remote_li
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 企业财务预算编制及分析方法
- 个人购房贷款合同(标准版)
- 真空设备装配调试工中秋节后复工安全考核试卷含答案
- 大型商超仓储管理流程手册
- 教师资格证考试重点知识点汇编笔记
- 棘皮类繁育工中秋节后复工安全考核试卷含答案
- 钻孔机司机中秋节后复工安全考核试卷含答案
- 耐蚀喷涂工中秋节后复工安全考核试卷含答案
- 水供应输排工中秋节后复工安全考核试卷含答案
- 眼镜验光师中秋节后复工安全考核试卷含答案
- 2025年临床诊疗指南:过敏性紫癜详解
- 儿童托管中心疫情防控应急预案
- 沿海养殖区生态环境修复-洞察分析
- 阑尾炎课件24张
- 光伏发电项目技术审查方案
- 中央空调系统维保服务报价清单
- 护士N3岗位竞聘
- 人教版三年级上册《生命.生态.安全》全册教案(及计划)
- 2024年污水管道维修协议书范文范本
- 雪糕车租赁合同三篇
- 绘画劳务合同
评论
0/150
提交评论