Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
RMAN> create catalog;
recovery catalog created
Step 3.
Now that the catalog is created, go to OEM | Database | Availability | Recovery Catalog Settings. Select Use Recovery Catalog, and then click the Add Recovery Catalog button. From Grid Control, you can choose an already discovered database or provide the host, the port, the SID, and the RMAN username and password. From Database Control, you cannot choose from a list and must provide the host:port:sid combination. In addition, you need to provide the recovery catalog credentials (the RMAN user created in Step 2).
Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery
327
Step 4.
After the Add Recovery Catalog action returns you to Recovery Catalog Settings, you need to provide the Recovery Catalog user and password again, along with host credentials to run the job. When this is complete, you can click OK, and the register database action will complete.
Related Links for Recovery Catalog Settings
Three “related links” that provide additional functionality are at the bottom of the Recovery Catalog Settings page:
■
Resynchronize Catalog
Manually do a sync operation to bring the database control file and the recovery catalog into a synchronized state.
■
Recovery Catalogs
View and manage all recovery catalogs that EM has been made aware of.
■
Unregister Database
Remove this database from the selected recovery catalog permanently.
Database Backups from Enterprise Manager
Now that you have configured your database for backups from the OEM interface, you can get to the nitty-gritty of actually taking a backup. From the OEM Console, after you have selected your database and clicked the Availability tab, click the Schedule Backup link. On the Schedule Backup page, you are given two options: the Oracle-Suggested Backup or Schedule a Customized Backup.
Oracle-Suggested Backup Strategy
Starting with Oracle Database 10
g,
Oracle has put together a full backup strategy that is “ready to wear” straight from the rack. This is available only via OEM (in both Grid Control and Database Control) and requires the existence of the FRA. The Oracle-suggested strategy checks the backup
328
Part III: Using RMAN Effectively
and recovery settings you’ve configured for your database and draws conclusions about whether you want a disk-only backup, a tape-only backup, or a combined disk and tape backup.
Disk-Only Oracle-Suggested Backup Strategy
The disk-only backup strategy is the most straightforward. It uses the “incremental apply to database copy” functionality to create a backup strategy that is self-cleaning. Here’s an example of how it works. In this example, we start the Oracle-suggested strategy on a Monday evening at 10 P.M. The database is running in ARCHIVELOG mode, has automatic control file and SPFILE
backups enabled, and uses the FRA.
■
Monday night
A full image copy of every datafile is taken for the database. This backup is stored in the FRA.
■
Tuesday night
A level 1 incremental backup set is created. All blocks that have changed since Monday night at 10 P.M. are backed up.
■
Wednesday night
First, RMAN applies the Tuesday night incremental backup to the Monday night image copy, which makes the full image copy backup a current copy of the database as it looked Tuesday night at 10 P.M. After that is complete, RMAN takes a new level 1 backup.
■
Thursday night
RMAN applies the Wednesday night incremental backup to the image copy, which makes our database backup current as of Wednesday night at 10 P.M. Then, a new incremental level 1 backup is taken, with all changes since Wednesday night.
■
Friday night
RMAN does the exact same thing it did on Thursday night. On Saturday, it does the same thing. Same with Sunday. This action repeats every day until you tell it to stop.
Notice a few things about this backup strategy. First, a full database backup is taken only once. After that, RMAN takes only level 1 incremental backups. Then, nightly, the previous night’s incremental backup is applied. This strategy ensures that the database backup is at least 24 hours behind the current point in time. This allows for a point-in-time recovery to any point in the previous 24 hours, but nothing earlier than that. At most, the database backup is 48 hours behind the current time, so recovery is never that far behind.
There are limitations to this strategy, but that’s one of the drawbacks to a “one-size-fits-all” approach to backups.
Tape-Only Oracle-Suggested Backup Strategy
The tape-only suggested strategy differs in many ways from the disk-only suggested strategy. First, no backup will ever be created in the FRA. Sure, archive logs will accumulate there, but all backups will go directly to the tape device. In addition, the tape-only strategy cannot take advantage of the incremental apply feature. Remember, an image copy backup cannot be taken to tape. All backups to tape will be of the backup set type.
When you schedule an Oracle-suggested tape-only backup, two RMAN scripts are generated: a daily backup and a weekly backup. First, the weekly script is run. This creates a full database backup, including all archive logs. Then, the daily script is run. The daily backup does an incremental backup of only changed blocks, along with all archive logs not already backed up. Then, once a week, the full database backup runs again.
Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery
329
During the tape-only backup wizard, if you have not specified a retention policy, OEM asks you to specify one. Then, as part of the daily backup, your retention policy is enforced on the tape channel.
After generating a tape-only suggested strategy, you will find that the scripts might look something like this:
Daily Script:
run {
allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms
'nb ora server (horatio.hadba.com)';
allocate channel oem sbt backup2 type 'SBT TAPE' format '%U' parms
'nb ora server (horatio.hadba.com)';
backup incremental level 1 cumulative database;
backup archivelog all not backed up;
}
allocate channel for maintenance device type 'SBT TAPE' parms
'nb ora server (horatio.hadba.com)';
delete noprompt obsolete recovery window of 7 days device type 'SBT TAPE'; Weekly Script:
run {allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms
'nb ora server (horatio.hadba.com)';
allocate channel oem sbt backup2 type 'SBT TAPE' format '%U' parms
'nb ora server (horatio.hadba.com)';
backup incremental level 0 database;
backup archivelog all not backed up;
Combined Disk and Tape Oracle-Suggested Backup Strategy
When you combine disk backups with tape backups, the hybrid solution demands more input from you than either of the previous Oracle-suggested strategies. And, for the first time, you must make a configuration decision.
First, consider the disk part of the strategy. Backups to disk are identical in the combined disk and tape strategy and in the disk-only strategy: a full image copy in the FRA, and then incremental backups each night that are then applied to the image copy.
As far as the tape part of the strategy, you must decide how much you want backed up to tape on a daily basis. On a weekly basis, the suggested strategy backs up all recovery-related files (with the
backup recovery files
command in RMAN). But, you must choose how much to back up daily: nothing, archive logs only, archive logs and incrementals, or archive logs and the full database copy.
If you decide to back up archive logs and incrementals to tape daily, this would be the resulting daily and weekly script that OEM builds:
Daily Script:
run {
allocate channel oem disk backup device type disk;
recover copy of database with tag 'ORA$OEM LEVEL 0';
backup incremental level 1 cumulative
copies 1 for recover of copy with tag
'ORA$OEM LEVEL 0' database;
release channel oem disk backup;
allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms
330
Part III: Using RMAN Effectively
'nb ora server (horatio.hadba.com)';
backup archivelog all not backed up;
backup backupset all not backed up since time 'SYSDATE-1';
}
allocate channel for maintenance device type 'SBT TAPE' parms
'nb ora server (horatio.hadba.com)';
delete noprompt obsolete recovery window of 7 days device type
'SBT TAPE';
Weekly Script:
run {
allocate channel oem disk backup device type disk;
recover copy of database with tag 'ORA$OEM LEVEL 0';
backup incremental level 1 cumulative copies 1 for recover of copy with tag
'ORA$OEM LEVEL 0' database;
release channel oem disk backup;
allocate channel oem sbt backup1 type 'SBT TAPE' format '%U' parms
'nb ora server (horatio.hadba.com)';
backup recovery area;
}
allocate channel for maintenance device type 'SBT TAPE' parms
'nb ora server (horatio.hadba.com)';
delete noprompt obsolete recovery window of 7 days device type 'SBT TAPE';
Final Note on Oracle-Suggested Strategies
Taking a default backup strategy “off the shelf” has its benefits and its drawbacks. The benefits come from being able to “set and forget” the backups—they will run forever and clean themselves up. There is some assurance in having this option, particularly for low-priority development databases that typically are operated by someone other than you. If they come to you in a panic, you can always use these backups to fix the problem and save everyone a lot of headaches.
But there is (almost) no customization, and sometimes the default strategy will not match your SLA. The most glaring example of this is in the ability to do point-in-time recoveries to some point in the past (a limitation of the disk-based strategy only). Remember, these strategies are merely Oracle suggestions. You don’t have to use them, and if they are giving you any heartburn, there is a simple answer: drop the suggested strategy and build your own.
Scheduling a Customized Backup
From the same Availability page where you can choose to schedule an Oracle-suggested backup strategy, you can also choose to build your own customized backup job. This is a wizard-driven process that steps you through the different choices to be made about the backup. When the wizard is finished, you can run the backup as a one-time backup immediately, schedule it for later, or set it up to repeat continually on a schedule.
It is important that you take the time to develop a full backup strategy ahead of time, but OEM
will provide some guidance about how to develop that strategy. These tips appear as small-font hints under some of the choices you will be asked to make in the Backup Scheduling Wizard.
Chapter 13: Using Oracle Enterprise Manager for Backup and Recovery
331