Oracle PL/SQL/System Packages/DBMS REPAIR

Материал из SQL эксперт
Перейти к: навигация, поиск

dbms_repair.create_action

 
SQL>
SQL> BEGIN
  2     DBMS_REPAIR.ADMIN_TABLES (
  3     TABLE_NAME => "REPAIR_TABLE",
  4     TABLE_TYPE => dbms_repair.repair_table,
  5     ACTION => dbms_repair.create_action,
  6     TABLESPACE => "USERS");
  7  END;
  8   /



dbms_repair.orphan_table

 
SQL>
SQL>
SQL> BEGIN
  2   DBMS_REPAIR.ADMIN_TABLES (
  3   TABLE_NAME => "ORPHAN_KEY_TABLE",
  4   TABLE_TYPE => dbms_repair.orphan_table,
  5   ACTION => dbms_repair.create_action,
  6   TABLESPACE => "USERS");
  7  END;
  8  /

SQL>
SQL>
SQL>



Using the DBMS_REPAIR.CHECK_OBJECT Procedure

 
SQL>
SQL> DECLARE num_corrupt INTEGER;
  2  BEGIN
  3  num_corrupt := 0;
  4  DBMS_REPAIR.CHECK_OBJECT(
  5  schema_name => "HR",
  6  object_name => "EMP",
  7  repair_table_name => "REPAIR_TABLE",
  8  corrupt_count => num_corrupt);
  9  END
 10  /
END



Using the DBMS_REPAIR.FIX_CORRUPT_BLOCKS Procedure

 
SQL>
SQL> DECLARE num_fix INTEGER;
  2  BEGIN
  3  num_fix := 0;
  4  DBMS_REPAIR.FIX_CORRUPT_BLOCKS(
  5  schema_name => "HR",
  6  object_name => "EMP",
  7  object_type => dbms_repair.table_object,
  8  repair_table_name => "REPAIR_TABLE",
  9  fix_count => num_fix);
 10  END;
 11  /