myserver> sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.4.0 - Production on Fri May 20 08:29:27 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> BEGIN
DBMS_REPAIR.ADMIN_TABLES (
TABLE_NAME => 'REPAIR_TABLE',
TABLE_TYPE => dbms_repair.repair_table,
ACTION => dbms_repair.create_action,
TABLESPACE => 'USERS');
END;
/
PL/SQL procedure successfully completed.
SQL> exit;
myserver> nohup sqlplus '/ as sysdba' @check.sql &
[1] 12263522
myserver> Sending nohup output to nohup.out.
myserver> tail -f nohup.out
SQL*Plus: Release 10.2.0.4.0 - Production on Fri May 20 08:29:27 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
number corrupt: 0
PL/SQL procedure successfully completed.
SQL> exit;
myserver> cat check.sql
SET SERVEROUTPUT ON
DECLARE num_corrupt INT;
BEGIN
num_corrupt := 0;
DBMS_REPAIR.CHECK_OBJECT (
SCHEMA_NAME => 'MYSCHEMA',
OBJECT_NAME => 'MYTABLE',
REPAIR_TABLE_NAME => 'REPAIR_TABLE',
CORRUPT_COUNT => num_corrupt);
DBMS_OUTPUT.PUT_LINE('number corrupt: ' || TO_CHAR (num_corrupt));
END;
/
exit;
Como puedes ver, de acuerdo con el mensaje del procedimiento no hay bloques corruptos (number corrupt: 0), y si creaste la tabla de reparación justo antes de correr el procedimiento DBMS_REPAIR.CHECK_OBJECT entonces estará vacía también. Quizás notaste que decidí crear un script SQL (check.sql) y correrlo con nohup; si tienes una tabla muy grande y una conexión no muy buena al servidor de bases de datos, podría ser buena idea ejecutar el procedimiento con el comando nohup.
myserver> sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.4.0 - Production on Fri May 20 08:29:27 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from REPAIR_TABLE;
no rows selected
SQL> BEGIN
DBMS_REPAIR.ADMIN_TABLES (
TABLE_NAME => 'REPAIR_TABLE',
TABLE_TYPE => dbms_repair.repair_table,
ACTION => dbms_repair.drop_action);
END;
/
PL/SQL procedure successfully completed.
SQL> exit;
Y si no tienes suerte y tienes una tabla con bloques corruptos, asegúrate de revisar la documentación de Oracle y entender qué significa reparar una tabla con corrupción de bloques.
No hay comentarios.:
Publicar un comentario