Use Dbms_repair to mark and skip bad blocks

Source: Internet
Author: User

Sql> Select file_id, block_id, blocks from dba_extents where owner = ' lilc ' and segment_name = ' TEST ';,,,,, 610624 1 024 611648 102483 rows selected.

Before destroying the data:

Sql> Select COUNT (*) from test;

COUNT (*)

----------

783018

Rman> Recover datafile 6 block 11620 clear;

Rman> Recover datafile 6 block 4467 clear;

rman> backup Check logical validate DataFile 6;

Starting backup at 23-sep-15

Using channel Ora_disk_1

Using channel Ora_disk_2

Channel ora_disk_1:starting full DataFile backup set

Channel ora_disk_1:specifying DataFile (s) in backup set

Input datafile file number=00006 name=+data/phub/datafile/llc01.dbf

Channel Ora_disk_1:backup set complete, elapsed time:00:00:07

List of Datafiles

=================

File Status Marked corrupt Empty Blocks Blocks examined high SCN

---- ------ -------------- ------------ --------------- ----------

6 FAILED 0 20 12800 1991935

File Name: +data/phub/datafile/llc01.dbf

Block Type Blocks failing Blocks processed

---------- -------------- ----------------

Data 2 12140

Index 0 329

Other 1 311

Validate found one or more corrupt blocks

See Trace FILE/U01/APP/ORACLE/DIAG/RDBMS/PHUB/PHUB/TRACE/PHUB_ORA_29666.TRC for details

Finished backup at 23-sep-15

Data query must be error:

Sql> Select COUNT (*) from test;

Select COUNT (*) from Test

*

ERROR at line 1:

Ora-01578:oracle data Block corrupted (file # 6, Block # 4467)

Ora-01110:data file 6: ' +DATA/PHUB/DATAFILE/LLC01.DBF '

Skip_corrupt_blocks to jump over bad blocks:

sql> exec dbms_repair.skip_corrupt_blocks (schema_name = ' Lilc ', object_name = ' TEST ', flags = 1);

PL/SQL procedure successfully completed.

Sql> Conn LILC/LILC;

Connected.

Sql> Select COUNT (*) from test;


COUNT (*)

----------

782884


There's 34 missing data.

Repairing bad blocks;

Rman> Recover datafile 6 block 11620

2>;

Starting recover at 23-sep-15

Using channel Ora_disk_1

Using channel Ora_disk_2

Finished standby search, restored 1 blocks

Starting Media recovery

Media recovery complete, elapsed time:00:00:01

Finished recover at 23-sep-15

Rman> Recover datafile 6 block 4467

Starting recover at 23-sep-15

Using channel Ora_disk_1

Using channel Ora_disk_2

Finished standby search, restored 1 blocks

Starting Media recovery

Media recovery complete, elapsed time:00:00:01

Finished recover at 23-sep-15

Data OK:

Sql> Select COUNT (*) from test;


COUNT (*)

----------

783018


Use Dbms_repair to mark and skip bad blocks

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.