Tuesday, May 26, 2009

New features in RMAN since Oracle9i

Oracle9i RMAN new features: Oracle9i introduced several new enhancements. Let us discuss some of the new enhancements in oracle9i.

1. Persistent Configuration:
Introduced new CONFIGURE command enable us to configure various backup, restore and recover parameters that are persistent across RMAN sessions.

CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\BK\bk%d_%s_%p'
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE DEFAULT DEVICE TYPE CLEAR;
CONFIGURE EXCLUDE FOR TABLESPACE users;
CONFIGURE EXCLUDE FOR TABLESPACE users CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE BACKUP OPTIMIZATION ON;

2. Backup of Archivelogs:

We can use new PLUS ARCHIVELOG clause to specify that archive logs that have not been backed up are included with the data backup.

BACKUP DATAFILE 2 PLUS ARCHIVELOG;

3. Restartable Backups:

Oracle9i has added another new clause to the BACKUP statement, NOT BACKED UP [SINCE TIME….]. This clause specifies that oracle should only back up files that have not been backed up since a particular date and time.

BACKUP DATABASE NOT BACKED UP SINCE TIME ‘sysdate-7’;

We can use this clause to restart the backup process when it fails after completing a part of the backup. This clause only backs up the files that were missed by the first backup that failed. This clause enables you to reduce the time required for the backup. Otherwise, you would have to perform a full backup again. If we omit the SINCE TIME option, files that have never been backed up become candidates for backup.

Oracle9i also optimize the restoration of files from backup, files whose file header match the headers of the files in the backup sets are not restored. This keeps us from restoring files that have already been restored in the case of restore operation that fails midway.

4. Block Media Recovery – BMR:

Data blocks can be corrupted due to various reasons during normal database operations. Oracle writes information about the data block corruption into the alert log file and the user trace files. Prior to oracle9i, we had to restore and recover the entire data file by applying the redo required from the archived log files, even through just one single block was corrupted. It would be time consuming to restore and recover the entire data file just for one corrupted block.

Oracle9i introduced BMR to enable us to restore and recover just those blocks that are corrupted. We can find the corrupted block from V$BACKUP_CORRUPTION and V$COPY_CORRUPTION views. We also do not have to bring the data file offline to recover the corrupted blocks. The DB availability is greatly enhanced with BMR feature.

BLOCKRECOVER DATAFILE d1 BLOCK b1,[b2,b3,b4…]
[DATAFILE d2 BLOCK b5,[b7,b8….]]…

--recover corrupt blocks in three datafiles
RMAN> BLOCKRECOVER DATAFILE 2 BLOCK 12, 13 DATAFILE 3 BLOCK 5, 98, 99 DATAFILE 4 BLOCK 19;

5. Trail Recovery:

Trail recovery tests the backup and identifies any problem in the backup before we really use this backup for any recovery. The difference between regular recovery and trail recovery is that, in trial recovery, the data is not written to the data files and changes are only recorded in the buffers. Trail recovery writes any errors encountered into the alert log file.

Once the trail recovery is completed, all the effects of trail recovery are nullified, and it writes all the errors in alert log. The database should be mounted stage while doing regular recovery as well as trail recovery. So users can not use the database during both trail and regular recovery.

Oracle9i introduced new feature to allow number of block corruptions during the recovery. If the corrupt blocks are few, you can perform a recovery that ignores the corrupt block but recovers the rest.

RECOVER DATABASE ALLOW 2 CORRUPTION;

Miscellaneous Enhancements:

1. Oracle9i has ability to report obsolete backups that are not required to keep the database unrecoverable with in a particular window of time. Here is the example.

REPORT OBSOLETE RECOVERY WINDOW OF 7 DAYS

We can also use DELETE OBSOLETE command to delete those obsolete backups. Also we can display files that must be backed up for number of days recovery window.

REPORT NEED BACKUP RECOVERY WINDOW OF 7 DAYS

2. We can use CROSSCHECK command to check if backup sets or file copies exists.

3. List command has been enhanced. Now we can specify either BY BACKUP or BY FILE.
LIST BACKUP;
LIST BACKUP BY FILE;

4. Introduced SHOW command to display all persistent parameters.
SHOW ALL


Oracle10g RMAN new features: Oracle10g introduced several new enhancements. Let us discuss some of the new enhancements in oracle10g.

1. Incrementally updated backups:

RMAN incremental backup method back up only datafile blocks that have changed since a specified previous backup. You can make incremental backups of databases, individual tablespaces or datafiles. The goal of an incremental backup is to back up only those data blocks that have changed since a previous backup.

Each data block in a datafile contains a system change number (SCN), which is the SCN at which the most recent change was made to the block. During an incremental backup, RMAN reads the SCN of each data block in the input file and compares it to the checkpoint SCN of the parent incremental backup. If the SCN in the input data block is greater than the checkpoint SCN of the parent, then RMAN copies the block.

Incremental backups can be either level 0 or level 1. A level 0 incremental backup, which is the base for subsequent incremental backups, copies all blocks containing data, backing the datafile up into a backup set just as a full backup would. The only difference between a level 0 incremental backup and a full backup is that a full backup is never included in an incremental strategy.

RMAN> backup incremental level 0 tablespace system;
RMAN> backup incremental level 1 database;

A level 1 incremental backup can be either of the following types:

1. A differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0

2. A cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0

2. Fast Incremental backup

During the incremental backup, oracle scans the whole data file and compare the SCN between the blocks in the data file and backup set files. It will be a time consuming tasks. Oracle introduced change tracking file to track the physical location of all database changes. During an incremental backup, RMAN uses the change tracking file to quickly identify only the blocks that have changed, avoiding the time consuming task of reading the entire data file to determine which blocks have changed. This is called Fast incremental backup. The new background process CTWR(Change tracking writer) is also required when using fast incremental backups.

SQL> alter database enable block change tracking using file
2 'C:/changetracking/chg01.dbf';

Database altered.
SQL>

The dynamic performance view V$BLOCK_CHANGE_TRACKING shows where block change tacking file is stored, whether it is enabled, and how large it is.

Please click the below link to read more about incremental backup in oracle10g. Click here

3. Dropping database through RMAN

We can drop the database through RMAN, it has additional benefits of dropping all backup copies and archived log files for the database if you include the INCLUDING BACKUPS clause.

RMAN> drop database including backups;

4. Automatic Channel Failover

If we are using multiple channels during an RMAN backup to either tape or disk and one of the channels fails, the backup job continues on the remaining channels. Any errors including channel errors are reported in the dynamic performance view V$RMAN_OUTPUT after the backup job is completed.

5. Duration, Throttling and Partial Backup Options

BACKUP......DURATION is a maximum duration or time frame for a backup operation, we can minimize the impact of the backup operation in a 24/7 environment. The new DURATION option, which replace RATE and READRATE in previous version of RMAN. For example, to spread out the backup of the USERS tablespace over a maximum of two hours, use the following command.

RMAN> BACKUP DURATION 2:00 TABLESPACE users;

By default, the backup will complete as fast as possible within the two-hour time frame.

BACKUP.....DURATION.....PARTIAL adding PARTIAL to the BACKUP command prevents an error message from being issued by RMAN in case the backup does not finish the operation in the specified amount of time. Any complete backup sets are available for recovery operations, and any partial or incomplete backup operations will have to be restarted.

RMAN> backup duration 2:00 partial
2> tablespace users
3> filesperset 1;

BACKUP.....DURATION.....MINIMIZE LOAD The MINIMIZE LOAD clause, used with disk backups only, automatically adjusts the throughput of the backup operation to complete the backup in the estimated completion time specified by DUATION.

RMAN> BACKUP DURATION 4:00 PARTIAL
2> MINIMIZE LOAD
3> DATABASE FILESPERSET 1;

BACKUP....DURATION....MINIMIZE TIME The MINIMIZE TIME clause, will complete the backup in the shortest possible time.

RMAN> backup duration 2:00 minimize time
2> tablespace users;

6. Creating Image copies

Oracle10g introduced new feature to create image copy of the data files. It is equivalent to conventional copy of oracle data files. Image copy is a bit-for-bit duplicate of a database file, identical to a copy made with an operating system command. When we take conventional backup, we need to put the tablespace in BEGIN BACKUP mode. But when we create image copy, it is not required. Another thing, when we take conventional backup, it will not be registered in RMAN catalog database. But RMAN image copy backup will be registered in catalog database.

What is the advantage of image copies? To answer this question, it would be useful for migrating the database to ASM. We can also use them to recover the database in non RMAN environment.

We have BACKUP AS COPY command in RMAN, which can copy entire database, multiple tablespaces, datafiles, archived log files.

RMAN> backup as copy database;
RMAN> backup as copy tablespace system, sysaux;
RMAN> backup as copy datafile 1;

RMAN automatically determines which datafiles belong to each tablespace and performs the image copy for each. In addition, the image copies generated by RMAN can be used directly in a recovery operation without using RMAN to extract a data file from previous backup set.

7. Full databaes backup

We may want to back up a previous backup to tape, rather than create a direct backup to tape, so as not to impact a database that is up and running. In RMAN, we can use the following command to backup a previous copy of the entire database to the default tape device.

RMAN> backup copy of database;

8. Compressed backup

This feature allows RMAN to perform binary compression of backupsets. The resulting backupsets do not need to be uncompressed during recovery. It is most useful in the following circumstances.

1. You are performing disk-based backup with limited disk space
2. You are performing backups across a network where network bandwidth is limiting
3. You are performing backups to tape, CD or DVD where hardware compression is not available

RMAN>BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
RMAN>BACKUP AS COMPRESSED BACKUPSET DATAFILE 1,5;

Compression requires additional CPU cycles which may affect the performance of the database. For this reason it should not be used for tape backups where hardware compression is available.

I have discussed some of the other topics which are related to this thread. Please go through below links in case if you are interested....

How do we enable archivelog in oracle? Click here

How do we set up RMAN in oracle? Click here

What is difference between traditional backup and RMAN backup? Click here

Different type of recovery scenario in RMAN? Click here

No comments: