dbms_repair包:
检查,修复在表和索引上损坏的数据块;
–1,admin_tables
/*
该过程提供了管理 修复表 和 孤表 的功能
table_name –{加前缀ORPHAN,REPAIR }
table_type –{dbms_repair.ORPHAN_TABLE ,dbms_repair.REPAIR_TABLE}
action – {dbms_repair.CREATE_ACTION;
dbms_repair.PURGE_ACTION;
dbms_repair.DROP_ACTION;}
tablespace –表所在的空间
*/
dbms_repair.admin_tables(
table_name => ,
table_type => ,
action => ,
tablespace =>
);
–建立了REPAIR_TABLE表(修复表)
begin
dbms_repair.admin_tables(
‘REPAIR_TABLE’,
dbms_repair.REPAIR_TABLE,
dbms_repair.CREATE_ACTION,
‘SYSTEM’);
end;
select * from REPAIR_TABLE;
–2,check_object
/*
该过程检查特定的对象,并将损坏信息写到修复表中去;
*/
dbms_repair.check_object(
schema_name => ,
object_name => ,
partition_name => ,
object_type => ,
repair_table_name =>
);
–3,dump_orphan_keys
/*
该过程用于报告指南损坏数据块的 索引入口,
并会将相应的索引入口消息写到孤表中去;
key_count –返回索引入口的个数
*/
dbms_repair.dump_orphan_keys(
schema_name => ,
object_name => ,
partition_name => ,
object_type => ,
orphan_table_name =>,
key_count => out
);
–4,fix_corrupt_blocks
/*
该过程用于修复数据块;这些数据块是在 check_object之后生成的;
fix_count –修复数据块的个数
*/
dbms_repair.fix_corrupt_blocks(
schema_name => ,
object_name => ,
partition_name => ,
object_type => ,
repair_table_name => ,
fix_count => out
);
–5,rebuild_freelists
/*
用于重建指定对象的空闲空间
*/
dbms_repair.rebuild_freelists(
schema_name => ,
object_name => ,
partition_name => ,
object_type =>
);
–6,skip_corrupt_blocks
/*
用于指定在扫描对象时跳过损坏块
flag –{
dbms_repair.SKIP_FLAG;
dbms_repair.NOSKIP_FLAG;
}
*/
dbms_repair.skip_corrupt_blocks(
schema_name => ,
object_name => ,
object_type => ,
flags =>
);
–7,segment_fix_status
/*
修复 位图入口的损坏;
*/
dbms_repair.segment_fix_status(
,segment_owner => ,
segment_name => ,
segment_type => ,
file_number => ,
block_number => ,
partition_name => –指定分区名
);