使用BBED COPY命令,類比oracle資料區塊的損壞

來源:互聯網
上載者:User

標籤:oracle bbed rman

oracle裡很多實驗都是在特定塊的損壞的情況下進行的。

 

常用的dd命令, 只能指定從1號塊到多少個塊,並不能指定一個特定的塊

 

類似下面的命令,這是對system01.dbf第一號塊作清零操作

dd if=/dev/zero of=/u01/app/oracle/oradata/orcl/system01.dbf bs=8192 count=1

如果只是對第520號塊作清除操作,只清除一個特定塊的話,就沒辦法了

 

這時可以使用bbed的copy命令,如拷貝2號檔案的20號塊到1號檔案的520號塊,即可類比對特定壞的損壞操作

BBED> copy file 2 block 20 to file 1 block 520
 File: /u01/app/oracle/oradata/orcl/system01.dbf (1)
 Block: 520              Offsets:    0 to  511           Dba:0x00400208
------------------------------------------------------------------------
 1ea20000 14008000 4f070000 00000104 8b800000 02000000 80c08300 00000000
 00000000 00f80000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 <32 bytes per line>

 

 

異常關閉,再次開啟就會報520號塊出錯的問題了

 

SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 1269366784 bytes
Fixed Size                  2252864 bytes
Variable Size            1040191424 bytes
Database Buffers          218103808 bytes
Redo Buffers                8818688 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-01578: ORACLE data block corrupted (file # 1, block # 520)
ORA-01110: data file 1: ‘/u01/app/oracle/oradata/orcl/system01.dbf‘
Process ID: 1961
Session ID: 1 Serial number: 5


SQL> exit

 

 

 

如何恢複呢,如果有備份,可以使用blockrecover datafile 1 block 520;命令來恢複指定資料檔案的指定塊

 

RMAN> blockrecover datafile 1 block 520;

Starting recover at 23-JUN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00001
channel ORA_DISK_1: reading from backup piece /home/oracle/ora-datafile1.bak
channel ORA_DISK_1: piece handle=/home/oracle/ora-datafile1.bak tag=TAG20160623T020307
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:01

Finished recover at 23-JUN-16

RMAN> alter database open;

database opened

RMAN> exit

本文出自 “不忘初心Oracle” 部落格,請務必保留此出處http://136018.blog.51cto.com/126018/1792047

使用BBED COPY命令,類比oracle資料區塊的損壞

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.