Block Recovery

Example scenario:

The data blocks contained in files can occasionally become corrupt, this scenario describes how to recover from this situation.

– The database is currently in Archivelog mode and there is a backup that can be used.

To simulate corruption of a datablock (or of bad sectors) use a hex editor to overwrite the numbers within the dbf with 0s.

RMAN (Recovery Manager) will then be used to try to fix this problem.

 

NOTE: A rman-03002 failure of backup plus archive log command indicates that archivelogs aren’t present in a system, this error message usually appears after the archivelogs have manually been deleted.

The following commands solve the issue.

First take a backup of the archivelogs and delete the originals. This prevents archivelogs from becoming too large.

 

This method only makes backups of the archives, the backups can be saved on portable drives such as usb flash disks.

The previous command backups the dbf files and prevents the archivelogs from becoming obsolete.

On the weekend, run the following

This way backups can be between weekends and the original files can then be deleted.

Creating a tablespace

Creating a table

Entering information into a table

Shutdown the database after the data entry. Using a hex editor open test01.dbf and overwrite numeric data with 0s (to simulate a corrupt file).

 

Restart the database

The database is able to retrieve the data where it can read it and where it can’t retrieve the data, it displays the following:

As the output shows, the 33rd block in file no. 6 is corrupt

Running the above command outputs a more specific error

This error could also be due to a bad sector (an actual physical error on the disk), alternatively could be due to 2 background processes simultaneously attempting to write to the same location.

Reviewing the alertlog would reveal more details about the error

The error in the alertORATR.log

Running the previous code would output the same error

The contents of test01.txt

 

Total Pages Marked Corrupt being 0 means that there are no issues on the database.

 

To repair the blocks. Note: the following blockrecover code is only applicable when there is an available backup.

 

Kategori seçin...