<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oracle - Concepts et Exemples &#187; bloc corrompu</title>
	<atom:link href="https://blog.developpez.com/pachot/tag/bloc-corrompu/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/pachot</link>
	<description>Les fonctionalités et concepts d&#039;Oracle à partir de traductions et de démos</description>
	<lastBuildDate>Sun, 03 Apr 2016 20:36:21 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Recovery cases: un bloc corrompu</title>
		<link>https://blog.developpez.com/pachot/recovery-cases-un-bloc-corrompu/</link>
		<comments>https://blog.developpez.com/pachot/recovery-cases-un-bloc-corrompu/#comments</comments>
		<pubDate>Sun, 24 Nov 2013 22:00:11 +0000</pubDate>
		<dc:creator><![CDATA[pachot]]></dc:creator>
				<category><![CDATA[Recovery Cases]]></category>
		<category><![CDATA[bloc corrompu]]></category>
		<category><![CDATA[RMAN]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/pachot/?p=1049</guid>
		<description><![CDATA[Recovery en cas de bloc corrompu. Au lieu de restaurer tout un datafile, on peut ne restaurer que les blocs corrompus. S&#8217;il y en a peu, c&#8217;est plus rapide et évite de mettre le datafile offline. Ici un exemple sur &#8230; <a href="https://blog.developpez.com/pachot/recovery-cases-un-bloc-corrompu/">Lire la suite <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Recovery en cas de bloc corrompu. Au lieu de restaurer tout un datafile, on peut ne restaurer que les blocs corrompus. S&rsquo;il y en a peu, c&rsquo;est plus rapide et évite de mettre le datafile offline.<br />
<span id="more-1049"></span><br />
Ici un exemple sur une base de demo créée <a href="http://blog.developpez.com/pachot/cas-de-recovery-en-12c/" title="Cas de recovery en 12c">ici</a>.</p>
<p>Voici les blocs qui stokent les données de OE.ORDERS:</p>
<pre>
RMAN&gt; select file_id,block_id,blocks from dba_extents where owner='OE' and segment_name='ORDERS';
using target database control file instead of recovery catalog
   FILE_ID   BLOCK_ID     BLOCKS
---------- ---------- ----------
         2        968          8
</pre>
<p>8 blocs alloués à partir du bloc 968. Je vais corrompre le bloc 971 en lui mettant des données aléatoires avec la commande dd, et je vérivie avec dbv:</p>
<pre>
+ dd if=/dev/urandom count=1 bs=8k seek=971 of=/u/DEMO/DATA/DEMO100/example01.dbf conv=notrunc
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00157981 s, 5.2 MB/s

+ dbv /u/DEMO/DATA/DEMO100/example01.dbf
DBVERIFY - Verification starting : FILE = /u/DEMO/DATA/DEMO100/example01.dbf
Page 971 is marked corrupt
Corrupt block relative dba: 0x028003cb (file 10, block 971)
Bad header found during dbv:
Data in bad block:
 type: 90 format: 3 rdba: 0xfd75bf2c
 last change scn: 0xd97e.9447efe5 seq: 0xc7 flg: 0x96
 spare1: 0x80 spare2: 0x4f spare3: 0x225f
 consistency value in tail: 0x767ce7f0
 check value in block header: 0xe831
 computed block checksum: 0x9a28
</pre>
<p>Le bloc est bien corrompu, d’où l’erreur suivante lors d&rsquo;un select:</p>
<pre>
RMAN&gt; alter system flush buffer_cache;
using target database control file instead of recovery catalog
Statement processed
RMAN&gt; select /*+ FULL(ORDERS) */ count(*) from OE.ORDERS;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 11/17/2013 20:16:06
ORA-01578: ORACLE data block corrupted (file # 2, block # 971)
ORA-01110: data file 2: '/u/DEMO/DATA/DEMO100/example01.dbf'
</pre>
<p>On va d&rsquo;abord tester Recovery Advisor:</p>
<h4>RMAN&gt; list failure;</h4>
<pre>
RMAN&gt; list failure;
using target database control file instead of recovery catalog
Database Role: PRIMARY

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
8098       HIGH     OPEN      17-NOV-13     Datafile 2: '/u/DEMO/DATA/DEMO100/example01.dbf' contains one or more corrupt blocks
</pre>
<h4>RMAN&gt; advise failure;</h4>
<pre>
RMAN&gt; advise failure;
Database Role: PRIMARY

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
8098       HIGH     OPEN      17-NOV-13     Datafile 2: '/u/DEMO/DATA/DEMO100/example01.dbf' contains one or more corrupt blocks

analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=378 device type=DISK
analyzing automatic repair options complete

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
no manual actions available

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Perform block media recovery of block 971 in file 2  
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u/DEMO/diag/rdbms/demo100/DEMO100/hm/reco_3695178258.hm
</pre>
<p>mais Recovery Advisor ne propose que le restore/recover du datafile entier.</p>
<p>Je vérifie d&rsquo;abord qu&rsquo;il n&rsquo;y a pas d&rsquo;autres blocs corrompus:</p>
<h4>RMAN&gt; validate datafile 2;</h4>
<pre>
RMAN&gt; validate datafile 2;
Starting validate at 17-NOV-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00002 name=/u/DEMO/DATA/DEMO100/example01.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2    FAILED 0              31954        45841           1913733   
  File Name: /u/DEMO/DATA/DEMO100/example01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              4534            
  Index      0              1219            
  Other      1              8133            

validate found one or more corrupt blocks
See trace file /u/DEMO/diag/rdbms/demo100/DEMO100/trace/DEMO100_ora_14863.trc for details
Finished validate at 17-NOV-13
</pre>
<h4>RMAN&gt; select * from v$database_block_corruption;</h4>
<pre>
RMAN&gt; select * from v$database_block_corruption;
     FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTIO     CON_ID
---------- ---------- ---------- ------------------ --------- ----------
         2        971          1                  0 CORRUPT            0
</pre>
<p>Un seul bloc, donc je préfère faire un BLOCKRECOVER:</p>
<h4>RMAN&gt; blockrecover datafile 2 block 971;</h4>
<pre>
RMAN&gt; blockrecover datafile 2 block 971;
Starting recover at 17-NOV-13
using channel ORA_DISK_1

channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00002
channel ORA_DISK_1: reading from backup piece /u/DEMO/backup/12op4mt1_1_1
channel ORA_DISK_1: piece handle=/u/DEMO/backup/12op4mt1_1_1 tag=TAG20131116T205457
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:15

starting media recovery

archived log for thread 1 with sequence 2 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_2_98hmq0s6_.arc
archived log for thread 1 with sequence 1 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_1_98hmwbsf_.arc
archived log for thread 1 with sequence 2 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_2_98hp41w7_.arc
archived log for thread 1 with sequence 3 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_3_98hpgdt4_.arc
archived log for thread 1 with sequence 4 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_4_98hpgd5z_.arc
archived log for thread 1 with sequence 5 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_5_98hpgdh8_.arc
archived log for thread 1 with sequence 1 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_1_98hr6zvl_.arc
archived log for thread 1 with sequence 2 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_2_98hr701w_.arc
archived log for thread 1 with sequence 3 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_3_98hr70cc_.arc
archived log for thread 1 with sequence 1 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_1_98hrcjy5_.arc
archived log for thread 1 with sequence 2 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_2_98hrck57_.arc
archived log for thread 1 with sequence 3 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_3_98hrckdn_.arc
archived log for thread 1 with sequence 1 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_16/o1_mf_1_1_98hrcrp5_.arc
archived log for thread 1 with sequence 2 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_17/o1_mf_1_2_98kwmzy5_.arc
archived log for thread 1 with sequence 3 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_17/o1_mf_1_3_98l3gos8_.arc
archived log for thread 1 with sequence 4 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_17/o1_mf_1_4_98l3xxyc_.arc
archived log for thread 1 with sequence 5 is already on disk as file /u/DEMO/FRA/DEMO100/archivelog/2013_11_17/o1_mf_1_5_98l5hjrn_.arc
media recovery complete, elapsed time: 00:00:15
Finished recover at 17-NOV-13
</pre>
<p>C&rsquo;est fait, on vérifie le datafile:</p>
<h4>RMAN&gt; validate datafile 2;</h4>
<pre>
RMAN&gt; validate datafile 2;
Starting validate at 17-NOV-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00002 name=/u/DEMO/DATA/DEMO100/example01.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2    OK     0              31954        45841           1913733   
  File Name: /u/DEMO/DATA/DEMO100/example01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              4535            
  Index      0              1219            
  Other      0              8132            

Finished validate at 17-NOV-13


</pre>
<p>Plus de corruption. On peut relancer la requête:
<pre>
</pre>
<h4>RMAN&gt; select /*+ FULL(ORDERS) */ count(*) from OE.ORDERS;</h4>
<pre>
RMAN&gt; select /*+ FULL(ORDERS) */ count(*) from OE.ORDERS;
  COUNT(*)
----------
       105
</pre>
<p><strong>La base est restée ouverte, le datafile est resté online.</strong><br />
C&rsquo;est le dépannage le plus rapide, malheureusement il n&rsquo;est pas proposé par Recovery Advisor.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
