第二问:我们可以使用下面语句从all_constraints视图中查看某表上的约束: SELECT constraint_name, table_name, r_owner, r_constraint_name FROM all_constraints WHERE table_name = 'table_name' and owner = 'owner_name';
第一问:首先需要找到坏块的ID(可以运行dbverify实现),假设为1234。运行下面的查询查找段名: select segment_name, segment_type, block_id, blocks from dba_extents where (1234 between block_id and (block_id + blocks - 1)); 一旦找到坏段名称,若段是一个表,则最好建立一个临时表,存放好的数据。若段是索引,则删除它,再重建。 create table good_table as select from bad_table where rowid not in ( select /+index(bad_table, any_index)/ rowid from bad_table where substr( rowid, 1, 8 ) = 1234)
select segment_name, segment_type, block_id, blocks
from dba_extents
where (1234 between block_id and (block_id + blocks - 1));
一旦找到坏段名称,若段是一个表,则最好建立一个临时表,存放好的数据。若段是索引,则删除它,再重建。
create table good_table
as
select from bad_table where rowid not in
( select /+index(bad_table, any_index)/ rowid
from bad_table where substr( rowid, 1, 8 ) = 1234)