1.SQL>create tablespace test02 datafile ‘/oradata/ora11/test02.dbf’ size 10M;
2.create table lerry.a tablespace test02 as select * from dba_object;
3.备份数据文件 test02.dbf (test02.dbf.bak)
由于测试 环境没有开启archivelog 只能shutdown db 然后备份数据文件再startup
4..编辑bbed参数文件par.txt
Cat par.txt
blocksize=8192
listfile=filelist.txt
mode=edit
cat filelist.txt
6 /oradata/ora11/test02.dbf 104857607
7 /oradata/ora11/test02.dbf.bak 104857607
Select file_id,file_name,bytes from dba_data_files;
5.. [oracle@STCS oradata]$ bbed parfile=par.txt
Password:blockedit
BBED: Release 2.0.0.0.0 - Limited Production on Tue Dec 20 15:09:17 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set file 6
FILE# 6
BBED> show
FILE# 6
BLOCK# 1
OFFSET 0
DBA 0x01800001 (25165825 6,1)
FILENAME /oradata/ora11/test02.dbf
BIFILE bifile.bbd
LISTFILE filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
BBED> modify 1000 file 6 block 168
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /oradata/ora11/test02.dbf (6)
Block: 168 Offsets: 0 to 511 Dba:0x018000a8
------------------------------------------------------------------------
03e80000 a8008001 497f1700 00000204 05df0000 01000000 24220100 387f1700
00000000 03003201 a0008001 ffff0000 00000000 00000000 00000000 00800000
387f1700 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00014e00
ffffae00 2e048003 80030000 4e00241f ce1e731e 1e1ec41d 701d171d be1c601c
081cab1b 5b1b061b b71a631a 0f1ab619 63190b19 b0185018 f6179717 4617f016
a0164b16 f915a215 5115fb14 a3144614 ef139313 3f13e612 93123b12 e8119011
3e11e710 8a102810 cc0f6b0f 130fb60e 5f0e030e a90d4a0d ef0c8f0c 310cce0b
6f0b0b0b b30a560a fd099f09 4009dc08 7c081708 c3076a07 1507bb06 5d06fa05
9b053705 dd047e04 2e040000 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> verify
DBVERIFY - Verification starting
FILE = /oradata/ora11/test02.dbf
BLOCK = 168
Block 168 is corrupt
Corrupt block relative dba: 0x018000a8 (file 0, block 168)
Bad header found during verification
Data in bad block:
type: 3 format: 0 rdba: 0x018000a8
last change scn: 0x0000.00177f49 seq: 0x2 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x7f490602
check value in block header: 0xdf05
computed block checksum: 0x4a05
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 1
Total Blocks Influx : 0
Message 531 not found; product=RDBMS; facility=BBED
查看table lerry.a
SQL> select count(*) from lerry.a;
COUNT(*)
----------
72220
SQL> alter system flush buffer_cache;
System altered.
SQL> select count(*) from lerry.a;
select count(*) from lerry.a
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 6, block # 168)
ORA-01110: data file 6: '/oradata/ora11/test02.dbf'
然后修复
BBED> set file 7
FILE# 7
BBED> show
FILE# 7
BLOCK# 168
OFFSET 0
DBA 0x01c000a8 (29360296 7,168)
FILENAME /oradata/ora11/test02.dbf.bak
BIFILE bifile.bbd
LISTFILE filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
BBED> copy file 7 block 168 to file 6 block 168
File: /oradata/ora11/test02.dbf (6)
Block: 168 Offsets: 0 to 511 Dba:0x018000a8
------------------------------------------------------------------------
06a20000 a8008001 497f1700 00000204 05df0000 01000000 24220100 387f1700
00000000 03003201 a0008001 ffff0000 00000000 00000000 00000000 00800000
387f1700 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00014e00
ffffae00 2e048003 80030000 4e00241f ce1e731e 1e1ec41d 701d171d be1c601c
081cab1b 5b1b061b b71a631a 0f1ab619 63190b19 b0185018 f6179717 4617f016
a0164b16 f915a215 5115fb14 a3144614 ef139313 3f13e612 93123b12 e8119011
3e11e710 8a102810 cc0f6b0f 130fb60e 5f0e030e a90d4a0d ef0c8f0c 310cce0b
6f0b0b0b b30a560a fd099f09 4009dc08 7c081708 c3076a07 1507bb06 5d06fa05
9b053705 dd047e04 2e040000 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> verify
DBVERIFY - Verification starting
FILE = /oradata/ora11/test02.dbf
BLOCK = 168
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
BBED>quit
SQL> select count(*) from lerry.a;
COUNT(*)
----------
72220
bbed是直接对数据块的操作,oracle 官方推荐尽量少用,如果一不小心可能玩火自焚!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24849178/viewspace-714122/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24849178/viewspace-714122/