如何使用DBMS_REPAIR检测和修补数据坏块
2008-11-10 12:58:38 来源:WEB开发网我们查询dba_objects,可以看到如下结果:
SQL> select owner, object_name, object_type
2 from dba_objects
3 where object_name like '%REPAIR_TABLE';
OWNER OBJECT_NAME OBJECT_TYPE
------------------------------------------------------------------
SYS DBA_REPAIR_TABLE VIEW
SYS REPAIR_TABLE TABLE
SQL>
SQL> -- Orphan Key Table
SQL>
SQL> declare
2 begin
3 -- Create orphan key table
4 dbms_repair.admin_tables (
5 table_type => dbms_repair.orphan_table,
6 action => dbms_repair.create_action,
7 tablespace => 'USERS'); -- 如果是使用SYS用户的缺省表空间,该项就不用指定
8 end;
9 /
PL/SQL procedure successfully completed.
我们查询dba_objects,可以看到如下结果:
SQL> select owner, object_name, object_type
2 from dba_objects
3 where object_name like '%ORPHAN_KEY_TABLE';
OWNER OBJECT_NAME OBJECT_TYPE
------------------------------------------------------------------
SYS DBA_ORPHAN_KEY_TABLE VIEW
SYS ORPHAN_KEY_TABLE TABLE
二、使用DBMS_REPAIR.CHECK_OBJECT进行检测
CHECK_OBJECT procedure检查指定的object,并且将关于损坏和修补的指导信息装入Repair Table。它将效验指定object中所有块的一致性。而在此之前已标识的块就会被跳过。
更多精彩
赞助商链接