<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>《bbed 使用实现 drop index 操作》的评论</title>
	<atom:link href="https://www.xifenfei.com/2012/08/bbed-%e5%88%a0%e9%99%a4-index-%e6%93%8d%e4%bd%9c.html/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com/2012/08/bbed-%e5%88%a0%e9%99%a4-index-%e6%93%8d%e4%bd%9c.html</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Thu, 11 Dec 2025 02:46:14 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>作者：惜分飞</title>
		<link>https://www.xifenfei.com/2012/08/bbed-%e5%88%a0%e9%99%a4-index-%e6%93%8d%e4%bd%9c.html/comment-page-1#comment-966</link>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
		<pubDate>Tue, 14 Aug 2012 12:54:22 +0000</pubDate>
		<guid isPermaLink="false">https://www.xifenfei.com/?p=3723#comment-966</guid>
		<description><![CDATA[&lt;strong&gt;补充说明--index unable&lt;/strong&gt;
在9i中当index处于unable状态时sql会报错
在10g及其以上版本中当index处于 unable时候,oracle会选择不使用该index
[sql]
--创建一个index模拟环境
SQL&gt; create index chf.ind_t_xifenfei on chf.t_xifenfei(object_id);

Index created.

SQL&gt; col owner for a5
SQL&gt; select OWNER,INDEX_NAME,TABLE_NAME,status from dba_indexes where index_name=&#039;IND_T_XIFENFEI&#039;;

OWNER INDEX_NAME                     TABLE_NAME                     STATUS
----- ------------------------------ ------------------------------ --------
CHF   IND_T_XIFENFEI                 T_XIFENFEI                     VALID

SQL&gt; select object_id from dba_objects where object_name=&#039;IND_T_XIFENFEI&#039;;

 OBJECT_ID
----------
     75563

SQL&gt; select obj#,dataobj#,ts#,file#,block#,bo#,FLAGS from sys.ind$ where obj#=75563;

      OBJ#   DATAOBJ#        TS#      FILE#     BLOCK#        BO#      FLAGS
---------- ---------- ---------- ---------- ---------- ---------- ----------
     75563      75563          4          4       1450      75557          2

SQL&gt; select   rowid,
  2  dbms_rowid.rowid_relative_fno(rowid)rel_fno,
  3  dbms_rowid.rowid_block_number(rowid)blockno,
  4  dbms_rowid.rowid_row_number(rowid) rowno
  5  from sys.ind$ where obj#=75563;

ROWID                 REL_FNO    BLOCKNO      ROWNO
------------------ ---------- ---------- ----------
AAAAACAABAAAT50AAA          1      81524          0

SQL&gt; alter system checkpoint;

System altered.

SQL&gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.


--bbed修改值
[oracle@xifenfei ~]$ bbed listfile=listfile mode=edit password=blockedit

BBED: Release 2.0.0.0.0 - Limited Production on Tue Dec 13 20:56:55 2011

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED&gt; set file 1 block 81524
        FILE#           1
        BLOCK#          81524

BBED&gt; map
 File: /u01/oracle/oradata/ora11g/system01.dbf (1)
 Block: 81524                                 Dba:0x00413e74
------------------------------------------------------------
 KTB Data Block (Table/Cluster)

 struct kcbh, 20 bytes                      @0       

 struct ktbbh, 72 bytes                     @20      

 struct kdbh, 14 bytes                      @92      

 struct kdbt[6], 24 bytes                   @106     

 sb2 kdbr[33]                               @130     

 ub1 freespace[5142]                        @196     

 ub1 rowdata[2850]                          @5338    

 ub4 tailchk                                @8188    


BBED&gt; p *kdbr[7]
rowdata[0]
----------
ub1 rowdata[0]                              @5338     0x6c

BBED&gt; x /rn
rowdata[0]                                  @5338    
----------
flag@5338: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@5339: 0x02
cols@5340:   33
ckix@5341:    5

col    0[4] @5342: 75563 
col    1[4] @5347: 75563 
col    2[2] @5352: 4 
col    3[2] @5355: 4 
col    4[3] @5358: 1450 
col    5[1] @5362: 0 
col    6[2] @5364: 1 
col    7[2] @5367: 10 
col    8[2] @5370: 2 
col    9[3] @5373: 255 
col   10[0] @5377: *NULL*
col   11[2] @5378: 1 
col   12[2] @5381: 2    &lt;----要让index无效,该值需要修改为1
col   13[1] @5384: 0 
col   14[2] @5386: 1 
col   15[3] @5389: 165 
col   16[4] @5393: 74491 
col   17[2] @5398: 1 
col   18[2] @5401: 1 
col   19[3] @5404: 1720 
col   20[7] @5408: ######################################### 
col   21[4] @5416: 74491 
col   22[4] @5421: 74491 
col   23[2] @5426: 1 
col   24[0] @5429: *NULL*
col   25[0] @5430: *NULL*
col   26[0] @5431: *NULL*
col   27[2] @5432: 1 
col   28[0] @5435: *NULL*
col   29[0] @5436: *NULL*
col   30[0] @5437: *NULL*
col   31[0] @5438: *NULL*
col   32[7] @5439: ######################################### 


BBED&gt; x /r
rowdata[0]                                  @5338    
----------
flag@5338: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@5339: 0x02
cols@5340:   33
ckix@5341:    5

col    0[4] @5342:  0xc3  0x08  0x38  0x40 
col    1[4] @5347:  0xc3  0x08  0x38  0x40 
col    2[2] @5352:  0xc1  0x05 
col    3[2] @5355:  0xc1  0x05 
col    4[3] @5358:  0xc2  0x0f  0x33 
col    5[1] @5362:  0x80 
col    6[2] @5364:  0xc1  0x02 
col    7[2] @5367:  0xc1  0x0b 
col    8[2] @5370:  0xc1  0x03 
col    9[3] @5373:  0xc2  0x03  0x38 
col   10[0] @5377: *NULL*
col   11[2] @5378:  0xc1  0x02 
col   12[2] @5381:  0xc1  0x03 
col   13[1] @5384:  0x80 
col   14[2] @5386:  0xc1  0x02 
col   15[3] @5389:  0xc2  0x02  0x42 
col   16[4] @5393:  0xc3  0x08  0x2d  0x5c 
col   17[2] @5398:  0xc1  0x02 
col   18[2] @5401:  0xc1  0x02 
col   19[3] @5404:  0xc2  0x12  0x15 
col   20[7] @5408:  0x78  0x6f  0x0c  0x0d  0x15  0x31  0x0d 
col   21[4] @5416:  0xc3  0x08  0x2d  0x5c 
col   22[4] @5421:  0xc3  0x08  0x2d  0x5c 
col   23[2] @5426:  0xc1  0x02 
col   24[0] @5429: *NULL*
col   25[0] @5430: *NULL*
col   26[0] @5431: *NULL*
col   27[2] @5432:  0xc1  0x02 
col   28[0] @5435: *NULL*
col   29[0] @5436: *NULL*
col   30[0] @5437: *NULL*
col   31[0] @5438: *NULL*
col   32[7] @5439:  0x78  0x6f  0x0c  0x0d  0x0d  0x31  0x0c 

BBED&gt; set count 64
        COUNT           64

BBED&gt; m /x 02 offset 5383
 File: /u01/oracle/oradata/ora11g/system01.dbf (1)
 Block: 81524            Offsets: 5383 to 5446           Dba:0x00413e74
------------------------------------------------------------------------
 02018002 c10203c2 024204c3 082d5c02 c10202c1 0203c212 1507786f 0c0d1531 
 0d04c308 2d5c04c3 082d5c02 c102ffff ff02c102 ffffffff 07786f0c 0d0d310c 

 &lt;32 bytes per line&gt;

BBED&gt; p *kdbr[7]
rowdata[0]
----------
ub1 rowdata[0]                              @5338     0x6c

BBED&gt; x /rn
rowdata[0]                                  @5338    
----------
flag@5338: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@5339: 0x02
cols@5340:   33
ckix@5341:    5

col    0[4] @5342: 75563 
col    1[4] @5347: 75563 
col    2[2] @5352: 4 
col    3[2] @5355: 4 
col    4[3] @5358: 1450 
col    5[1] @5362: 0 
col    6[2] @5364: 1 
col    7[2] @5367: 10 
col    8[2] @5370: 2 
col    9[3] @5373: 255 
col   10[0] @5377: *NULL*
col   11[2] @5378: 1 
col   12[2] @5381: 1 
col   13[1] @5384: 0 
col   14[2] @5386: 1 
col   15[3] @5389: 165 
col   16[4] @5393: 74491 
col   17[2] @5398: 1 
col   18[2] @5401: 1 
col   19[3] @5404: 1720 
col   20[7] @5408: ######################################### 
col   21[4] @5416: 74491 
col   22[4] @5421: 74491 
col   23[2] @5426: 1 
col   24[0] @5429: *NULL*
col   25[0] @5430: *NULL*
col   26[0] @5431: *NULL*
col   27[2] @5432: 1 
col   28[0] @5435: *NULL*
col   29[0] @5436: *NULL*
col   30[0] @5437: *NULL*
col   31[0] @5438: *NULL*
col   32[7] @5439: ######################################### 


BBED&gt; sum apply
Check value for File 1, Block 81524:
current = 0x5d15, required = 0x5d15

BBED&gt; verify
DBVERIFY - Verification starting
FILE = /u01/oracle/oradata/ora11g/system01.dbf
BLOCK = 81524


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

--启动数据库测试
SQL&gt; startup
ORACLE instance started.

Total System Global Area  230162432 bytes
Fixed Size                  1344088 bytes
Variable Size              88083880 bytes
Database Buffers          134217728 bytes
Redo Buffers                6516736 bytes
Database mounted.
Database opened.
SQL&gt; col owner for a5
SQL&gt; select OWNER,INDEX_NAME,TABLE_NAME,status from dba_indexes where index_name=&#039;IND_T_XIFENFEI&#039;;

OWNER INDEX_NAME                     TABLE_NAME                     STATUS
----- ------------------------------ ------------------------------ --------
CHF   IND_T_XIFENFEI                 T_XIFENFEI                     UNUSABLE
[/sql]]]></description>
		<content:encoded><![CDATA[<p><strong>补充说明&#8211;index unable</strong><br />
在9i中当index处于unable状态时sql会报错<br />
在10g及其以上版本中当index处于 unable时候,oracle会选择不使用该index</p>
<pre class="brush: sql; title: ; notranslate">
--创建一个index模拟环境
SQL&gt; create index chf.ind_t_xifenfei on chf.t_xifenfei(object_id);

Index created.

SQL&gt; col owner for a5
SQL&gt; select OWNER,INDEX_NAME,TABLE_NAME,status from dba_indexes where index_name='IND_T_XIFENFEI';

OWNER INDEX_NAME                     TABLE_NAME                     STATUS
----- ------------------------------ ------------------------------ --------
CHF   IND_T_XIFENFEI                 T_XIFENFEI                     VALID

SQL&gt; select object_id from dba_objects where object_name='IND_T_XIFENFEI';

 OBJECT_ID
----------
     75563

SQL&gt; select obj#,dataobj#,ts#,file#,block#,bo#,FLAGS from sys.ind$ where obj#=75563;

      OBJ#   DATAOBJ#        TS#      FILE#     BLOCK#        BO#      FLAGS
---------- ---------- ---------- ---------- ---------- ---------- ----------
     75563      75563          4          4       1450      75557          2

SQL&gt; select   rowid,
  2  dbms_rowid.rowid_relative_fno(rowid)rel_fno,
  3  dbms_rowid.rowid_block_number(rowid)blockno,
  4  dbms_rowid.rowid_row_number(rowid) rowno
  5  from sys.ind$ where obj#=75563;

ROWID                 REL_FNO    BLOCKNO      ROWNO
------------------ ---------- ---------- ----------
AAAAACAABAAAT50AAA          1      81524          0

SQL&gt; alter system checkpoint;

System altered.

SQL&gt; shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.


--bbed修改值
[oracle@xifenfei ~]$ bbed listfile=listfile mode=edit password=blockedit

BBED: Release 2.0.0.0.0 - Limited Production on Tue Dec 13 20:56:55 2011

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED&gt; set file 1 block 81524
        FILE#           1
        BLOCK#          81524

BBED&gt; map
 File: /u01/oracle/oradata/ora11g/system01.dbf (1)
 Block: 81524                                 Dba:0x00413e74
------------------------------------------------------------
 KTB Data Block (Table/Cluster)

 struct kcbh, 20 bytes                      @0       

 struct ktbbh, 72 bytes                     @20      

 struct kdbh, 14 bytes                      @92      

 struct kdbt[6], 24 bytes                   @106     

 sb2 kdbr[33]                               @130     

 ub1 freespace[5142]                        @196     

 ub1 rowdata[2850]                          @5338    

 ub4 tailchk                                @8188    


BBED&gt; p *kdbr[7]
rowdata[0]
----------
ub1 rowdata[0]                              @5338     0x6c

BBED&gt; x /rn
rowdata[0]                                  @5338    
----------
flag@5338: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@5339: 0x02
cols@5340:   33
ckix@5341:    5

col    0[4] @5342: 75563 
col    1[4] @5347: 75563 
col    2[2] @5352: 4 
col    3[2] @5355: 4 
col    4[3] @5358: 1450 
col    5[1] @5362: 0 
col    6[2] @5364: 1 
col    7[2] @5367: 10 
col    8[2] @5370: 2 
col    9[3] @5373: 255 
col   10[0] @5377: *NULL*
col   11[2] @5378: 1 
col   12[2] @5381: 2    &lt;----要让index无效,该值需要修改为1
col   13[1] @5384: 0 
col   14[2] @5386: 1 
col   15[3] @5389: 165 
col   16[4] @5393: 74491 
col   17[2] @5398: 1 
col   18[2] @5401: 1 
col   19[3] @5404: 1720 
col   20[7] @5408: ######################################### 
col   21[4] @5416: 74491 
col   22[4] @5421: 74491 
col   23[2] @5426: 1 
col   24[0] @5429: *NULL*
col   25[0] @5430: *NULL*
col   26[0] @5431: *NULL*
col   27[2] @5432: 1 
col   28[0] @5435: *NULL*
col   29[0] @5436: *NULL*
col   30[0] @5437: *NULL*
col   31[0] @5438: *NULL*
col   32[7] @5439: ######################################### 


BBED&gt; x /r
rowdata[0]                                  @5338    
----------
flag@5338: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@5339: 0x02
cols@5340:   33
ckix@5341:    5

col    0[4] @5342:  0xc3  0x08  0x38  0x40 
col    1[4] @5347:  0xc3  0x08  0x38  0x40 
col    2[2] @5352:  0xc1  0x05 
col    3[2] @5355:  0xc1  0x05 
col    4[3] @5358:  0xc2  0x0f  0x33 
col    5[1] @5362:  0x80 
col    6[2] @5364:  0xc1  0x02 
col    7[2] @5367:  0xc1  0x0b 
col    8[2] @5370:  0xc1  0x03 
col    9[3] @5373:  0xc2  0x03  0x38 
col   10[0] @5377: *NULL*
col   11[2] @5378:  0xc1  0x02 
col   12[2] @5381:  0xc1  0x03 
col   13[1] @5384:  0x80 
col   14[2] @5386:  0xc1  0x02 
col   15[3] @5389:  0xc2  0x02  0x42 
col   16[4] @5393:  0xc3  0x08  0x2d  0x5c 
col   17[2] @5398:  0xc1  0x02 
col   18[2] @5401:  0xc1  0x02 
col   19[3] @5404:  0xc2  0x12  0x15 
col   20[7] @5408:  0x78  0x6f  0x0c  0x0d  0x15  0x31  0x0d 
col   21[4] @5416:  0xc3  0x08  0x2d  0x5c 
col   22[4] @5421:  0xc3  0x08  0x2d  0x5c 
col   23[2] @5426:  0xc1  0x02 
col   24[0] @5429: *NULL*
col   25[0] @5430: *NULL*
col   26[0] @5431: *NULL*
col   27[2] @5432:  0xc1  0x02 
col   28[0] @5435: *NULL*
col   29[0] @5436: *NULL*
col   30[0] @5437: *NULL*
col   31[0] @5438: *NULL*
col   32[7] @5439:  0x78  0x6f  0x0c  0x0d  0x0d  0x31  0x0c 

BBED&gt; set count 64
        COUNT           64

BBED&gt; m /x 02 offset 5383
 File: /u01/oracle/oradata/ora11g/system01.dbf (1)
 Block: 81524            Offsets: 5383 to 5446           Dba:0x00413e74
------------------------------------------------------------------------
 02018002 c10203c2 024204c3 082d5c02 c10202c1 0203c212 1507786f 0c0d1531 
 0d04c308 2d5c04c3 082d5c02 c102ffff ff02c102 ffffffff 07786f0c 0d0d310c 

 &lt;32 bytes per line&gt;

BBED&gt; p *kdbr[7]
rowdata[0]
----------
ub1 rowdata[0]                              @5338     0x6c

BBED&gt; x /rn
rowdata[0]                                  @5338    
----------
flag@5338: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@5339: 0x02
cols@5340:   33
ckix@5341:    5

col    0[4] @5342: 75563 
col    1[4] @5347: 75563 
col    2[2] @5352: 4 
col    3[2] @5355: 4 
col    4[3] @5358: 1450 
col    5[1] @5362: 0 
col    6[2] @5364: 1 
col    7[2] @5367: 10 
col    8[2] @5370: 2 
col    9[3] @5373: 255 
col   10[0] @5377: *NULL*
col   11[2] @5378: 1 
col   12[2] @5381: 1 
col   13[1] @5384: 0 
col   14[2] @5386: 1 
col   15[3] @5389: 165 
col   16[4] @5393: 74491 
col   17[2] @5398: 1 
col   18[2] @5401: 1 
col   19[3] @5404: 1720 
col   20[7] @5408: ######################################### 
col   21[4] @5416: 74491 
col   22[4] @5421: 74491 
col   23[2] @5426: 1 
col   24[0] @5429: *NULL*
col   25[0] @5430: *NULL*
col   26[0] @5431: *NULL*
col   27[2] @5432: 1 
col   28[0] @5435: *NULL*
col   29[0] @5436: *NULL*
col   30[0] @5437: *NULL*
col   31[0] @5438: *NULL*
col   32[7] @5439: ######################################### 


BBED&gt; sum apply
Check value for File 1, Block 81524:
current = 0x5d15, required = 0x5d15

BBED&gt; verify
DBVERIFY - Verification starting
FILE = /u01/oracle/oradata/ora11g/system01.dbf
BLOCK = 81524


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

--启动数据库测试
SQL&gt; startup
ORACLE instance started.

Total System Global Area  230162432 bytes
Fixed Size                  1344088 bytes
Variable Size              88083880 bytes
Database Buffers          134217728 bytes
Redo Buffers                6516736 bytes
Database mounted.
Database opened.
SQL&gt; col owner for a5
SQL&gt; select OWNER,INDEX_NAME,TABLE_NAME,status from dba_indexes where index_name='IND_T_XIFENFEI';

OWNER INDEX_NAME                     TABLE_NAME                     STATUS
----- ------------------------------ ------------------------------ --------
CHF   IND_T_XIFENFEI                 T_XIFENFEI                     UNUSABLE
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
