暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

truncate操作消除ORACLE SEG坏块深入解析

数据库技术笔记 2021-02-04
275

1. 内容概述

    本文主要测试oracle seg中存在坏块,truncate操作后坏块是否能够消除,主要测试以下内容,
1、truncate操作后哪些情况坏块可以消除?
2、truncate操作后哪些情况坏块不可以消除?
3、truncate操作后坏块未消除分哪些情况,如何处理消除坏块?
复制

2. 测试结果

1、当segment中有坏块时,如果坏块为位图块(段头块(Blocktype=23)、L2(Blocktype=21)、L1(Blocktype=20)),无论该坏块是否在第一个extent,oracle自动"初始化"该坏块,坏块状态消除。
2、当segment中有坏块时,如果坏块为数据块(Blocktype=06)并且坏块位于第一个extent(EXTENT_ID=0),该坏块会被保留在第一个extent中,可通过move table消除该坏块。
3、当segment中有坏块时,如果坏块为数据块(Blocktype=06)并且坏块位于非第一个extent(EXTENT_ID!=0),该坏块会被回收dba_free_space中空闲块,块状态依然marked corrupt,
可通过创建测试表,埋数的方式从dba_free_space中获取该空闲块,测试表获取该块后块状态依然marked corrupt,可通过move table消除该坏块。extent 自动扩展规律如下所示,
BLOCKS COUNT(1)
---------- ----------
8 16
128 63
1024 120
8192 7
4、如果坏块为数据块(Blocktype=06)并且坏块位于第一个extent(EXTENT_ID=0),truncate该表后,块状态依然marked corrupt,通过埋数推高 HWM方式,坏块依然存在,通过move table消除该坏块。
复制

3. 模拟第一个extent L1/L2/段头块/数据块 4个坏块

create table t1 tablespace users as select * from dba_tables;

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T1%' order by extent_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 0 7 344 8
T1 1 7 352 8
T1 2 7 360 8
T1 3 7 368 8
T1 4 7 376 8
T1 5 7 384 8
T1 6 7 392 8
T1 7 7 400 8
T1 8 7 408 8
T1 9 7 416 8
T1 10 7 424 8
T1 11 7 432 8
T1 12 7 440 8
T1 13 7 448 8
T1 14 7 456 8

15 rows selected.

SQL


[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 09:31:25 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf


DBVERIFY - Verification complete

Total Pages Examined : 115472
Total Pages Processed (Data) : 114642
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 706
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 109
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2266995 (0.2266995)
[oracle@oracle8 bbed]$


[oracle@oracle8 bbed]$ ./l_bbed.sh

BBED: Release 2.0.0.0.0 - Limited Production on Mon Nov 23 09:31:55 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set dba 7,344
DBA 0x01c00158 (29360472 7,344)

BBED> d
File: /oradata/STAR/users01.dbf (7)
Block: 344 Offsets: 0 to 511 Dba:0x01c00158
------------------------------------------------------------------------
20a20000 5801c001 b48b2200 00000304 bd320000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 04000000 ffffffff 00000000 03000000 10000000
02000000 00000000 00000000 00000000 00000000 10000000 00000000 00000000
00000000 00000000 00000000 00000000 5901c001 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 a0020000
201e0100 bd232100 00000000 5801c001 08000000 00000000 6001c001 08000000
08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 11111111 11111111 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> set dba 7,345
DBA 0x01c00159 (29360473 7,345)

BBED> d
File: /oradata/STAR/users01.dbf (7)
Block: 345 Offsets: 0 to 511 Dba:0x01c00159
------------------------------------------------------------------------
21a20000 5901c001 39962200 00000204 e9900000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 5a01c001 3d020000 05000000 35020000 00000000
00000000 00000000 201e0100 03000000 00000000 5801c001 01000100 6801c001
01000100 7801c001 01000100 8801c001 01000100 9801c001 01000100 a801c001
01000100 b801c001 01000100 c801c001 01000100 80004001 01000100 81004001
01000100 0002c001 01000100 0102c001 01000100 00014001 01000100 01014001
01000100 8002c001 01000100 8102c001 01000100 80014001 01000100 81014001
01000100 0003c001 01000100 0103c001 01000100 00024001 01000100 01024001
01000100 8003c001 01000100 8103c001 01000100 80024001 01000100 81024001
01000100 0004c001 01000100 0104c001 01000100 00034001 01000100 01034001
01000100 8004c001 01000100 8104c001 01000100 80034001 01000100 81034001
01000100 0005c001 01000100 0105c001 01000100 00044001 01000100 01044001
01000100 8005c001 01000100 8105c001 01000100 80044001 01000100 81044001
01000100 0006c001 01000100 0106c001 01000100 00054001 01000100 01054001
01000100 80054001 01000100 81054001 01000100 00064001 01000100 01064001

<32 bytes per line>

BBED> set dba 7,346
DBA 0x01c0015a (29360474 7,346)

BBED> d
File: /oradata/STAR/users01.dbf (7)
Block: 346 Offsets: 0 to 511 Dba:0x01c0015a
------------------------------------------------------------------------
23a20000 5a01c001 09972200 00000d04 30a20000 00000000 00000000 00000000
00000000 01000000 08000000 9c0a0000 01000000 00040000 00040000 80c0c101
00000000 01000000 00000000 61d50100 05001f00 3a040000 01000000 1a000000
20000000 80000000 20034001 00000000 1a000000 00000000 a0050000 00034001
83bcc101 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 01000000 00200000 00000000 34140000
00000000 5901c001 01000000 83bcc101 5901c001 00000000 00000000 00000000
00000000 00000000 01000000 00000000 201e0100 00000012 5801c001 08000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> set dba 7,347
DBA 0x01c0015b (29360475 7,347)

BBED> d
File: /oradata/STAR/users01.dbf (7)
Block: 347 Offsets: 0 to 511 Dba:0x01c0015b
------------------------------------------------------------------------
06a20000 5b01c001 50972200 00000104 e7650000 01000000 221e0100 48972200
00800000 03003200 5801c001 ffff0000 00000000 00000000 00000000 00800080
48972200 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00011400
ffff3a00 0704cd03 cd030000 1400211e c11c631b 041aa818 4a17e815 85142613
ca116810 080fa90d 470ce90a 87092308 c8066f05 07040000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED>

BBED> corrupt dba 7,344
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.

BBED> corrupt dba 7,345
corrupt dba 7,346
corrupt dba 7,347Block marked media corrupt.

BBED> Block marked media corrupt.

BBED>
Block marked media corrupt.

BBED>
BBED>
BBED>

BBED> corrupt dba 7,344
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.

BBED> corrupt dba 7,345
corrupt dba 7,346
corrupt dba 7,347Block marked media corrupt.

BBED> Block marked media corrupt.

BBED>
Block marked media corrupt.

BBED>
BBED>
BBED>



[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 07:06:04 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> truncate table T1;

Table truncated.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 07:06:27 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29360475, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 640
Total Pages Processed (Data) : 166
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 397
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 61
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2168917 (0.2168917)
[oracle@oracle8 bbed]$
[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 09:34:45 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> alter table t1 move;

Table altered.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 09:34:54 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29360475, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 115472
Total Pages Processed (Data) : 114641
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 706
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 109
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2267678 (0.2267678)
[oracle@oracle8 bbed]$

复制

4. 模拟非第一个extent,数据块损坏

SQL>  set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T1%';SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 0 7 464 8
T1 1 7 472 8 <--7,472
T1 2 7 480 8
T1 3 7 488 8
T1 4 7 496 8
T1 5 7 504 8
T1 6 7 512 8
T1 7 7 520 8
T1 8 7 528 8
T1 9 7 536 8
T1 10 7 544 8
T1 11 7 552 8
T1 12 7 560 8
T1 13 7 568 8
T1 14 7 576 8

15 rows selected.

SQL>


[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 07:13:06 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> truncate table t1;

Table truncated.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 07:13:17 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29360600, already marked corrupt <-- file 7,472


DBVERIFY - Verification complete

Total Pages Examined : 640
Total Pages Processed (Data) : 276
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 287
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 61
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2169230 (0.2169230)
[oracle@oracle8 bbed]$


SQL> select file_id,block_id,blocks from dba_free_space where file_id=7 and block_id<=472 and 472<=block_id+blocks;

FILE_ID BLOCK_ID BLOCKS
---------- ---------- ----------
7 472 168

SQL>



SQL> set line 200
col file_name for a60
col AUTOEXTENSIBLE for a20
select file_id,file_name,AUTOEXTENSIBLE,bytes/1024/1024 from dba_data_files;SQL> SQL> SQL>

FILE_ID FILE_NAME AUTOEXTENSIBLE BYTES/1024/1024
---------- ------------------------------------------------------------ -------------------- ---------------
1 /oradata/STAR/system01.dbf YES 910
3 /oradata/STAR/sysaux01.dbf YES 590
7 /oradata/STAR/users01.dbf YES 13.75
4 /oradata/STAR/undotbs01.dbf YES 345

SQL> alter database datafile 7 autoextend off;

Database altered.

SQL>



##########session1:
SQL> insert into t1 select * from dba_tables;

2179 rows created.

SQL> commit;

Commit complete.

SQL> select file_id,block_id,blocks from dba_free_space where file_id=7 and block_id<=472 and 472<=block_id+blocks;

FILE_ID BLOCK_ID BLOCKS
---------- ---------- ----------
7 472 168

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T1%';SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 0 7 464 8
T1 1 7 344 8
T1 2 7 352 8
T1 3 7 360 8
T1 4 7 368 8
T1 5 7 376 8
T1 6 7 384 8
T1 7 7 392 8
T1 8 7 400 8
T1 9 7 408 8
T1 10 7 416 8
T1 11 7 424 8
T1 12 7 432 8
T1 13 7 440 8
T1 14 7 448 8

15 rows selected.

SQL> ^C^H^H^C

SQL> insert into t1 select * from dba_tables;

2179 rows created.

SQL> commit;

Commit complete.

SQL> insert into t1 select * from dba_tables;

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /

2179 rows created.

SQL> /
insert into t1 select * from dba_tables
*
ERROR at line 1:
ORA-01653: unable to extend table SYS.T1 by 128 in tablespace USERS


SQL> select file_id,block_id,blocks from dba_free_space where file_id=7 and block_id<=472 and 472<=block_id+blocks;

FILE_ID BLOCK_ID BLOCKS
---------- ---------- ----------
7 472 40

SQL> create table t2 tablespace users as select * from dba_users;

Table created.

SQL> select file_id,block_id,blocks from dba_free_space where file_id=7 and block_id<=472 and 472<=block_id+blocks;

no rows selected

SQL> select owner,file_id,segment_name,segment_type,block_id,blocks from dba_extents
where file_id=7 and block_id<= 472 and (block_id + blocks -1)>= 472; 2

OWNER SEGMENT_NAME SEGMENT_TYPE FILE_ID BLOCK_ID BLOCKS
---------- ---------- ------------------------------------------------------------ -------------
SYS T2 TABLE 7 472 8


SQL> alter table t2 move;

Table altered.

SQL>



###### session2:
SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T1%';SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 0 7 464 8
T1 1 7 344 8
T1 2 7 352 8
T1 3 7 360 8
T1 4 7 368 8
T1 5 7 376 8
T1 6 7 384 8
T1 7 7 392 8
T1 8 7 400 8
T1 9 7 408 8
T1 10 7 416 8
T1 11 7 424 8
T1 12 7 432 8
T1 13 7 440 8
T1 14 7 448 8
T1 15 7 456 8
T1 16 7 512 128

17 rows selected.

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 0 7 464 8
T1 1 7 344 8
T1 2 7 352 8
T1 3 7 360 8
T1 4 7 368 8
T1 5 7 376 8
T1 6 7 384 8
T1 7 7 392 8
T1 8 7 400 8
T1 9 7 408 8
T1 10 7 416 8
T1 11 7 424 8
T1 12 7 432 8
T1 13 7 440 8
T1 14 7 448 8
T1 15 7 456 8
T1 16 7 512 128
T1 17 7 640 128
T1 18 7 768 128
T1 19 7 896 128
T1 20 7 1024 128
T1 21 7 1152 128
T1 22 7 1280 128
T1 23 7 1408 128
T1 24 7 1536 128

25 rows selected.

SQL>



#### session3:
[oracle@oracle8 ~]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 07:25:53 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29360600, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 1760
Total Pages Processed (Data) : 1287
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 238
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 219
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2169694 (0.2169694)
[oracle@oracle8 ~]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 07:26:42 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29360600, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 1760
Total Pages Processed (Data) : 1287
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 238
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 219
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2169694 (0.2169694)
[oracle@oracle8 ~]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 07:29:01 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29360600, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 1760
Total Pages Processed (Data) : 1287
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 238
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 219
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2169960 (0.2169960)
[oracle@oracle8 ~]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 07:30:40 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf


DBVERIFY - Verification complete

Total Pages Examined : 1760
Total Pages Processed (Data) : 1285
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 241
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 219
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2170061 (0.2170061)
[oracle@oracle8 ~]$

复制


5. 模拟非第一个extent,L1为坏块时

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T1%' order by file_id,block_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 0 7 352 8

SQL>
SQL>
SQL> insert into t1 select * from dba_tables;

2181 rows created.

SQL> /

2181 rows created.

SQL> /

2181 rows created.

SQL> commit;

Commit complete.

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T1%' order by file_id,block_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T1 16 5 640 128
T1 1 7 344 8
T1 0 7 352 8
T1 2 7 360 8
T1 3 7 368 8
T1 4 7 376 8
T1 5 7 384 8
T1 6 7 392 8
T1 7 7 400 8
T1 8 7 408 8
T1 9 7 416 8
T1 10 7 424 8
T1 11 7 432 8
T1 12 7 440 8
T1 13 7 448 8
T1 14 7 456 8
T1 15 7 464 8
T1 17 7 896 128

18 rows selected.

SQL>

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ ./l_bbed.sh

BBED: Release 2.0.0.0.0 - Limited Production on Mon Nov 23 09:57:57 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set dba 7,896
DBA 0x01c00380 (29361024 7,896)

BBED> d
File: /oradata/STAR/users01.dbf (7)
Block: 896 Offsets: 0 to 511 Dba:0x01c00380
------------------------------------------------------------------------
20a20000 8003c001 9f9c2200 00001804 d79f0000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 04000000 ffffffff 00000000 02000000 40000000
01000100 00000000 00000000 00000000 00000000 40000000 dfccbb5f dfccbb5f
00000000 00000000 00000000 00000000 6101c001 0a000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 a0020000
241e0100 209a2200 00000000 8003c001 40000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 11111111 11111111 11111111 11111111 11111111
11111111 11111111 11111111 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED>
BBED> CORRUPT
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.

BBED> exit

[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 09:58:57 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf

DBV-00200: Block, DBA 29361024, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 115472
Total Pages Processed (Data) : 114642
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 705
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 109
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2268485 (0.2268485)
[oracle@oracle8 bbed]$

[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 09:59:17 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> truncate table t1;

Table truncated.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/users01.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 09:59:25 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/users01.dbf


DBVERIFY - Verification complete

Total Pages Examined : 115472
Total Pages Processed (Data) : 114642
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing (Index): 0
Total Pages Processed (Other): 706
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 109
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2268561 (0.2268561)
[oracle@oracle8 bbed]$
复制

6. 模拟第二个L2为坏块时

create tablespace tt datafile '/oradata/STAR/test2.dbf' size 1024M
extent management local uniform size 40K;

create table t_l2 tablespace tt as select * from dba_objects;

begin
for i in 1 .. 100000 loop
insert into t_l2 select * from dba_objects;
commit;
end loop;
end;
/

SQL> create table t_l2 tablespace tt as select * from dba_objects;
create table t_l2 tablespace tt as select * from dba_objects
*
ERROR at line 1:
ORA-00955: name is already used by an existing object


SQL> drop table t_l2;

Table dropped.

SQL> create table t_l2 tablespace tt as select * from dba_objects;

Table created.

SQL> begin
for i in 1 .. 100000 loop
insert into t_l2 select * from dba_objects;
commit;
end loop;
end;
/ 2 3 4 5 6 7
begin
*
ERROR at line 1:
ORA-01653: unable to extend table SYS.T_L2 by 5 in tablespace TT
ORA-06512: at line 3


SQL>


SQL> alter system dump datafile 8 block 10;

System altered.

SQL> select * from v$diag_info;


set linesize 200 pagesize 2000
col owner for a20
col segment_name for a30
col partition_name for a30
select owner,segment_name,partition_name,HEADER_FILE,header_block from dba_segments where SEGMENT_NAME='T_L2';


Second Level Bitmap block DBAs
--------------------------------------------------------
DBA 1: 0x02000009
DBA 2: 0x02012ed9




[oracle@sourcedb bbed]$ ora_rdba 0x02012ed9
*******Welcome to use ora_rdba tool authored by orastar.*******
*******weixin: xidoublestar*******
rdba is: 0x2012ed9
datafile# is: 8
datablock is: 77529
dump command:alter system dump datafile 8 block 77529;
[oracle@sourcedb bbed]$

[oracle@oracle8 bbed]$ ./l_bbed.sh

BBED: Release 2.0.0.0.0 - Limited Production on Mon Nov 23 09:01:51 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set dba 8,77529
DBA 0x02012ed9 (33631961 8,77529)

BBED> d
File: /oradata/STAR/test2.dbf (8)
Block: 77529 Offsets: 0 to 511 Dba:0x02012ed9
------------------------------------------------------------------------
21a20000 d92e0102 49a22100 00000204 42960000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 0a000002 f8010000 01000000 f7010000 00000000
00000000 00000000 1e1e0100 03000000 00000000 d82e0102 01000100 282f0102
01000100 782f0102 01000100 c82f0102 01000100 18300102 01000100 68300102
01000100 b8300102 01000100 08310102 01000100 58310102 01000100 a8310102
01000100 f8310102 01000100 48320102 01000100 98320102 01000100 e8320102
01000100 38330102 01000100 88330102 01000100 d8330102 01000100 28340102
01000100 78340102 01000100 c8340102 01000100 18350102 01000100 68350102
01000100 b8350102 01000100 08360102 01000100 58360102 01000100 a8360102
01000100 f8360102 01000100 48370102 01000100 98370102 01000100 e8370102
01000100 38380102 01000100 88380102 01000100 d8380102 01000100 28390102
01000100 78390102 01000100 c8390102 01000100 183a0102 01000100 683a0102
01000100 b83a0102 01000100 083b0102 01000100 583b0102 01000100 a83b0102
01000100 f83b0102 01000100 483c0102 01000100 983c0102 01000100 e83c0102
01000100 383d0102 01000100 883d0102 01000100 d83d0102 01000100 283e0102

<32 bytes per line>

BBED> CORRUPT
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.

BBED> exit

[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test2.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 09:02:52 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test2.dbf

DBV-00200: Block, DBA 33631961, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 131072
Total Pages Processed (Data) : 92133
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1254
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 37684
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2202423 (0.2202423)
[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 09:03:09 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> truncate table t_l2;

Table truncated.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test2.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 09:03:45 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test2.dbf


DBVERIFY - Verification complete

Total Pages Examined : 131072
Total Pages Processed (Data) : 129332
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1740
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2262203 (0.2262203)
[oracle@oracle8 bbed]$

复制

7. 当dba_free_space中有坏块,重新分配给SEG后

create tablespace tt2 datafile '/oradata/STAR/test3.dbf' size 100M autoextend on;

create table t_auto tablespace tt2 as select * from dba_objects;

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T_AUTO%' order by file_id,block_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T_AUTO 0 9 128 8
T_AUTO 1 9 136 8
T_AUTO 2 9 144 8
T_AUTO 3 9 152 8
T_AUTO 4 9 160 8
T_AUTO 5 9 168 8
T_AUTO 6 9 176 8
T_AUTO 7 9 184 8
T_AUTO 8 9 192 8
T_AUTO 9 9 200 8
T_AUTO 10 9 208 8
T_AUTO 11 9 216 8
T_AUTO 12 9 224 8
T_AUTO 13 9 232 8
T_AUTO 14 9 240 8
T_AUTO 15 9 248 8
T_AUTO 16 9 256 128
T_AUTO 17 9 384 128
T_AUTO 18 9 512 128
T_AUTO 19 9 640 128
T_AUTO 20 9 768 128
T_AUTO 21 9 896 128
T_AUTO 22 9 1024 128
T_AUTO 23 9 1152 128
T_AUTO 24 9 1280 128
T_AUTO 25 9 1408 128
T_AUTO 26 9 1536 128

27 rows selected.

SQL>


SQL> exit

[oracle@oracle8 bbed]$ ./l_bbed.sh

BBED: Release 2.0.0.0.0 - Limited Production on Mon Nov 23 10:06:33 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set dba 9,136
DBA 0x02400088 (37748872 9,136)

BBED> map /v
File: /oradata/STAR/test3.dbf (9)
Block: 136 Dba:0x02400088
------------------------------------------------------------
KTB Data Block (Table/Cluster)

struct kcbh, 20 bytes @0
ub1 type_kcbh @0
ub1 frmt_kcbh @1
ub2 wrp2_kcbh @2
ub4 rdba_kcbh @4
ub4 bas_kcbh @8
ub2 wrp_kcbh @12
ub1 seq_kcbh @14
ub1 flg_kcbh @15
ub2 chkval_kcbh @16
ub2 spare3_kcbh @18

struct ktbbh, 96 bytes @20
ub1 ktbbhtyp @20
union ktbbhsid, 4 bytes @24
struct ktbbhcsc, 8 bytes @28
sb2 ktbbhict @36
ub1 ktbbhflg @38
ub1 ktbbhfsl @39
ub4 ktbbhfnx @40
struct ktbbhitl[3], 72 bytes @44

struct kdbh, 14 bytes @124
ub1 kdbhflag @124
sb1 kdbhntab @125
sb2 kdbhnrow @126
sb2 kdbhfrre @128
sb2 kdbhfsbo @130
sb2 kdbhfseo @132
sb2 kdbhavsp @134
sb2 kdbhtosp @136

struct kdbt[1], 4 bytes @138
sb2 kdbtoffs @138
sb2 kdbtnrow @140

sb2 kdbr[63] @142

ub1 freespace[819] @268

ub1 rowdata[7101] @1087

ub4 tailchk @8188
BBED> CORRUPT
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.

BBED> exit

[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 10:07:08 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf

DBV-00200: Block, DBA 37748872, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 12800
Total Pages Processed (Data) : 1405
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 11393
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2270205 (0.2270205)
[oracle@oracle8 bbed]$

[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 10:08:07 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> truncate table T_AUTO;

Table truncated.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Mon Nov 23 10:08:37 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf

DBV-00200: Block, DBA 37748872, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 12800
Total Pages Processed (Data) : 1405
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 46
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 11348
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2270332 (0.2270332)
[oracle@oracle8 bbed]$


#### session1:
insert into T_AUTO select * from dba_objects;

#### session2:
select file_id,block_id,blocks from dba_free_space where file_id=9;

SQL> set linesize 200 pagesize 9999
col owner for a20
col segment_name for a50
select owner,file_id,segment_name,segment_type,block_id,blocks from dba_extents
where file_id=9 and block_id<= 136 and (block_id + blocks -1)>= 136;SQL> SQL> SQL> 2

OWNER FILE_ID SEGMENT_NAME SEGMENT_TYPE BLOCK_ID BLOCKS
-------------------- ---------- -------------------------------------------------- ------------------------------------------------------ ---------- ----------
SYS 9 T_AUTO TABLE 136 8

SQL>

#### session1:
[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 24 00:59:23 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> insert into T_AUTO select * from dba_objects;

72400 rows created.

SQL> /

72400 rows created.

SQL> /

72400 rows created.

SQL> /

72400 rows created.

SQL> /

72400 rows created.

SQL> /

72400 rows created.

SQL> commit;

Commit complete.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Tue Nov 24 01:00:30 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf

DBV-00200: Block, DBA 37748872, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 12800
Total Pages Processed (Data) : 12517
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 282
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2301916 (0.2301916)
[oracle@oracle8 bbed]$

[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 24 01:02:08 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> alter table T_AUTO move;

Table altered.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Tue Nov 24 01:02:41 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf


DBVERIFY - Verification complete

Total Pages Examined : 19488
Total Pages Processed (Data) : 17563
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 275
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 1650
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2336737 (0.2336737)
[oracle@oracle8 bbed]$
复制

8. 推高水位消除坏块

[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 24 01:27:06 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> drop table t_auto;

Table dropped.

SQL> create table t_auto tablespace tt2 as select * from dba_objects;

Table created.

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T_AUTO%' order by file_id,block_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T_AUTO 0 9 128 8
T_AUTO 1 9 136 8
T_AUTO 2 9 144 8
T_AUTO 3 9 152 8
T_AUTO 4 9 160 8
T_AUTO 5 9 168 8
T_AUTO 6 9 176 8
T_AUTO 7 9 184 8
T_AUTO 8 9 192 8
T_AUTO 9 9 200 8
T_AUTO 10 9 208 8
T_AUTO 11 9 216 8
T_AUTO 12 9 224 8
T_AUTO 13 9 232 8
T_AUTO 14 9 240 8
T_AUTO 15 9 248 8
T_AUTO 16 9 256 128
T_AUTO 17 9 384 128
T_AUTO 18 9 512 128
T_AUTO 19 9 640 128
T_AUTO 20 9 768 128
T_AUTO 21 9 896 128
T_AUTO 22 9 1024 128
T_AUTO 23 9 1152 128
T_AUTO 24 9 1280 128
T_AUTO 25 9 1408 128
T_AUTO 26 9 1536 128

27 rows selected.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ ./l_bbed.sh

BBED: Release 2.0.0.0.0 - Limited Production on Tue Nov 24 01:28:35 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set dba 9,131
DBA 0x02400083 (37748867 9,131)

BBED> map /v
File: /oradata/STAR/test3.dbf (9)
Block: 131 Dba:0x02400083
------------------------------------------------------------
KTB Data Block (Table/Cluster)

struct kcbh, 20 bytes @0
ub1 type_kcbh @0
ub1 frmt_kcbh @1
ub2 wrp2_kcbh @2
ub4 rdba_kcbh @4
ub4 bas_kcbh @8
ub2 wrp_kcbh @12
ub1 seq_kcbh @14
ub1 flg_kcbh @15
ub2 chkval_kcbh @16
ub2 spare3_kcbh @18

struct ktbbh, 96 bytes @20
ub1 ktbbhtyp @20
union ktbbhsid, 4 bytes @24
struct ktbbhcsc, 8 bytes @28
sb2 ktbbhict @36
ub1 ktbbhflg @38
ub1 ktbbhfsl @39
ub4 ktbbhfnx @40
struct ktbbhitl[3], 72 bytes @44

struct kdbh, 14 bytes @124
ub1 kdbhflag @124
sb1 kdbhntab @125
sb2 kdbhnrow @126
sb2 kdbhfrre @128
sb2 kdbhfsbo @130
sb2 kdbhfseo @132
sb2 kdbhavsp @134
sb2 kdbhtosp @136

struct kdbt[1], 4 bytes @138
sb2 kdbtoffs @138
sb2 kdbtnrow @140

sb2 kdbr[68] @142

ub1 freespace[816] @278

ub1 rowdata[7094] @1094

ub4 tailchk @8188


BBED> CORRUPT
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.

BBED> exit

[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Tue Nov 24 01:29:17 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf

DBV-00200: Block, DBA 37748867, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 19488
Total Pages Processed (Data) : 17495
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 418
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 1574
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2339176 (0.2339176)
[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 24 01:29:22 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> truncate table T_AUTO;

Table truncated.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Tue Nov 24 01:29:39 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf

DBV-00200: Block, DBA 37748867, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 19488
Total Pages Processed (Data) : 17495
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 418
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 1574
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2339217 (0.2339217)
[oracle@oracle8 bbed]$
[oracle@oracle8 bbed]$
[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 24 01:29:45 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T_AUTO%' order by file_id,block_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T_AUTO 0 9 128 8

SQL> insert into t_auto select * from dba_objects;

72399 rows created.

SQL> /

72399 rows created.

SQL> commit;

Commit complete.

SQL> set linesize 200 pagesize 999
col segment_name for a60
select segment_name,extent_id,file_id,block_id,blocks from dba_extents where segment_name like 'T_AUTO%' order by file_id,block_id;SQL> SQL>

SEGMENT_NAME EXTENT_ID FILE_ID BLOCK_ID BLOCKS
------------------------------------------------------------ ---------- ---------- ---------- ----------
T_AUTO 0 9 128 8
T_AUTO 1 9 136 8
T_AUTO 2 9 144 8
T_AUTO 3 9 152 8
T_AUTO 4 9 160 8
T_AUTO 5 9 168 8
T_AUTO 6 9 176 8
T_AUTO 7 9 184 8
T_AUTO 8 9 192 8
T_AUTO 9 9 200 8
T_AUTO 10 9 208 8
T_AUTO 11 9 216 8
T_AUTO 12 9 224 8
T_AUTO 13 9 232 8
T_AUTO 14 9 240 8
T_AUTO 15 9 248 8
T_AUTO 16 9 256 128
T_AUTO 17 9 384 128
T_AUTO 18 9 512 128
T_AUTO 19 9 640 128
T_AUTO 20 9 768 128
T_AUTO 21 9 896 128
T_AUTO 22 9 1024 128
T_AUTO 23 9 1152 128
T_AUTO 24 9 1280 128
T_AUTO 25 9 1408 128
T_AUTO 26 9 1536 128
T_AUTO 27 9 1664 128
T_AUTO 28 9 1792 128
T_AUTO 29 9 1920 128
T_AUTO 30 9 2048 128
T_AUTO 31 9 2176 128
T_AUTO 32 9 2304 128
T_AUTO 33 9 2432 128
T_AUTO 34 9 2560 128
T_AUTO 35 9 2688 128
T_AUTO 36 9 2816 128
T_AUTO 37 9 2944 128

38 rows selected.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Tue Nov 24 01:30:40 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf

DBV-00200: Block, DBA 37748867, already marked corrupt


DBVERIFY - Verification complete

Total Pages Examined : 19488
Total Pages Processed (Data) : 17495
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 418
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 1574
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2339217 (0.2339217)
[oracle@oracle8 bbed]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 24 01:30:46 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> alter table t_auto move;

Table altered.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle8 bbed]$ dbv file=/oradata/STAR/test3.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Tue Nov 24 01:31:00 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/STAR/test3.dbf


DBVERIFY - Verification complete

Total Pages Examined : 19488
Total Pages Processed (Data) : 18381
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 415
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 692
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2339533 (0.2339533)
[oracle@oracle8 bbed]$
复制

9、说明

1、以上内容为个人多次测试结果,由于个人原因,如有分析不足之处还请见谅及指正;
2、文章涉及内容,请勿 在 生产 环境模拟 。
复制


文章转载自数据库技术笔记,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论