合 Oracle异常恢复BBED系列
Tags: Oracle编译恢复BBEDORA-08102sys.bootstrap$
BBED模拟并修复ORA-08102错误
前言部分
导读和注意事项
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
① 使用BBED修复ORA-08102错误(重点)
② BBED的使用
③ 数据块格式的dump文件解释
④ ORA-08102错误的trace文件解释
⑤ 从rdba获取ROWID信息
⑥ 其它实用技能
本文简介
这几天一个朋友问我有关ORA-08102的错误,而且是关于OBJ$表上的I_OBJ4索引。这些系统对象的索引,不能采用重建或设置事件的方式来修复该错误。模模糊糊的记得很早以前看过使用BBED的方式来修复该错误,只是已经记不清了。正好,趁此机会把该错误再模拟的复现一下,也把bbed再熟悉一下吧。
朋友发给我的参考文章也是大师惜分飞的博客地址,大致看了一下过程,主要是找到索引块的相关地址,然后利用bbed把键值修改的和表中存储的一致即可。还是那句话,“纸上得来终觉浅,绝知此事要躬行。”,自己模拟实验,这个过程是必须的。
废话不多说,开始实验吧。
相关文章链接
阅读本篇文章,请先阅读以下内容:
- Oracle 中 Object_iD 和 Data_Object_ID 的区别:http://blog.itpub.net/26736162/viewspace-2145230/
- Oracle的dump函数:http://blog.itpub.net/26736162/viewspace-2145228/
注意事项
- bbed毕竟是未公开的恢复方式,所以不熟悉的朋友要慎用。
- startup force慎用
- 操作bbed之前最好先把数据库关闭
相关知识点扫盲
An ORA-08102 indicates that there is a mismatch between the key(s) stored in the index and the values stored in the table.What typically happens in the index is built and at some future time,some type of corruption occurs,either in the table or index,to cause the mismatch.
ORA-08102常见于索引键值与表上存的值不一致。
1 2 3 4 5 | [oracle@rhel6lhr ~]$ oerr ora 8102 08102, 00000, "index key not found, obj# %s, file %s, block %s (%s)" // *Cause: Internal error: possible inconsistency in index // *Action: Send trace file to your customer support representative, along // with information on reproducing the error |
ora-08102这种错误说明索引或表出现了数据不一致,索引上记录的键值和表里的数据不一致,引起访问失败,一般重建下索引就可以解决。两边不一致改表和索引都能达到目的,只要一致即可,但有一个原则就是索引键值始终要保证按顺序递增。通常有三种情况:
1.如果损坏为索引,则删除索引并重建索引,但对于index的obj#小于56的情况,由于是核心的bootstrap$对象,index是在DB启动时由DB自动创建,此种情况下通过设置event 38003或startup migrate模式都不能解决,但obj#>56的则可以。
2.如果损坏为块级别,则采用坏块的处理方法
3.如果损坏的为表的记录级别的则采用bbed或其它工具
I_OBJ1、I_OBJ2、I_OBJ3、I_OBJ4、I_OBJ5这几个都是OBJ$基表的索引,如果损坏会非常麻烦,因为ORACLE 对这些对象的DDL做了严格限制,没有办法简单修复它们。
1 2 3 4 5 6 | SYS@ora11g > drop index i_obj4; drop index i_obj5 * ERROR at line 1: ORA-00701: object necessary for warmstarting database cannot be altered |
实验环境介绍
项目 | source db |
---|---|
db 类型 | 单机 |
db version | 11.2.0.3.0 |
db 存储 | FS |
OS版本及kernel版本 | RHEL 6.5 |
实验目标
实验目标:使用BBED模拟并修复ORA-08102错误。
模拟错误过程:通过bbed修改OBJ$表中DATAOBJ#列最大的行所在的块,让DATAOBJ#的值增大,从而和索引中记录的值不一致。重启数据库并创建表让数据库报出ORA-08102错误。
修复错误过程:通过bbed把表中或索引中的不一致的数据修改成一致的,从而修复ORA-08102错误。
实验过程
做全备
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | [oracle@rhel6lhr ~]$ more rman_full.sh rman target / nocatalog <<EOF run{ backup database format '/home/oracle/bak/%d_%U.full'; sql 'alter system archive log current'; backup archivelog all format '/home/oracle/bak/%d_%U.arc'; backup current controlfile format '/home/oracle/bak/%d_%U.ctl'; } EOF [oracle@rhel6lhr ~]$ sh rman_full.sh Recovery Manager: Release 11.2.0.3.0 - Production on Wed Sep 20 13:56:41 2017 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: ORA11G (DBID=4270446895) using target database control file instead of recovery catalog RMAN> 2> 3> 4> 5> 6> Starting backup at 2017-09-20 13:56:41 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=21 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf input datafile file number=00022 name=/u01/app/oracle/oradata/ora11g/ts_ogg01.dbf input datafile file number=00007 name=/u01/app/oracle/oradata/ora11g/DWII_CNY_BK_F_01.dbf input datafile file number=00008 name=/u01/app/oracle/oradata/ora11g/DWII_DPA_F_01.dbf input datafile file number=00009 name=/u01/app/oracle/oradata/ora11g/DWII_DPA_I_01.dbf input datafile file number=00010 name=/u01/app/oracle/oradata/ora11g/DWII_DPA_S_01.dbf input datafile file number=00011 name=/u01/app/oracle/oradata/ora11g/DWII_SOR_F_01.dbf input datafile file number=00012 name=/u01/app/oracle/oradata/ora11g/DWII_SOR_I_01.dbf input datafile file number=00013 name=/u01/app/oracle/oradata/ora11g/DW_USER.dbf input datafile file number=00014 name=/u01/app/oracle/oradata/ora11g/SQCHECK.dbf input datafile file number=00015 name=/u01/app/oracle/oradata/ora11g/SD_CNY_D_01.dbf input datafile file number=00016 name=/u01/app/oracle/oradata/ora11g/SD_CNY_F_01.dbf input datafile file number=00017 name=/u01/app/oracle/oradata/ora11g/SD_DPA_D_01.dbf input datafile file number=00018 name=/u01/app/oracle/oradata/ora11g/SD_DPA_F_01.dbf input datafile file number=00019 name=/u01/app/oracle/oradata/ora11g/SD_SORT_T_01.dbf input datafile file number=00020 name=/u01/app/oracle/oradata/ora11g/DWII_FXDM_F_01.dbf input datafile file number=00021 name=/u01/app/oracle/oradata/ora11g/SD_SOR_T_01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/ora11g/aa.dbf input datafile file number=00023 name=/u01/app/oracle/oradata/ora11g/test01.dbf channel ORA_DISK_1: starting piece 1 at 2017-09-20 13:56:42 channel ORA_DISK_1: finished piece 1 at 2017-09-20 13:59:17 piece handle=/home/oracle/bak/ORA11G_27seuekq_1_1.full tag=TAG20170920T135642 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:02:35 Finished backup at 2017-09-20 13:59:17 Starting Control File and SPFILE Autobackup at 2017-09-20 13:59:17 piece handle=/u05/app/oracle/flash_recovery_area/ORA11G/autobackup/2017_09_20/o1_mf_s_955202357_dw40xohn_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2017-09-20 13:59:18 sql statement: alter system archive log current Starting backup at 2017-09-20 13:59:18 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=302 RECID=304 STAMP=955202163 input archived log thread=1 sequence=303 RECID=305 STAMP=955202358 input archived log thread=1 sequence=304 RECID=306 STAMP=955202358 channel ORA_DISK_1: starting piece 1 at 2017-09-20 13:59:18 channel ORA_DISK_1: finished piece 1 at 2017-09-20 13:59:19 piece handle=/home/oracle/bak/ORA11G_29seuepm_1_1.arc tag=TAG20170920T135918 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2017-09-20 13:59:19 Starting backup at 2017-09-20 13:59:20 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 2017-09-20 13:59:21 channel ORA_DISK_1: finished piece 1 at 2017-09-20 13:59:22 piece handle=/home/oracle/bak/ORA11G_2aseuepo_1_1.ctl tag=TAG20170920T135920 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2017-09-20 13:59:22 Starting Control File and SPFILE Autobackup at 2017-09-20 13:59:22 piece handle=/u05/app/oracle/flash_recovery_area/ORA11G/autobackup/2017_09_20/o1_mf_s_955202362_dw40xtf0_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2017-09-20 13:59:23 RMAN> Recovery Manager complete. |