【故障处理】一次RAC故障处理过程
【故障处理】一次RAC故障处理过程
1.1 故障环境介绍
项目 |
source db |
db 类型 |
2节点RAC |
db version |
11.2.0.1.0 |
db 存储 |
ASM |
OS版本及kernel版本 |
RHEL 6.6 |
1.2 故障处理过程
晚上10点多,一个网友喊我帮忙处理RAC宕机不能启动的问题,并且告知涉及到多路径和存储的事。小麦苗对存储一向不太懂,多路径也没怎么接触,自己也没研究过这个东西。既然找到了我,那就不能不管啊,硬着头皮上去看看。结果悲催了,搞了N个小时,求助了N个人,搞到第二天中午,终于搞定了,幸运的是第二天是周末,不用上班。小麦苗把处理过程记录一下,希望我的处理过程可以帮到更多人。
刚开始上去看的时候,节点1的css不能启动,报了一大堆的错误,节点2的ha也不能正常启动。错误我忘记记录了,反正是各种研究日志,各种查MOS,各种百度,各种Google,包括OCR的还原都试了,最后没办法了,只有使用个人常用的绝招了,那就是。。。。。重新执行root.sh脚本。
关于该脚本的执行,我在个人博客中有多次提到。不过还是得多练练,因为注意事项很多。首先,如果要保持磁盘组不被删除,那么执行卸载命令($ORACLE_HOME/crs/install/rootcrs.pl -deconfig -force -verbose)可以加上-keepdg选项,但是11.2.0.1没有该选项。在第二个节点上执行卸载的时候可以不用加-lastnode,尽可能多的保留信息。
很幸运,小麦苗第一次执行后,集群可以正常启动了,一切安好,从10点熬到1点了吧。结果在准备导入OCR的备份的时候,需要以exec模式启动CRS,结果又悲催了,集群坏掉了。没办法,只得重启,重启更悲催,OCR的盘找不到了。小麦苗想放弃了。盘找不到,我更没办法了。只得找找懂存储的人来弄了。差不多2点了。好吧,该休息了。
早上8点多,睁眼就赶紧登teamviewer,继续处理。首先捣鼓了半天的多路径。原来第二个节点的多路径软件有问题,自己就重新安装了一下。安装后期望能看到磁盘,结果还是不行。无奈,在leshami的群里找找懂存储的高手来。肖总帮我上去看了看弄好了存储,找到了磁盘,万分感谢。
接下来就继续进行恢复操作,继续deconfig,然后root.sh。执行完root.sh后发现集群正常,自己尝试重启了一下主机,一切正常,看来就是存储搞得鬼。那就继续恢复数据库,这个是重点。由于整个操作过程都小心翼翼不敢动非OCR的盘,生怕数据搞丢了,因为10T的数据什么备份都没有,我也是醉了。用kfod看了一下磁盘,一切正常,好吧,那就接下来直接MOUNT磁盘组。重新执行root.sh后只要磁盘组的磁盘文件没有损坏,那么就可以直接MOUNT起来的。这也是在无备份情况下恢复OCR的一种办法。
接下来一切都很顺利,例如配置监听,添加DB到srvctl管理器等,真是佛祖保佑。很多处理日志并没有记录,所以这里只能给出一些脚本了。
1.2.1 处理过程中用到的一些脚本
重新执行root.sh脚本特别需要注意的是数据库的数据是否放在OCR磁盘组上。若放在OCR磁盘组上切记不能随意执行该脚本。
1、2个节点分别执行deconfig:
export ORACLE_HOME=/u01/app/11.2.0/grid export PATH=$PATH:$ORACLE_HOME/bin $ORACLE_HOME/crs/install/rootcrs.pl -deconfig -force -verbose |
2、执行完后,需要对OCR盘进行dd,2个节点都执行:
dd if=/dev/zero of=/dev/oracleasm/disks/OCR_VOL2 bs=1024k count=1024 dd if=/dev/zero of=/dev/oracleasm/disks/OCR_VOL1 bs=1024k count=1024 |
3、节点1执行完后再在节点2执行:
export ORACLE_HOME=/u01/app/11.2.0/grid $ORACLE_HOME/root.sh |
另外,对于11.2.0.1版本执行root.sh有一个常见的bug错误:
CRS-4124: Oracle High Availability Services startup failed. CRS-4000: Command Start failed, or completed with errors. ohasd failed to start: Inappropriate ioctl for device ohasd failed to start: Inappropriate ioctl for device at /u01/app/11.2.0/grid/crs/install/roothas.pl line 296. |
该错误的解决办法就是:
就是在执行root.sh之前执行以下命令
/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1 |
如果出现
/bin/dd: opening`/var/tmp/.oracle/npohasd': No such file or directory |
的时候文件说明相关文件还没生成,那就继续执行,直到能执行为止,一般出现Adding daemon to inittab这条信息的时候执行dd命令。
1.2.2 root.sh的配置脚本
root.sh的一些配置放在如下的脚本中,包括要创建的OCR盘的名称,磁盘路径等:
$ORACLE_HOME/crs/config/config.sh |
1.2.3 kfod命令
该命令可以显示所有的磁盘信息:
data01->export ORACLE_HOME=/u01/app/11.2.0/grid data01->$ORACLE_HOME/bin/kfod disk=all s=true ds=true c=true
-------------------------------------------------------------------------------- Disk Size Header Path Disk Group User Group ================================================================================ 1: 476837 Mb MEMBER /dev/oracleasm/disks/DATA_VOL1 DATA grid asmadmin 2: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL10 DATA grid asmadmin 3: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL11 DATA grid asmadmin 4: 953675 Mb MEMBER /dev/oracleasm/disks/DATA_VOL12 DATA grid asmadmin 5: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL13 DATA grid asmadmin 6: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL14 DATA grid asmadmin 7: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL15 DATA grid asmadmin 8: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL16 DATA grid asmadmin 9: 953675 Mb MEMBER /dev/oracleasm/disks/DATA_VOL18 DATA grid asmadmin 10: 953675 Mb MEMBER /dev/oracleasm/disks/DATA_VOL2 DATA grid asmadmin 11: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL3 DATA grid asmadmin 12: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL4 DATA grid asmadmin 13: 953675 Mb MEMBER /dev/oracleasm/disks/DATA_VOL5 DATA grid asmadmin 14: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL6 DATA grid asmadmin 15: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL7 DATA grid asmadmin 16: 953674 Mb MEMBER /dev/oracleasm/disks/DATA_VOL8 DATA grid asmadmin 17: 953675 Mb MEMBER /dev/oracleasm/disks/DATA_VOL9 DATA grid asmadmin 18: 476837 Mb MEMBER /dev/oracleasm/disks/FLASH_VOL1 FLASH grid asmadmin 19: 286103 Mb MEMBER /dev/oracleasm/disks/FLASH_VOL2 FLASH grid asmadmin 20: 286057 Mb MEMBER /dev/oracleasm/disks/OCR_VOL1 OCR grid asmadmin 21: 286102 Mb CANDIDATE /dev/oracleasm/disks/OCR_VOL2 # grid asmadmin 22: 476837 Mb MEMBER ORCL:DATA_VOL1 DATA <unknown> <unknown> 23: 953674 Mb MEMBER ORCL:DATA_VOL10 DATA <unknown> <unknown> 24: 953674 Mb MEMBER ORCL:DATA_VOL11 DATA <unknown> <unknown> 25: 953675 Mb MEMBER ORCL:DATA_VOL12 DATA <unknown> <unknown> 26: 953674 Mb MEMBER ORCL:DATA_VOL13 DATA <unknown> <unknown> 27: 953674 Mb MEMBER ORCL:DATA_VOL14 DATA <unknown> <unknown> 28: 953674 Mb MEMBER ORCL:DATA_VOL15 DATA <unknown> <unknown> 29: 953674 Mb MEMBER ORCL:DATA_VOL16 DATA <unknown> <unknown> 30: 953675 Mb MEMBER ORCL:DATA_VOL18 DATA <unknown> <unknown> 31: 953675 Mb MEMBER ORCL:DATA_VOL2 DATA <unknown> <unknown> 32: 953674 Mb MEMBER ORCL:DATA_VOL3 DATA <unknown> <unknown> 33: 953674 Mb MEMBER ORCL:DATA_VOL4 DATA <unknown> <unknown> 34: 953675 Mb MEMBER ORCL:DATA_VOL5 DATA <unknown> <unknown> 35: 953674 Mb MEMBER ORCL:DATA_VOL6 DATA <unknown> <unknown> 36: 953674 Mb MEMBER ORCL:DATA_VOL7 DATA <unknown> <unknown> 37: 953674 Mb MEMBER ORCL:DATA_VOL8 DATA <unknown> <unknown> 38: 953675 Mb MEMBER ORCL:DATA_VOL9 DATA <unknown> <unknown> 39: 476837 Mb MEMBER ORCL:FLASH_VOL1 FLASH <unknown> <unknown> 40: 286103 Mb MEMBER ORCL:FLASH_VOL2 FLASH <unknown> <unknown> 41: 286057 Mb MEMBER ORCL:OCR_VOL1 OCR <unknown> <unknown> 42: 286102 Mb CANDIDATE ORCL:OCR_VOL2 # <unknown> <unknown> -------------------------------------------------------------------------------- ORACLE_SID ORACLE_HOME HOST_NAME ================================================================================ +ASM1 /u01/app/11.2.0/grid data01 +ASM2 /u01/app/11.2.0/grid data02 data01-> data01-> data01-> data01->sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on Sat Dec 10 12:27:25 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Real Application Clusters and Automatic Storage Management options
SQL> SQL> SQL> alter diskgroup OCR ADD DISK '/dev/oracleasm/disks/OCR_VOL2';
Diskgroup altered.
|
1.2.4 添加db到srvctl管理器中
11.2.0.1没有-c参数,那就去掉,可以用-h查看具体用法:
srvctl add database -d DGPHY -c RAC -o /oracle/app/oracle/product/11.2.0/db -p '+DATA/TESTDGPHY/PARAMETERFILE/spfiledgphy.ora' -r primary -n TESTDG
srvctl add instance -d DGPHY -i DGPHY1 -n ZFZHLHRDB1 srvctl add instance -d DGPHY -i DGPHY2 -n ZFZHLHRDB2
srvctl status database -d DGPHY srvctl start database -d TESTDG
|
About Me
...............................................................................................................................
● 本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用
● 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和个人微信公众号(xiaomaimiaolhr)上有同步更新
● 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2130218/
● 本文博客园地址:http://www.cnblogs.com/lhrbest/p/6157931.html
● 本文pdf版及小麦苗云盘地址:http://blog.itpub.net/26736162/viewspace-1624453/
● QQ群:230161599 微信群:私聊
● 联系我请加QQ好友(642808185),注明添加缘由
● 于 2016-12-09 22:00 ~ 2016-12-10 16:00 在在泰兴公寓完成
● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解
● 版权所有,欢迎分享本文,转载请保留出处
...............................................................................................................................
手机长按下图识别二维码或微信客户端扫描下边的二维码来关注小麦苗的微信公众号:xiaomaimiaolhr,免费学习最实用的数据库技术。
............................................................................................ ● 小麦苗的微店:https://weidian.com/s/793741433?wfr=c&ifr=shopdetail ............................................................................................ 使用微信客户端扫描下面的二维码来关注小麦苗的微信公众号(DB宝),学习最实用的数据库技术。
|