TEST
Powered by Blogger.
Responsive Ad
Responsive Ad

Author Profile

About Me

Start Sharing

Start Sharing

Drive Traffic on Social Platforms

Blog Archive

Blog Journey

Blog Journey

Learn how to start a perfect Blog

Work Smart, Not Hard - Let's See

Make your Blogging experience faster and easiest …
Work Smart, Not Hard - Let's See
Design by - Blogger Templates | Distributed by Free Blogger Templates

Made with Love by

Material UI Template is Designed Theme for Giving Enhanced look Various Features are available Whic…

Random Posts

Ads Section

HOME > > Recovery from Block Corruption

Recovery from Block Corruption

Anup - Thursday, 19 May 2011

Recovery from block corruption

It is possible to recover corrupted blocks using RMAN backups. This is a somewhat exotic scenario, but it can be useful in certain circumstances, as illustrated by the following example. Here's the situation: a user connected to SQLPlus gets a data block corruption error when she queries a table. Here's a part of the session transcript:

Step 1 SQL> conn scott/anup123;
Connected.

Step 2 SQL> create table test(id number);
Table created.

Step 3 SQL> insert into test values(1);
1 row created.

SQL> commit;
Commit complete.

Step 4 SQL> select * from test;
ID
---------
1

Step 5 Check header block.

SQL> conn / as sysdba
Connected.

SQL>  select header_block from dba_segments where segment_name='TEST';

HEADER_BLOCK
------------
395

SQL>

Step 6 use dd commands for block corruption.

dd of=/DB/ANUP/users01.dbf bs=8192 conv=notrunc seek=395<< EOF
> testing corruption
> EOF
0+1 records in
0+1 records out

Step 7 ALTER SYSTEM FLUSH BUFFER_CACHE;
System altered.

Step 8  select * from test;

select * from test
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 395)
ORA-01110: data file 4: '/DB/ANUP/users01.dbf'

Step 9 Now connect to the RMAN and recover the data block (not the whole datafile or database) using BLOCKRECOVER command as follows:

RMAN> blockrecover datafile 4 block 395;
Starting blockrecover at 28-MAR-10
…………….
……………
…………..
Finished blockrecover at 28-MAR-10
RMAN> exit

Connect to SQL*Plus and query the table:

SQL> SELECT * FROM test;
ID
1

SQL>

Contact me

Get in Touch

Need to get touch with me? Please fill out the form with your enquiry.

Name
Anup Srivastav
Address
Lucknow - Utter Pradesh
Email
myindiandba@gmail.com
Message me