RMAN: Checking for Corruption in Data Files and Backups

RMAN Backup Checking
Андрей Волков

Андрей Волков

Системное, сетевое администрирование +DBA. И немного программист!))  Профиль автора.

You can use RMAN to check for corruption in data files, archive redo logs, and control files. You can also verify whether a backup set is restorable. The RMAN VALIDATE command is used to perform these types of integrity checks. There are three ways you can run the VALIDATE command:

  • VALIDATE
  • BACKUP...VALIDATE
  • RESTORE...VALIDATE

Image Note  The stand-alone VALIDATE command is available in Oracle 11g and higher. The BACKUP...VALIDATE and RESTORE...VALIDATE commands are available in Oracle 10g and higher.

The VALIDATE command can be used stand-alone to check for missing files or physical corruption in database data files, archive redo log files, control files, spfiles, and backup set pieces. For example, this command will validate all data files and the control files:

RMAN> validate database;

You can also validate just the control file, as follows:

RMAN> validate current controlfile;

You can validate the archive redo log files, like so:

RMAN> validate archivelog all;

You may want to combine all the prior integrity checks into one command, as shown:

RMAN> validate database include current controlfile plus archivelog;

Under normal conditions the VALIDATE command only checks for physical corruption. You can specify that you also want to check for logical corruption by using the CHECK LOGICAL clause:

RMAN> validate check logical database include current controlfile plus archivelog;

VALIDATE has a variety of uses. Here are a few more examples:

RMAN> validate database skip offline;

RMAN> validate copy of database;

RMAN> validate tablespace system;

RMAN> validate datafile 3 block 20 to 30;

RMAN> validate spfile;

RMAN> validate backupset <primary_key_value>;

RMAN> validate recovery area;

If you’re using the Oracle 12c pluggable database feature, you can validate specific databases within the container. While connected as SYS to the root container, validate any associated pluggable databases:

RMAN> validate pluggable database salespdb;

If RMAN detects any corrupt blocks, the V$DATABASE_BLOCK_CORRUPTION is populated. This view contains information on the file number, block number, and number of blocks affected. You can use this information to perform a block-level recovery (see Chapter 6 for more details).

Image Note  Physical corruption is a change to a block, such that its contents don’t match the physical format that Oracle expects. By default, RMAN checks for physical corruption when backing up, restoring, and validating data files. With logical corruption, a block is in the correct format, but the contents aren’t consistent with what Oracle expects, such as in a row piece or an index entry.

The BACKUP...VALIDATE command is very similar to the VALIDATE command, in that it can check to see if data files are available and if the data files contain any corrupt blocks; for example,

RMAN> backup validate database;

This command doesn’t actually create any backup files; it only reads the data files and checks for corruption. Like the VALIDATE command, BACKUP VALIDATE, by default, only checks for physical corruption. You can instruct it to check as well for logical corruption, as shown:

RMAN> backup validate check logical database;

Here are some variations of the BACKUP...VALIDATE command:

RMAN> backup validate database current controlfile;

RMAN> backup validate check logical database current controlfile plus archivelog;

Also like the VALIDATE command, BACKUP...VALIDATE will populate V$DATABASE_BLOCK_CORRUPTION if it detects any corrupt blocks. The information in this view can be used to determine which blocks can potentially be restored by block-level recovery (see Chapter 6 for more details).

The RESTORE...VALIDATE command is used to verify backup files that would be used in a restore operation. This command validates backup sets, data file copies, and archive redo log files:

RMAN> restore validate database;

No actual files are restored when using RESTORE...VALIDATE. This means that you can run the command while the database is online and available.

Вас заинтересует / Intresting for you:

RMAN: Using Online or Offline ...
RMAN: Using Online or Offline ... 1638 views Андрей Волков Sat, 29 Feb 2020, 10:01:33
RMAN: Specifying the Backup Us...
RMAN: Specifying the Backup Us... 2482 views Андрей Волков Sat, 29 Feb 2020, 10:14:03
RMAN: Backing UP Oracle Databa...
RMAN: Backing UP Oracle Databa... 927 views Андрей Волков Wed, 29 Sep 2021, 18:27:51
How to use RMAN for Stop/Start...
How to use RMAN for Stop/Start... 1925 views Андрей Волков Mon, 31 Jan 2022, 17:35:05
Comments (1)
This comment was minimized by the moderator on the site

Excellent cheat sheet for RMAN validate database!

apv
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations