Oracle RMAN Administration
Master RMAN for efficient Oracle database backup and recovery.
We will be looking at various ways in which we can use Oracle RMAN utility and configure different options available for a DBA.
Configure RMAN Default Channels
The CONFIGURE CHANNEL.. Command is used to set values for automatic channel
RMAN> CONFIGURE CHANNLE DEVICE TYPE DISK
Defining a default backup files name format
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT =ì/u01/backup/my_db_backup_%Uî;
To clear configurations
RMAN> CONFIGURE DEVICE TYPE DISK CLEAR;
RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR;
Validate RMAN Backups
How would you feel if you trigger an RMAN restore and later realized that if failed? RMAN allows you to validate backups without even actually restoring from the backups.
You can validate latest database backup or a particular data file or even a data block
RMAN> validate database;RMAN> validate backupset 22;
RMAN> validate datafile 5 block 2;
Add channels to speedup the validation process
run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
validate database;
}
Check Physical or Logical DB Corruptions
RMAN> backup validate database archivelog all;
RMAN> backup validate check logical database archivelog all;
Validate Backups Before Restore
RMAN> restore database validate;
RMAN> restore archivelog all validate;
RMAN Default Device Type
RMAN provides you with default configuration parameters to setup backup device type. You can change these settings via below commands
RMAN> show device type;
RMAN> CONFIGURE DEFAULT DEVICE TYPE DISK;
RMAN> CONFIGURE DEFAULT DEVICE TYEP DISK PARALLELISM 2;
This parameter can be over-written within RMAN run block
Taking Compressed RMAN Backup
You can take a compressed RMAN backup to save disk space with RMAN
RMAN> backup as compressed backupset database plus archivelog;
Configure Default Compression
RMAN> configure device type disk parallelism 1 backup type to compressed backupset;
RMAN Repair Block Corruption
DBAs have to sometimes deal with corrupted data blocks inside database. RMAN can come handy to repair those corrupted data blocks. Below query gives us list of corrupted blocks
COLUMN owner FORMAT A20COLUMN segment_name FORMAT A30SELECT DISTINCT owner, segment_name
FROM v$database_block_corruption dbc
JOIN dba_extents e ON dbc.file# = e.file_id AND dbc.block# BETWEEN e.block_id and e.block_id+e.blocks-1ORDER BY 1,2;
Assume that block 121 under datafile 3 is corrupted. Use below command to repair the data block
RMAN> blockrecover datafile 3 block 121;
Other Block Repair Methods
Full DB recovery
Individual datafile recovery
Drop table and restore if from previous export