如何使用DBMS_REPAIR检测和修补数据坏块
2008-11-10 12:58:38 来源:WEB开发网四、使用DBMS_REPAIR.FIX_CORRUPT_BLOCKS来标识坏块
FIX_CORRUPT_BLOCKS procedure用来根据repair table中的信息修正指定objects中的坏块。当这个块被标识为坏了以后,做全表扫描将引起ORA-1578错。
SQL> declare
2 fix_count int;
3 begin
4 fix_count := 0;
5 dbms_repair.fix_corrupt_blocks (
6 schema_name => 'SYSTEM',
7 object_name => 'T1',
8 object_type => dbms_repair.table_object,
9 repair_table_name => 'REPAIR_TABLE',
10 fix_count => fix_count);
11 dbms_output.put_line('fix count: ' || to_char(fix_count));
12 end;
13 /
fix count: 1
PL/SQL procedure successfully completed.
查询repair_table可以看到block 3已经被标识:
SQL> select object_name, block_id, marked_corrupt
2 from repair_table;
OBJECT_NAME BLOCK_ID MARKED_COR
------------------------------ ---------- ----------
T1 3 TRUE
这时再对table t1做全表扫描,ORA-1578将会出现。
SQL> select * from system.t1;
select * from system.t1
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 6, block # 3)
ORA-01110: data file 6: '/tmp/ts_corrupt.dbf'
五、使用DBMS_REPAIR.DUMP_ORPHAN_KEYS来修补相关的index
更多精彩
赞助商链接