You are hereBlogs / almudena's blog / Cómo provocar un bloque corrupto en BD baseadas en ASM e restaurar con RMAN a nivel de bloque

Cómo provocar un bloque corrupto en BD baseadas en ASM e restaurar con RMAN a nivel de bloque


By: almudena - Posted on: 12 April 2013

Detallo a continuación os pasos seguidos para provocar un bloque corrupto unha BD con ASM e levar a cabo unha restauración a nivel de bloque con RMAN. Elo é posible por estar traballando con unha BD Enterprise Edition. Mencionar tamén que se trata dun contorno de test.

           1. Creamos tablespace/usuario/táboa e procemento para insertar filas.             

 	    14:25:39 SYS@orcl1> create tablespace bad_data_test_acc;

 	    Tablespace created.


	    14:27:32 SYS@orcl1> select  file_name, file_id , tablespace_name from dba_data_files
	    14:27:42   2   where tablespace_name like '%BAD%';

         FILE_NAME					                                FILE_ID  TABLESPACE_NAME
         ----------------------------------------------------------- ---------- -------------------------------------------------------------------------
	    +DATA/orcl/datafile/bad_data_test_acc.342.812469967	        12      BAD_DATA_TEST_ACC

         create user acc identified by *****  default tablespace bad_data_test_acc; 
         create table test (username varchar2(9), password varchar2(6));
         
         DECLARE 
         u  VARCHAR2(9);
         p  VARCHAR2(6);
         
         BEGIN 
         FOR jump  IN 1 ..10000  LOOP 
         u := 'TEST'||jump; 
         p := 'P'||jump; 
         insert into test values (u,p);
         END LOOP; 
         commit;
         END; 
         / 

         2. Quedámonos cos datos que precisaremos para forzar a corrupción dun bloque.    

         select
         rowid ,
         to_number(utl_encode.base64_decode(utl_raw.cast_to_raw(lpad(substr(rowid, 1, 6), 8, 'A'))), 'XXXXXXXXXXXX') as objid,
         to_number(utl_encode.base64_decode(utl_raw.cast_to_raw(lpad(substr(rowid, 7, 3), 4, 'A'))), 'XXXXXX') as filenum,
         to_number(utl_encode.base64_decode(utl_raw.cast_to_raw(lpad(substr(rowid, 10, 6), 8, 'A'))), 'XXXXXXXXXXXX') as blocknum,
         to_number(utl_encode.base64_decode(utl_raw.cast_to_raw(lpad(substr(rowid, 16, 3), 4, 'A'))), 'XXXXXX') as rowslot
         from test where password='P7777'
         /
         ROWID OBJID FILENUM   BLOCKNUM    ROWSLOT
         ------------------ ---------- ---------- ---------- ----------
         AAARofAAMAAAACeAAr 72223       12 158     43         

          2. Lanzamos un backup RMAN da BD  que contén os últimos datos creados.   


          3. Poñemos o tablespace offline e pasámolo a fs empregando RMAN para elo.

     alter tablespace bad_data_test_acc offline;
   
     RMAN> copy datafile 12  to '/tmp/block_corruption/bad_data_01.dbf';
     
     Starting backup at 11/04/2013 14:26:27
     using target database control file instead of recovery catalog
         (...)
     channel ORA_DISK_7: SID=197 instance=orcl1 device type=DISK
     allocated channel: ORA_DISK_8
     channel ORA_DISK_8: SID=236 instance=orcl1 device type=DISK
     allocated channel: ORA_DISK_9
     channel ORA_DISK_9: SID=278 instance=orcl1 device type=DISK
     allocated channel: ORA_DISK_10
     channel ORA_DISK_10: SID=316 instance=orcl1 device type=DISK
     channel ORA_DISK_1: starting datafile copy
     input datafile file number=00012 name=+DATA/orcl/datafile/bad_data_test_acc.342.812469967
     output file name=/tmp/block_corruption/bad_data_01.dbf tag=TAG20130411T142632 RECID=1 STAMP=812471194
     channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03    

     4. Forzamos a corrupción no bloque.       

     [oracle@oracle block_corruption]$ dd if=/tmp/block_corruption/bad_data_01.dbf bs=8k count=158 of=/tmp/block_corruption/bad_data_01.dbf_new
     158+0 records in
     158+0 records out
     1294336 bytes (1.3 MB) copied, 0.00493063 s, 263 MB/s
   
     [oracle@oracle block_corruption]$ dd if=/tmp/block_corruption/bad_data_01.dbf bs=8k count=1 >> /tmp/block_corruption/bad_data_01.dbf_new
     1+0 records in
     1+0 records out
     8192 bytes (8.2 kB) copied, 0.000112149 s, 73.0 MB/s
   
     [oracle@oracle block_corruption]$ dd if=/tmp/block_corruption/bad_data_01.dbf bs=8k skip=159 >> /tmp/block_corruption/bad_data_01.dbf_new
     12642+0 records in
     12642+0 records out
     103563264 bytes (104 MB) copied, 0.374947 s, 276 MB/s
     [oracle@oracle block_corruption]$
     
     mv /tmp/block_corruption/bad_data_01.dbf_new  /tmp/block_corruption/bad_data_01.dbf

       5. Copiamos os datos do datafile de fs a ASM de novo con RMAN.

         run {
         set maxcorrupt for datafile 12 to 2;
         restore datafile 12 from tag 'TAG20130411T142632';
         recover datafile 12;
         }
         channel ORA_DISK_1: restoring datafile 00012
         input datafile copy RECID=1 STAMP=812471194 file name=/tmp/block_corruption/bad_data_01.dbf
         destination for restore of datafile 00012: +DATA/orcl/datafile/bad_data_test_acc.342.812469967
         channel ORA_DISK_1: copied datafile copy of datafile 00012
         output file name=+DATA/orcl/datafile/bad_data_test_acc.342.812469967 RECID=0 STAMP=0
         Finished restore at 11/04/2013 14:35:41
        
         Starting recover at 11/04/2013 14:35:41
         using channel ORA_DISK_1
         using channel ORA_DISK_2
         using channel ORA_DISK_3
         using channel ORA_DISK_4
         using channel ORA_DISK_5
         using channel ORA_DISK_6
         using channel ORA_DISK_7
         using channel ORA_DISK_8
         using channel ORA_DISK_9
         using channel ORA_DISK_10
        
         starting media recovery
         media recovery complete, elapsed time: 00:00:01
        
         Finished recover at 11/04/2013 14:35:42
              

       6. Poñemos tablespace online e comprobamos que temos o bloque corrupto.

        alter tablespace bad_data_test_acc online;
        14:36:39 ACC@orcl1> select * from test where password='P7777';
         select * from test where password='P7777'
                       *
         ERROR at line 1:
         ORA-01578: ORACLE data block corrupted (file # 12, block # 158)
         ORA-01110: data file 12: '+DATA/orcl/datafile/bad_data_test_acc.342.812469967'
        
         14:37:38 SYS@orcl1> select * from v$database_block_corruption;
        
              FILE#     BLOCK#   BLOCKS CORRUPTION_CHANGE# CORRUPTIO
         ---------- ---------- ---------- ------------------ ---------
         12   158        1   0 CORRUPT
        
        
         [oracle@oracle log]$ rman target /
         Recovery Manager: Release 11.2.0.3.0 - Production on Thu Apr 11 14:37:58 2013
        
         Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
        
         connected to target database: orcl (DBID=1700599633)
        
         RMAN> backup check logical validate tablespace bad_data_test_acc;
        
         Starting backup at 11/04/2013 14:38:42
         using target database control file instead of recovery catalog
         allocated channel: ORA_DISK_1
         channel ORA_DISK_1: SID=471 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_2
         (...)
         allocated channel: ORA_DISK_9
         channel ORA_DISK_9: SID=236 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_10
         channel ORA_DISK_10: SID=278 instance=orcl1 device type=DISK
         channel ORA_DISK_1: starting full datafile backup set
         channel ORA_DISK_1: specifying datafile(s) in backup set
         input datafile file number=00012 name=+DATA/orcl/datafile/bad_data_test_acc.342.812469967
         channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
         List of Datafiles
         =================
         File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
         ---- ------ -------------- ------------ --------------- ----------
         12   OK     1              12641        12800           356051175
           File Name: +DATA/orcl/datafile/bad_data_test_acc.342.812469967
           Block Type Blocks Failing Blocks Processed
           ---------- -------------- ----------------
           Data       0              27             
           Index      0              0              
           Other      0              132            
        
         Finished backup at 11/04/2013 14:38:48
        
         RMAN>      

       7. Restauramos a nivel de bloque con rman.   

         [oracle@oracle log]$ rman target /
        
         Recovery Manager: Release 11.2.0.3.0 - Production on Thu Apr 11 14:40:36 2013
        
         Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
        
         connected to target database: orcl (DBID=1700599633)
        
         RMAN> recover datafile 12 block 158;
        
         Starting recover at 11/04/2013 14:40:44
         using target database control file instead of recovery catalog
         allocated channel: ORA_DISK_1
         channel ORA_DISK_1: SID=471 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_2
         channel ORA_DISK_2: SID=626 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_3
         channel ORA_DISK_3: SID=665 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_4
         channel ORA_DISK_4: SID=939 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_5
         channel ORA_DISK_5: SID=120 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_6
         channel ORA_DISK_6: SID=159 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_7
         channel ORA_DISK_7: SID=198 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_8
         channel ORA_DISK_8: SID=236 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_9
         channel ORA_DISK_9: SID=278 instance=orcl1 device type=DISK
         allocated channel: ORA_DISK_10
         channel ORA_DISK_10: SID=316 instance=orcl1 device type=DISK
        
         channel ORA_DISK_1: restoring block(s) from datafile copy /tmp/block_corruption/bad_data_01.dbf
         ORA-19587: error occurred reading 8192 bytes at block number 0
         ORA-27069: attempt to do I/O beyond the range of the file
         Additional information: 1
         Additional information: 12801
         ORA-19600: input file is datafile copy 0 (/tmp/block_corruption/bad_data_01.dbf)
        
         failover to previous backup
        
         channel ORA_DISK_1: restoring block(s)
         channel ORA_DISK_1: specifying block(s) to restore from backup set
         restoring blocks of datafile 00012
         channel ORA_DISK_1: reading from backup piece +FRA/orcl/backupset/2013_04_11/nnndf0_tag20130411t141520_0.473.812470521
         channel ORA_DISK_1: piece handle=+FRA/orcl/backupset/2013_04_11/nnndf0_tag20130411t141520_0.473.812470521 tag=TAG20130411T141520
         channel ORA_DISK_1: restored block(s) from backup piece 1
         channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01
        
         starting media recovery
         media recovery complete, elapsed time: 00:00:07
        
         Finished recover at 11/04/2013 14:40:58         

      8. Comprobamos que xa non hai bloques corruptos na BD.

         14:42:55 ACC@orcl1> select * from test where password='P7777';
        
         USERNAME  PASSWO
         --------- ------
         TEST7777  P7777
        
         14:42:00 ACC@orcl1> select * from v$database_block_corruption;
        
         no rows selected
        
         14:42:08 ACC@orcl1> exit
Share this

does lyrica get you high lyrica and gabapentin high lyrica 75 mg high

is there an over the counter version of flagyl flagyl serve para corrimento blastocystis hominis flagyl dose

glucophage et iode metformin cambridge diet acetaminophen metformin interaction

Hardcore Galleries with hot Hardcore photos
http://lesbiantubes.relayblog.com/?julianne

teen porn in thongs porn clips for cell phone free porn video with squirting black lesbian porn mobile homemade vergin porn

Jaylen waddle s ankle injury isn t overly severe dolphins wr
http://monica.furth.a4ktube.com/?parker-rocio

two girls and a cup porn norma stiltz porn vids renamon and rika porn mums get bumed porn amateur porn swap

Girls of Desire: All babes in one place, crazy, art
http://allsexynaked.xblognetwork.com/?joana

fetish ebony porn brazilian milf porn porn actors belladonna hailey jade audition porn babe news misa campo porn

Hardcore Galleries with hot Hardcore photos
http://hopeharrisporn.allproblog.com/?bailey

swedish porn stars fat women fuck little girl porn porn games avatar funny games sagging pussy porn title of porn riley war machine

Mamma mia chaturbate nude cam porn videos camhoes tv
https://xxx-hd-pron.sexjanet.com/?kelli-kaylie

toms house porn porn winter olympics wank porn 2010 jelsoft enterprises ltd rape outdoor movies porn outdoor teens peeing outdoors porn

My queer experience at a resort designed for straight couples
https://viky-stuttgart.relayblog.com/?aliza-maeve

free cartoom porn flash skanky slut porn free streaming stepmom porn uk ebony porn largest labia porn

Japanese club porn japanese party japanese drink videos spankbang
https://nude-comics-darryl.moesexy.com/?berenice-myra

great porn for girls matere porn toon porn naruto lesben porn stars henatia 3d porn

Barely legal 17 very taboo and explicit older man younger
https://youngandold-durham.gigixo.com/?jayden-madilyn

the piano tuner porn ps1 porn rawtube porn nearly porn sammie sparks porn tube

Pdf perceptions on agriculture among freshmen students at
https://prob-potsdam.topanasex.com/?janelle-piper

lesbian moms length porn tube porn youth family guy porn gallery hottest naked girls strip tease porn chad lee porn

Pornhub s parentpany admits to profiting from sex trafficking
https://private-chat.miaxxx.com/?erin-dulce

kathey lee porn free japanese porn uncensored exploited secretary and porn free animal porn sights surfers private porn free

Rick savage matchups iafd internet adult film database
https://headshotikouwais.moesexy.com/?jade-monique

tony com gay porn porn red tub mature gothic porn military porn movies porn stories justin bieber

Hermaphrodite stacy nichols fucks ron jeremy tubepornclassic
https://jarred.moesexy.com/?abagail-araceli

porn rpg gams buttfuck porn porn brenn wyson bisexual jocks porn beata supermodel porn satr

Jazz duro matchups iafd internet adult film database
https://infedele-infedele.miyuhot.com/?ashtyn-piper

gay thing porn free porn german movies 3d anime porn torrent free thin porn movies largest free porn thumbnails

Ukrainian porn actress battles to win asylum in eu the times
https://hourstodate.amandahot.com/?jaylyn-raven

cartoon porn ned flanders amiture porn sites the most beutiful porn pokemon porn quiz safe porn program clea clips

Three of the biggest porn sites must verify ages to protect kids
https://payforsex-whenissturgisbikeweek.allproblog.com/?karly-michelle

litte girl nude homemade porn girl tosses salad porn bree olson porn videos biggest pussy in porn free daily porn pics clips

Wife interracial sex porn movies 291 943 tube galore
https://coolfbprofilepics.fetlifeblog.com/?reanna-eileen

backroom casting couch porn safe free seymore butts porn best free adult porn candy samples porn star mature tv porn

Young girls in swimsuits are undressed after stock photo
https://paint-referrers.moesexy.com/?elisa-marlee

porn sexy naked japanese black oiled porn porn retard 2008 jelsoft enterprises ltd teen girls holloween porn qwerty innocent porn

Porn categories xxx free porntube sex videos youporn
https://ramonville-perfect.allproblog.com/?annabelle-alycia

porn for sex addiction classic big tit porn free old over sized porn stars public extreme porn deleted porn videos

Twink movies xxx teen gay boys porfn twinkmovies xxx
https://downhillps2game-sexysexstoryinhindi.amandahot.com/?rayna-kaia

lindsay simon porn barbi twins porn jizz tube porn renee rhea porn movies previews porn cam

Different strokes recap live in front of a studio audience tvline
https://apicale-like.alexysexy.com/?penelope-alanna

biggest porn tube archive fran dresher porn movie free porn movies cartoons plumkin porn videos straight movies on line porn

12 sexually explicit movies to watch on hulu cinemablend
http://sextreffen.blacks-blonde.moesexy.com/?elaina-anne

blindside porn axenic teen does porn free ebony ts porn porn big tites ariah sexton porn photo

Simon rex confirms meghan markle story on twitter this is true
http://markus-von.anhalt.bogeyman.instasexyblog.com/?kelsey-colleen

anima porn moive chinese sick porn milton twins porn video disney mp4 porn operator please porn scandal

Hardcore Galleries with hot Hardcore photos
http://seypornposes.relayblog.com/?janessa

porn old fuckers set toys porn golden girls porn porn teen blond hard corn porn free video

Ver pelicula online - https://blog.libero.it/wp/veronlinegratispelicula/2019/09/16/ad-astra-ve...

Ad Astra cine
Ad Astra Hasta las estrellas pelicula completa
Ad Astra cine 4
Ad Astra Hasta las estrellas peliculas
Ad Astra Hasta las estrellas ver película online
Ad Astra Hasta las estrellas ver pelicula
Ad Astra Hasta las estrellas descargar peliculas gratis
Ad Astra ver peliculas online gratis
Ad Astra descargar película gratis
Ad Astra Hasta las estrellas youtube película
Ad Astra Hasta las estrellas película completa en mexicana
Ad Astra pelicula mexicanas
Ad Astra Hasta las estrellas pelicula cristianas
Ad Astra Hasta las estrellas descargar película
Ad Astra película infantiles
Ad Astra pelicula en chilena
Ad Astra película online hd
Ad Astra pelicula fox
Ad Astra Hasta las estrellas si cine
Ad Astra pelicula 24
Ad Astra cine
Ad Astra Ver película
Ad Astra Ver película online
Ad Astra Hasta las estrellas Ver pelicula online
Ad Astra ver pelicula gratis
Ad Astra ver pelicula latino
Ad Astra Hasta las estrellas ver mexicana
Ad Astra Hasta las estrellas Ver pelicula català
Ad Astra Hasta las estrellas ver pelicula galego
Ad Astra ver cine euskara
Ad Astra Hasta las estrellas y descargar películas gratis
Ad Astra Hasta las estrellas y descargar peliculas
Ad Astra película online gratis
Ad Astra Hasta las estrellas en linea película chilena
Ad Astra Hasta las estrellas pelicula latino online
Ad Astra Hasta las estrellas pelicula completa

Citrate dosage buy tadalafil cheap cialis online cialis original buy online generic cialis

Best Nude Playmates & Centerfolds, Beautiful galleries daily updates
http://dancporn.allproblog.com/?allison

porn long legs sandals porn syar keisha mike 2008 dog porn new world record porn porn movey

Pornhub isn t blocked in russia following the invasion of ukraine
http://apptoblockpornsites.bestsexyblog.com/?madilyn-brandy

lopes porn nickelodeon porn movies zaza porn french swinger party porn tubes home xxx porn

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Image CAPTCHA
Enter the characters shown in the image.