Oracle bad block repair

Source: Internet
Author: User
Welcome to the Oracle community forum and interact with 2 million technical staff to go to 6.3BBED tool 7. How to Use dbms_repair to mark and skip Bad blocks, but when the data volume is large or 7*24, we use dbms_repair for processing. Dbms_repair is provided from oracle8i. Preparation: createtablespacebloc

Welcome to the Oracle community forum and interact with 2 million technicians> go to 6.3 BBED tool 7. How to Use dbms_repair to mark and skip Bad blocks, but when the data volume is large or 7*24, we use dbms_repair for processing. Dbms_repair is provided from oracle8i. Preparation: create tablespace bloc

Welcome to the Oracle community forum and interact with 2 million technical staff> enter

6.3 BBED Tool

7. How to Use dbms_repair to mark and skip Bad blocks

However, we use dbms_repair to process a large data volume or a 7*24 system. Dbms_repair is provided from oracle8i.

Preparations:

Create tablespace block datafile '/u01/block. dbf' size 5 M;

Create table DMM tablespace block as select * from all_tables;

Commit;

Create index indx_dmm on DMM (TABLE_NAME );

Select count (*) from DMM;

COUNT (*)

12896

. Create a management table:

SQL> conn sys/admin as sysdba;

Connected.

SQL> exec DBMS_REPAIR.ADMIN_TABLES ('repair _ table', 1, 1, 'users ');

PL/SQL procedure successfully completed

SQL> exec DBMS_REPAIR.ADMIN_TABLES ('orphan _ table', 2, 1, 'users ');

PL/SQL procedure successfully completed

. Check Bad blocks: dbms_repair.check_object

/* Formatted on 23:41:32 (QP5 v5.115.810.9015 )*/

Set serveroutput on;

DECLARE

Cc NUMBER;

BEGIN

DBMS_REPAIR.check_object (schema_name => 'sys ', -- note that the user name is used here.

Object_name => 'dmm ',

Corrupt_count => cc );

DBMS_OUTPUT.put_line (TO_CHAR (cc ));

END;

Normally, the input is 0.

If there are bad blocks, you can view the block corruption information in the created REPAIR_TABLE:

/* Formatted on 13:18:19 (QP5 v5.115.810.9015 )*/

SELECT object_name,

Relative_file_id,

Block_id,

Marked_corrupt,

Corrupt_description,

Repair_description,

CHECK_TIMESTAMP

FROM repair_table;

Note: In 8i, check_object only checks Bad blocks and marked_upt is false. Therefore, you need to perform Step 3: locate Bad blocks, fix_corrupt_blocks, and change marked_upt to true, at the same time, after updating CHECK_TIMESTAMP.9i, the value of MARKED_CORRUPT is marked as TRUE. So you can proceed directly to step 4.

7. 3. Locate the Bad Block: dbms_repair.fix_corrupt_blocks

Only when bad block information is written to the defined REPAIR_TABLE can the broken block be located.

/* Formatted on 13:29:01 (QP5 v5.115.810.9015 )*/

DECLARE

Cc NUMBER;

BEGIN

DBMS_REPAIR.fix_corrupt_blocks (schema_name => 'sys ',

Object_name => 'dmm ',

Fix_count => cc );

DBMS_OUTPUT.put_line (a => TO_CHAR (cc ));

END;

. Skip Bad blocks:

Although we have located Bad blocks before, if we access the table:

SQL> select count (*) from SYS. DMM;

ORA-01578: ORACLE data block corruption (file number 14, block number 154)

ORA-01110: Data File 14: 'd: \ BLOCK. dbf'

The error message is returned. Skip_corrupt_blocks is used to skip the broken blocks:

/* Formatted on 13:30:17 (QP5 v5.115.810.9015 )*/

Exec dbms_repair.skip_corrupt_blocks (schema_name => 'sys ', object_name => 'dmm', flags => 1 );

SQL> select count (*) from SYS. DMM;

COUNT (*)

12850

12896-12850 = 46 rows of data are lost.

7. 5. process the invalid key value on the index; dump_orphan_keys

/* Formatted on 13:34:55 (QP5 v5.115.810.9015 )*/

DECLARE

Cc NUMBER;

BEGIN

DBMS_REPAIR.dump_orphan_keys (schema_name => 'sys ',

Object_name => 'indx _ dmm ',

Object_type => 2,

Repair_table_name => 'repair _ table ',

Orphan_table_name => 'orphan _ table ',

Key_count => CC );

END;

[1] [2] [3] [4]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.