[20160405]利用bbed修改跳过损坏的索引.txt

[20160405]利用bbed修改跳过损坏的索引.txt

--oracle的启动通过system的第一块的rdba(kcvfhrdb)
http://blog.itpub.net/267265/viewspace-2016219/
http://blog.itpub.net/267265/viewspace-2022857/

--如果前obj#<=59对象损坏,不允许重建,假设某个索引损坏,是否可以跳过索引启动数据库呢?自己做一个测试.
--以sys.undo$的索引i_undo1为例做测试:
--测试参考链接:
-- http://www.htz.pw/2014/11/21/change-bootstrap-table-with-bbed-to-skip-corrupt-block-on-i_undo1.html

1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> select rowid,a.* from sys.bootstrap$ a where a.sql_text like '%UNDO%';
ROWID                   LINE#       OBJ# SQL_TEXT
------------------ ---------- ---------- ------------------------------------------------------------
AAAAA7AABAAAAIJAAH         15         15 CREATE TABLE UNDO$("US#" NUMBER NOT NULL,"NAME" VARCHAR2(30)
                                          NOT NULL,"USER#" NUMBER NOT NULL,"FILE#" NUMBER NOT NULL,"B
                                         LOCK#" NUMBER NOT NULL,"SCNBAS" NUMBER,"SCNWRP" NUMBER,"XACT
                                         SQN" NUMBER,"UNDOSQN" NUMBER,"INST#" NUMBER,"STATUS$" NUMBER
                                          NOT NULL,"TS#" NUMBER,"UGRP#" NUMBER,"KEEP" NUMBER,"OPTIMAL
                                         " NUMBER,"FLAGS" NUMBER,"SPARE1" NUMBER,"SPARE2" NUMBER,"SPA
                                         RE3" NUMBER,"SPARE4" VARCHAR2(1000),"SPARE5" VARCHAR2(1000),
                                         "SPARE6" DATE) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
                                          STORAGE (  INITIAL 64K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2
                                         147483645 PCTINCREASE 0 OBJNO 15 EXTENTS (FILE 1 BLOCK 224))

AAAAA7AABAAAAIJAAI         34         34 CREATE UNIQUE INDEX I_UNDO1 ON UNDO$(US#) PCTFREE 10 INITRAN
                                         S 2 MAXTRANS 255 STORAGE (  INITIAL 64K NEXT 1024K MINEXTENT
                                         S 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJNO 34 EXTENTS (FI
                                         LE 1 BLOCK 320))

AAAAA7AABAAAAIJAAJ         35         35 CREATE INDEX I_UNDO2 ON UNDO$(NAME) PCTFREE 10 INITRANS 2 MA
                                         XTRANS 255 STORAGE (  INITIAL 64K NEXT 1024K MINEXTENTS 1 MA
                                         XEXTENTS 2147483645 PCTINCREASE 0 OBJNO 35 EXTENTS (FILE 1 B
                                         LOCK 328))

AAAAA7AABAAAAIKAAH         16         16 CREATE TABLE TS$("TS#" NUMBER NOT NULL,"NAME" VARCHAR2(30) N
                                         OT NULL,"OWNER#" NUMBER NOT NULL,"ONLINE$" NUMBER NOT NULL,"
                                         CONTENTS$" NUMBER NOT NULL,"UNDOFILE#" NUMBER,"UNDOBLOCK#" N
                                         UMBER,"BLOCKSIZE" NUMBER NOT NULL,"INC#" NUMBER NOT NULL,"SC
                                         NWRP" NUMBER,"SCNBAS" NUMBER,"DFLMINEXT" NUMBER NOT NULL,"DF
                                         LMAXEXT" NUMBER NOT NULL,"DFLINIT" NUMBER NOT NULL,"DFLINCR"
                                          NUMBER NOT NULL,"DFLMINLEN" NUMBER NOT NULL,"DFLEXTPCT" NUM
                                         BER NOT NULL,"DFLOGGING" NUMBER NOT NULL,"AFFSTRENGTH" NUMBE
                                         R NOT NULL,"BITMAPPED" NUMBER NOT NULL,"PLUGGED" NUMBER NOT
                                         NULL,"DIRECTALLOWED" NUMBER NOT NULL,"FLAGS" NUMBER NOT NULL
                                         ,"PITRSCNWRP" NUMBER,"PITRSCNBAS" NUMBER,"OWNERINSTANCE" VAR
                                         CHAR2(30),"BACKUPOWNER" VARCHAR2(30),"GROUPNAME" VARCHAR2(30
                                         ),"SPARE1" NUMBER,"SPARE2" NUMBER,"SPARE3" VARCHAR2(1000),"S
                                         PARE4" DATE) STORAGE (  OBJNO 16 TABNO 2) CLUSTER C_TS#(TS#)

SCOTT@book> @ &r/rowid AAAAA7AABAAAAIJAAI
    OBJECT       FILE      BLOCK        ROW DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- ----------------------------------------
        59          1        521          8 1,521                alter system dump datafile 1 block 521 ;

--从定义也可以看出i_undo1索引在dba=1,320.
SCOTT@book> select * from dba_extents where owner='SYS' and segment_name='I_UNDO1';
OWNER  SEGMENT_NAME          SEGMENT_TYPE       TABLESPACE_NAME  EXTENT_ID    FILE_ID   BLOCK_ID      BYTES     BLOCKS RELATIVE_FNO
------ --------------------  ------------------ --------------- ---------- ---------- ---------- ---------- ---------- ------------
SYS    I_UNDO1               INDEX              SYSTEM                   0          1        320      65536          8            1

2.破坏索引:
SCOTT@book> @ &r/bbvi 1 320
BVI_COMMAND
-----------------------------------------------------
bvi -b 2621440 -s 8192 /mnt/ramdisk/book/system01.dbf

--关闭数据库,顺便往开头写入一些垃圾数据.我的测试仅仅10 A2=>AA AA

SYS@book> startup
ORACLE instance started.

Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

--可以发现虽然我仅仅修改2个字节,oracle一样启动正常.

$ dd if=/dev/zero of=/mnt/ramdisk/book/system01.dbf bs=8192 count=8 seek=320 conv=notrunc
8+0 records in
8+0 records out
65536 bytes (66 kB) copied, 9.6634e-05 seconds, 678 MB/s

SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 1, block # 321)
ORA-01110: data file 1: '/mnt/ramdisk/book/system01.dbf'
Process ID: 24813
Session ID: 232 Serial number: 3
--这次报错.

3.我简单修改bootstrap$的标识为3c.

BBED> set dba 1,521
        DBA             0x00400209 (4194825 1,521)

BBED> p  *kdbr[8]
rowdata[4533]
-------------
ub1 rowdata[4533]                           @5823     0x2c

BBED> x /rnnc
rowdata[4533]                               @5823
-------------
flag@5823: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5824: 0x01
cols@5825:    3

col    0[2] @5826: 34
col    1[2] @5829: 34
col  2[196] @5832: CREATE UNIQUE INDEX I_UNDO1 ON UNDO$(US#) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE (  INITIAL 64K
                   NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJNO 34 EXTENTS (FILE 1 BLOCK 320))

BBED> assign dba 1,521 offset 5823 = 0x3c;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub1 rowdata[0]                              @5823     0x3c

--这样标识删除.
BBED> sum apply
Check value for File 1, Block 521:
current = 0x42fa, required = 0x42fa

BBED> verify   dba 1,521
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 521

Block Checking: DBA = 4194825, Block Type = KTB-managed data block
data header at 0x7f71a13b1244
kdbchk: the amount of space used is not equal to block size
        used=6760 fsc=0 avsp=1156 dtl=8120
Block 521 failed with check code 6110

DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 1
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

--先不管这些不一致看看是否可以进入.

SYS@book> startup
ORACLE instance started.

Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

SYS@book> select /*+ index(undo$ i_undo1) */* from undo$ where name='SYSTEM';

SYS@book> @ &r/dpc '' ''
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------
SQL_ID  44y8fh2x00vqx, child number 0
-------------------------------------
select /*+ index(undo$ i_undo1) */* from undo$ where name='SYSTEM'
Plan hash value: 3995376916
----------------------------------------------------------------------------
| Id  | Operation         | Name  | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |       |        |       |     2 (100)|          |
|*  1 |  TABLE ACCESS FULL| UNDO$ |      1 |    63 |     2   (0)| 00:00:01 |
----------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1 / UNDO$@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter("NAME"='SYSTEM')

--说明已经不再使用索引i_undo1.
--这样虽然破坏数据的一致性, obj$,ind$的相关信息没有删除,至少数据库能启动,
--dbv检查也可以发现索引破坏.

$ dbv file=/mnt/ramdisk/book/system01.dbf
DBVERIFY: Release 11.2.0.4.0 - Production on Tue Apr 5 08:32:12 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /mnt/ramdisk/book/system01.dbf
Page 320 is marked corrupt
Corrupt block relative dba: 0x00400140 (file 1, block 320)
Completely zero block found during dbv:

Page 321 is marked corrupt
Corrupt block relative dba: 0x00400141 (file 1, block 321)
Completely zero block found during dbv:

Page 322 is marked corrupt
Corrupt block relative dba: 0x00400142 (file 1, block 322)
Completely zero block found during dbv:

Page 323 is marked corrupt
Corrupt block relative dba: 0x00400143 (file 1, block 323)
Completely zero block found during dbv:

Page 324 is marked corrupt
Corrupt block relative dba: 0x00400144 (file 1, block 324)
Completely zero block found during dbv:

Page 325 is marked corrupt
Corrupt block relative dba: 0x00400145 (file 1, block 325)
Completely zero block found during dbv:

Page 326 is marked corrupt
Corrupt block relative dba: 0x00400146 (file 1, block 326)
Completely zero block found during dbv:

Page 327 is marked corrupt
Corrupt block relative dba: 0x00400147 (file 1, block 327)
Completely zero block found during dbv:

Block Checking: DBA = 4194825, Block Type = KTB-managed data block
data header at 0x7fafd934a044
kdbchk: the amount of space used is not equal to block size
        used=6760 fsc=0 avsp=1156 dtl=8120
Page 521 failed with check code 6110

DBVERIFY - Verification complete

Total Pages Examined         : 98560
Total Pages Processed (Data) : 64815
Total Pages Failing   (Data) : 1
Total Pages Processed (Index): 13670
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 3938
Total Pages Processed (Seg)  : 1
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 16129
Total Pages Marked Corrupt   : 8
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 342809922 (3.342809922)

4.补充测试修复1,521一致性.
--做这个不是我擅长的,还是自己测试看看.
BBED> verify   dba 1,521
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 521

Block Checking: DBA = 4194825, Block Type = KTB-managed data block
data header at 0x7fc784424244
kdbchk: the amount of space used is not equal to block size
        used=6760 fsc=0 avsp=1156 dtl=8120
Block 521 failed with check code 6110

-- dtl - used  = 8120-6760= 1360 = 0x550

BBED> assign kdbh.kdbhavsp=1360
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
sb2 kdbhavsp                                @78       1360

BBED> assign kdbh.kdbhtosp=1360
sb2 kdbhtosp                                @80       1360

BBED> sum apply
Check value for File 1, Block 521:
current = 0x42fa, required = 0x42fa

BBED> verify   dba 1,521
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 521

Block Checking: DBA = 4194825, Block Type = KTB-managed data block
data header at 0x1d33e44
kdbchk: space available on commit is incorrect
        tosp=1360 fsc=0 stb=2 avsp=1360
Block 521 failed with check code 6111
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 1
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

--依旧有问题.还要1360+2=1362.

BBED> assign kdbh.kdbhtosp=1362;
sb2 kdbhtosp                                @80       1362
BBED> assign kdbh.kdbhtosp=1362;
sb2 kdbhtosp                                @80       1362

BBED> sum apply
Check value for File 1, Block 521:
current = 0x42f8, required = 0x42f8

BBED> verify   dba 1,521
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 521

DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

-- 这种测试是万不得以而为之,千万不要在生产系统测试.在测试的过程中参考连接
-- http://www.htz.pw/2014/11/21/change-bootstrap-table-with-bbed-to-skip-corrupt-block-on-i_undo1.html
-- 再次感谢.

时间: 2024-10-23 20:06:58

[20160405]利用bbed修改跳过损坏的索引.txt的相关文章

[20160413利用bbed修改跳过损坏的索引.txt

[20160413利用bbed修改跳过损坏的索引.txt --前一阵子做过利用bbed修改跳过损坏的索引,这次测试看看破坏索引SYS.I_OBJ1看看. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ----------------------------------------------

[20160405]bbed修改文件头.txt

[20160405]bbed修改文件头.txt --以前做过一次,重复测试: http://blog.itpub.net/267265/viewspace-746222/ 如果数据库数据文件损坏,并且archivelog损坏,这样无法完全恢复,如果仅仅某个数据文件的scn与其他文件不同步,导致该数据文件无法mount. 正常可以像odu之类的工具恢复.但是在实际上如果修改数据文件的scn保持同步,这样数据库可以正常打开,选择常规的方法imp/exp以及expdp/impdp 方式恢复,这样虽然丢

[20160407]bbed修改文件头2(补充).txt

[20160407]bbed修改文件头2(补充).txt --昨天被别人问一个问题,就是我的测试修改数据文件相应的CHECKPOINT_CHANGE#就ok了.偏移量是block=1的offset=484. --链接 http://blog.itpub.net/267265/viewspace-2075424/ --不过别人问的是这个时间是如何存储的.我以前也做过一些.链接: --http://blog.itpub.net/267265/viewspace-746222/ --我的感觉在11.2

利用谷歌搜索跳转做百度知道

前段时间在看百度知道的时候,不经意间发现了一个有意思的事情,很多人利用GOOGLE搜索跳转在百度知道留下链接.我们都知道,百度赋予百度知道很高的权重,而百度恰好对来自谷歌的网址是不进行过滤的,于是有人抓住了百度这一说大不大,说小不小的漏洞,利用百度知道进行批量做关键词排名.当我们第一眼看到这个链接,会以为它是谷歌的页面,但鼠标一点这个链接,会先访问谷歌,然后通过谷歌跳转到一个短网址,再通过这个短网址,最终跳转到淘宝客的目标网站,听起来有点绕,有点晕.别急,我们逆向思维,可以总结出如下公式: 原始

怎么利用jquery修改css content伪类中的内容

问题描述 怎么利用jquery修改css content伪类中的内容 html内容: css: .icon-menu:before { content: "f0da"; } jquery代码: $("#icon").css("content",'"f0d7"');$("#icon"). 我想利用jquery把content中的内容改成content: "f0d7";,求助大神解答,我利用

利用css修改复选框的样式做出如下的样式

问题描述 利用css修改复选框的样式做出如下的样式 解决方案 你这个单css搞不了,要结合js <!doctype html> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js"></script> <style> ul,li{list-style:none;padding:0px;

【BBED】使用bbed修改数字类型数据

bbed的使用(一)  介绍了BBED的编译安装. bbed的使用(二)  介绍了bbed的语法规则和常用命令的使用. bbed的使用(三)  介绍了bbed的命令. 如何修改字符类型的数据,使用bbed修改数据表中字符类型的数据 下面介绍使用bbed修改数字类型数据 yangobj表是有scott下的emp经过CTAS创建. 修改前: SQL> select * from yangobj;      EMPNO ENAME                          JOB      

【BBED】使用bbed 修改data block Block Misplaced

使用bbed 修改数据块物理校验出错的问题. SQL> select * from yangtab; select * from yangtab               * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 4, block # 388) ORA-01110: data file 4: '/opt/oracle/oradata/orcl/users01.dbf' 使用dbv 进行验证. oracle

利用反射修改ListView的ScollBar图标

MainActivity如下: package cc.testlistviewscollbar; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.os.Bundle; import android.widget.AbsListView; import android.widget.ListView;