Week 9 RMAN
Week 9 RMAN
RMAN becomes more powerful with a redesigned incremental backup scheme, offline recovery of incremental backups, previewing restore, recovering through resetlogs, file compression, and much more Most people would agree that RMAN is the de facto tool of choice for Oracle database backup. But as powerful as they were, early versions of RMAN left something to be desired. Like many DBAs, I had pet peeves about the absence of what I consider to be must-have features. Fortunately, Oracle Database 10g addresses many of these issues by incorporating many desirable features, making RMAN an even more powerful and useful tool. Let's take a look.
block
change
tracking
using
file
This command creates a binary file called /rman_bkups/change.log for tracking purposes. Conversely, you can disable tracking with
Kenexa
Week 9
Page 1 of 3
The database must be in archive log mode to be flashback-enabled. That process creates Oracle Managed Files in the directory /ora_flash_area, with a total size of up to 2GB. The database changes are written to these files and can be used to quickly recover the database to a point in the past. By default, RMAN also uses /ora_flash_area to store backup files; thus, RMAN backups are stored on disk, not tape. For that reason, you have the ability to specify how many days you need to keep backups. After that period, the files are automatically deleted if more space is required. The flash recovery area needn't be a filesystem or a directory, howeveralternatively, it could be an Automatic Storage Management (ASM) diskgroup. In that case, the flash recovery area is specified by:
Incremental Merge
Let's say you have the following backup schedule: Sunday - Level 0 (full), with tag level_0 Monday - Level 1 (incremental) with tag level_1_mon Tuesday - Level 1 (incremental) with tag level_1_tue and so on. If the database fails on Saturday, prior to 10g you would have had to restore the tag level_0 and then apply all six incrementals. It would have taken a long time, which is another reason many DBAs shun incremental backups. Oracle Database 10g RMAN radically changes that equation. Now, your incremental backup command looks like this:
RMAN> backup incremental level_1 for recover of copy with tag level_0 database;
Here we have instructed RMAN to make an incremental level_1 backup and merge that with the full backup copy with the tag level_0. After this command, level_0 becomes a full backup of that day. So, on Tuesday, the backup with tag level_0, when merged with incremental level_1 backup, becomes identical to the full Tuesday backup. Similarly, the incremental taken on Saturday, when applied to the backup on disk, will be equivalent to a full level_0 Saturday backup. If the database fails on Saturday, you just need to restore the level_0 backup plus a few archive logs to bring the database into a consistent state; there is no need to apply additional incrementals. This approach cuts down recovery time dramatically, speeds backup, and eliminates the need to make a full database backup again.
Compressed Files
With disk-based backups in the flash recovery area, you still have a big limitation: disk space. Especially when going across a networkas is usually the caseit's advisable to create as small a backup set as possible. In Oracle Database 10g RMAN, you can compress files inside the backup command itself:
Kenexa
Week 9
Page 2 of 3
RMAN> list output; BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------3 Incr 1 2M DISK 00:00:00 26-FEB-04 BP Key: 3 Status: AVAILABLE Compressed: YES Tag: TAG20040226T100154 Piece Name: /ora_flash_area/SMILEY10/backupset/2004_02_26/o1_mf_ncsn1_TAG20040226T1 00154_03w2m3lr_.bkp Controlfile Included: Ckp SCN: 318556 Ckp time: 26-FEB-04 SPFILE Included: Modification time: 26-FEB-04
As with any compression process, this approach puts pressure on CPUs. As a tradeoff, you can keep more RMAN backups on disk that are readily available for restore-and-recover operations. Alternatively, you can make RMAN backups at the Physical Standby Database that can be used to recover the primary database. That approach will offload backup resourses to another host.
Preview allows you to ensure the recovery readiness of your backup infrastructure by making periodic and regular checks.
Kenexa
Week 9
Page 3 of 3