Use the bbed Copy command to simulate damage to Oracle data blocks

Source: Internet
Author: User

Many of the experiments in Oracle are carried out in the case of damage to specific blocks.

The common DD command can only specify blocks from block 1th to how many blocks, and cannot specify a specific block

Similar to the following command, this is the first block of system01.dbf Clear 0 operation

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

If you just clean up block No. 520 and clear only one specific block, there's no way to do it.

You can then use the bbed Copy command, such as copy number 20th of file 2nd to block No. 520 of file 1th, to simulate a specific bad damage operation

Bbed>Copy file 2 block 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>

Abnormal shutdown, open again will be reported in Block No. 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

How to recover, if there is a backup, you can use Blockrecover datafile 1 block 520; command to recover the specified block of the specified data file

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

This article is from the "Do not forget Beginner's mind Oracle" blog, please be sure to keep this source http://136018.blog.51cto.com/126018/1792047

Use the bbed Copy command to simulate damage to Oracle data blocks

Related Article

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.