- What is Rman
- Why use Rman
- Understanding The Rman Architecture
- Taking Backup in Non archive Backup Mode
- Taking Backup in archive Mode
- Enhancement in 10g For Rman
What is Rman?
Recovery Manager is a tool that manages the process of creating backup and also
manages the process of restoring and recovering them.
In addition to RMAN repository records, the recovery catalog can also hold RMAN stored
scripts, sequences of RMAN commands for common backup tasks. Centralized storage
of scripts in recovery catalog can be more convenient than working with command files
Why use Rman ?
- No Extra Costs.. It is available free.
- RMAN introduced in Oracle 8 it has become simpler with new version and easier than user managed backups.
- Proper Security
- You are 100% sure your database has been backed up .
- It contains details of backup taken in the central repository
- Facility of Testing validity of backups also command like cross check to check the status of backup.
- Oracle 10g has got further optimized incremental backups with has resulted in improvement of performance during backup and recovery time
- Parrallel operation are supported
- Better Querying facility for knowing different details of backup.
- No Extra redo generated when backup is taken. compared to online backup
- Without rman.which results in saving of space in hard disk.
- RMAN is an intelligent tool
- Maintains repository of backup metadata.
- Remembers backup locations
- Knows what needs backup set locations
- Knows what needs to be backed up
- Knows what is required for recovery
- Know what backups are redundant
- It handles database corruptions
Understanding The Rman Architecture
An Oracle Rman comprises of
- RMAN Executable - This could be present and fired even from client side
- Target Databases - This is the database which needs to be backed up
- Recovery Catalog - Recovery Catalog is optional otherwise backup backup details are stored in target database control file.It is a repository of information queried and updated by Recovery Manager. It contains information on Physical schema of Target Database data file and archive log, backup sets and pieces
Recovery Catalog is a must in following scenarios
- In order to store scripts
- For Table space Point in time recovery
Media Management Software
Media management software is a must if you are using RMAN for storing backup in
tape drive directly
Backups in Rman
Oracle backup in RMAN are the following type
These backup are of RMAN proprietary nature.
- RMAN complete backup
- RMAN incremental backup
- Image copy
The advantage of image copy is it is not in RMAN proprietary format
Backup Format
RMAN backup is not in oracle format but in RMAN format. Oracle backup comprises of backup sets and consists of backup pieces Backup sets are logical entity. In Oracle 9i it gets stored in default locations
There are two type of backup sets
- Datafile backup sets,
- Archivelog Backup sets
One more important point of data file backup sets is it do not include empty blocks,
A backup set will contain many backup pieces. A single backup piece consists of physical files which are in RMAN proprietary format.
Backups in Rman
Oracle Backup in RMAN are the following type
- Backup sets ;
- Image Copy
Example of Using Backup Using Rman.
Taking RMAN backup
In non archive mode in $ prompt type
]$ RMAN
- You get the RMAN prompt
RMAN > Connect Target /
Connect to target database : dharam < Dbid= 129283912>
Using target database controlfile instead of recovery catalog
Let us take a simple backup of database in Non Archive Mode
RMAN > Shutdown immediate; - Shutdown The database;
RMAN > Startup mount;
RMAN > Backup database; -- This starts backing the database
RMAN > sql 'Alter database open' ;
We can fire the same commands in archive log mode And whole of datafiles will be backed
RMAN > Backup database plus archivelog;
Restoring Database
Restoring database has been made very simple in 9i .
It is just
RMAN >restore database;
Rman is intelligent to identify which dataifiles has to be restored and the locations of backed up
file.
Oracle Enhancement for Rman in 10g
- Flash Recovery Area
- Incrementally Updated Backups
- Faster Incremental Backups
- SWITCH DATABASE COMMAND.
- Binary Compression
- Global Scripting
- Duration Clause
- Configure This
- Oracle Enhancement for Rman in 10g
- Automatic Channel Failover
- Compress Backup Sets
- Recovery Through Reset Logs
- Cross Backup Sets
Flash Backup and Recovery Area
With ever decreasing cost of disk in the market place ,disk based backups are more feasible. A The major advantage of flash backup and recovery area is once when the hard disk gets filled Automatically obslete backups are deleted reducing the need of DBA to do such tasks Or backups whose archive logs have been already been backed up are automatically deleted.The flash Recovery area notifies the administrator when the disk space consumption is nearing the defined quota and there is no more files to purge.
Incrementally Updated Backups
You can apply incremental backups to your datafile image copies when you use the RMAN. This takes much less time then performing a full image copy of datafiles every day.
This is applied through two phases.
- Apply the incremental backup to datafile image copies .This is done at database block level.
- Then apply the archive logs since the last incremental backup only .This is done at transaction level (Slower than previous phase)
Below you can see the example of incrementally updated Backups
RMAN > Backup incremental level 0 tag = weekly database; -- This takes a full database
backup .
The remaining days .. The below script works which creates a incremental backup
(Note the speed of incremental backup could be increased by using block change
tracking file which is mentioned below ) and the recover copy with tag weekly database
is used to add the incremental to the full backup .
RMAN > Backup incremental level 1
For recover of copy
With tag weekly database;
RMAN > Recover copy of database
With tag weekly;
Faster Incremental Backup
RMAN > Sql alter database enable block change tracking using file ‘c:\cpisolution\bij.dbf’ ;
Automatic Channel Failover
In Oracle 10g the behaviour of RMAN changes with regard to the failure of a channel During a RMAN backup . In Oracle Database 10g if a channel fails. The backup process On that channel fails and will not be restarted. However backups on remaining channels Will continue to run. Once the backup process is complete RMAN will report errors that Occurred during the backup process.
Compressed BackupSets
RMAN > Backup as compressed backupset database;
Note that only backupsets can be compressed ( eg database,tablespace and datafile
backups) image copies cannot be compressed.
Rman > configure device type disk backup type to compressed
backupset;
Binary compression technique reduces backup space usage 50-75 %
Recoverey Through ResetLogs
Prior to Oracle Database 10g it is recommended practice to make a full database backup following resetlogs. This is no longer required since backup can be used before resetlogs.
Some RMAN parameters
RMAN > Configure Retention Policty To Recovery Window of 5 days
Retention Policy determines the length of time a backup is retained for use in a potential restore. A recovery window is a period of time that begins with the current time and extends backward in time to point of recoverability.
RMAN > Configure Retention policy to redundancy 3;
All backups older than the most recent backup that satisfied the above conditions are obsolete.
The recovery window always keeps in pace with the current time.
Specifying redundancy by using the CONFIGURE RETENTION POLICY TO REDUNDANCY command:
The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number does not need to be retained.
For example, the CONFIGURE RETENTION POLICY TO REDUNDANCY 3; command specifies that a maximum of three backups or copies of a data file or control file can be retained. Redundancy is the default type of retention policy.
RMAN > Configure Backup Optimization On
Read only tablespace or datafiles are backed only once per recovery window
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
Configure RMAN to back up the control file after each backup .By default, RMAN automatically names control file backups and stores them in the flash recovery area.
To configure RMAN to write control file backups to the /test directory: ( %F will generate a unique filename)
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/test/cf%F';
Block Media Recovery
Allows specified blocks to be recovered without affecting the entire datafile.. It is only intended for use where a known and limited number of blocks are affected. This results in a reduced mean time to recover (MTTR) and higher availability as only the affected blocks are offline during operation
The information regarding which block has to be recovered is found in The alert log file, Trace File,Analyze Table Command, Dbverify utility,V$Backup_Corruption & V$Copy_Corruption command.
Example of Using Block Recovery in RMAN.
RMAN> BLOCK RECOVER DATAFILE 3 BLOCK 121;
Trial Recovery
You can determine the outcome of a recovery before actually doing it for real by appending the work "test" to any recover command. The following command will cause Oracle to perform a dry-run of a recovery without actually changing any data:
SQL> recover database until cancel test;
Oracle Enterprise Manager has also been configured in such a manner that it makes it easy to manage all rman
backups and restore operations. It has buttons for quick crosschecks, showing current backups, implementing fast recovery ,changing basic rman configuration ,etc
Archive Log Failover
Archive log failover allows RMAN can take advantage of multiple archive logs destinations such that, if a corrupt log is detected it can read the log from the alternate destination
Obselete
RMAN> Delete obselete; will delete all obselege backups.
Expired are those backups which donot exist in the media.
Auto Backp of Control file
Whenever there is a structure change Aditonally It Supports
- Backup of Server Parameter File
- Parrallel Operation Supported
- Extensive Reporting Available
- Scripting
- Duplex Backup sets
- Corrupt Block Detection
- Backup archive Logs