learn-oracle


   Oracle Jobs   

   Ask A Question   



Oracle Backup Strategies

PREVIOUS CHAPTER  |  NEXT CHAPTER



Before you create an Oracle database, decide how to protect the database against potential media failures. If you do not develop a backup strategy before creating your database, then Oracle DBA may not be able to perform recovery if a disk failure damages the datafiles, online redo log files, or control files.

This section describes general guidelines that can help you decide when to perform database backups and which parts of a database you should back up. Of course, the specifics of your strategy depend on the constraints under which you are operating.

This section contains these topics:

Learn Oracle - Highlights

Learn Oracle - RMAN Restore and Recovery

The set of files needed to recover from the failure of any Oracle database file--a datafile, control file, or online redo log--is called the redundancy set. The redundancy set contains:

  • The last backup of the control file and all the datafiles
  • All archived redo logs generated after the last backup was taken
  • A duplicate of the online redo log files generated by Oracle multiplexing, operating system mirroring, or both
  • A duplicate of the current control file generated by Oracle multiplexing, operating system mirroring, or both
  • Configuration files such as the server parameter file, tnsnames.ora, and listener.ora
The golden rule of backup and recovery is: the set of disks or other media that contain the redundancy set should be separate from the disks that contain the datafiles, online redo logs, and control files. This strategy ensures that the failure of a disk that contains a datafile does not also cause the loss of the backups or redo logs needed to recover the datafile. Consequently, a minimal production-level database requires at least two disk drives: one to hold the files in the redundancy set and one to hold the database files.

Always keep the redundancy set separate from the primary files in every way possible: on separate volumes, separate file systems, and separate RAID devices. These systems are reliable, but they can and do fail. Keeping the redundancy set separate ensures that you can recover from a failure without losing committed transactions.

Oracle DBA can implement a system that follows the golden rule in several different ways. Oracle recommends following these guidelines:

  • Multiplex the online redo log files and current control file at the Oracle level, not only at the operating system or hardware level. Multiplexing at the Oracle level has the advantage that an I/O failure or lost write should only corrupt one of the copies.
  • Use operating system or hardware mirroring for at least the control file, because Oracle does not provide complete support for control file multiplexing: if one multiplexed copy of the control file fails, then the Oracle instance shuts down.
  • Use operating system or hardware mirroring for the primary datafiles if possible to avoid having to apply media recovery for simple disk failures.
  • Keep at least one copy of the entire redundancy set--including the most recent backup--on hard disk.
  • If the redundancy copy is created by splitting a local mirror, then it is not as good as a backup created through operating system or RMAN commands because it relies on the mirroring subsystem for both the primary files and redundancy set copy. The last file backup, such as the last backup to tape, is the redundancy set copy. Hence, keep archived logs needed to recover this copy.
  • If your database is stored on a RAID device, then place the redundancy set on a set of devices that is not in the same RAID device.
  • If you keep the redundancy set on tapes, then maintain at least two copies of the data because tapes can fail. Also, if you have more than one copy of the same data, then consider keeping backups from different points in time. In this way, if one backup or split mirror was done when the database was corrupted, then you have an older backup when the database was not corrupted.

Back to Top

Learn Oracle - Choosing the Database Archiving Mode

Before you create an Oracle database, decide how you plan to protect it against potential failures. Answer the following questions:

  • Is it acceptable to lose any data if a disk failure damages some of the files that constitute a database?

    If not, then run the database in ARCHIVELOG mode, ideally with a multiplexed online redo log, a multiplexed control file, and multiplexed archive redo logs. If Oracle DBA can afford to lose all data from your last backup to the point of failure, then you can operate in NOARCHIVELOG mode and avoid the extra maintenance chores. You may have alternative ways of re-creating the data.

  • Will you need to recover to a noncurrent time?

    If you need to perform incomplete recovery to correct an erroneous change to the database, then run in ARCHIVELOG mode and perform control file backups whenever making structural changes. Incomplete recovery is easiest when you have a backup control file reflecting the database structure at the desired time.

  • Does the database need to be available at all times?

    High-availability databases always operate in ARCHIVELOG mode to take advantage of open datafile backups.

After you have answered these questions and determined which mode to use, follow the guidelines for either:
  • Backing Up a NOARCHIVELOG Database
  • Backing Up an ARCHIVELOG Database
Backing Up a NOARCHIVELOG Database
If you run the database in NOARCHIVELOG mode, Oracle does not archive filled groups of online redo log files. Therefore, the only protection against a disk failure is the most recent whole backup of the database. Follow these guidelines:

  • Make whole database backups regularly, according to the amount of work that Oracle DBA can afford to lose. For example, if you can afford to lose the amount of work accomplished in one week, then make a consistent whole database backup once every week. If you can afford to lose only a day's work, then make a consistent whole database backup every day. For large databases with a high amount of activity, you usually cannot afford to lose work. In this case, you should operate the database in ARCHIVELOG mode.
  • Whenever you alter the physical structure of a database operating in NOARCHIVELOG mode, immediately take a consistent whole database backup. A whole database backup fully reflects the new structure of the database.

Backing Up an ARCHIVELOG Database
If you run your database in ARCHIVELOG mode, then the archiver archives groups of online redo log files. Therefore, the archived redo log coupled with the online redo log and datafile backups can protect the database from a disk failure, providing for complete recovery from a disk failure to the instant that the failure occurred (or, to the desired noncurrent time). Following are common backup strategies for a database operating in ARCHIVELOG mode:

  • Back up the entire database after you create it. This initial whole database backup is the foundation of your backups because it provides backups of all datafiles and the control file of the associated database.
  • Make backups of tablespaces when the database is open or closed to keep the database backups up-to-date. So long as Oracle DBA have the necessary archived logs to recover the backup, you never have to shut down the database to make a backup.
  • In particular, back up the datafiles of extensively used tablespaces frequently to reduce database recovery time. If a more recent datafile backup restores a damaged datafile, then you need to apply less redo (or incremental backups) to the restored datafile to roll it forward to the time of the failure.
  • You can also use a datafile copy taken while the database is open and the tablespace is online to restore datafiles. You must apply the appropriate redo log files to these restored datafiles to make the data consistent and bring it forward to the specified point in time.
  • Back up the control file every time you make a structural change to the database. If you run in ARCHIVELOG mode and the database is open, then use either RMAN or the SQL statement ALTER DATABASE BACKUP CONTROLFILE.
  • Back up archived logs frequently. It is strongly recommended that you keep at least two copies of archived logs: one on disk and another on off-line storage (tape, optical disks, and so forth). Keep the logs on disk as long as possible but back them up as soon as possible.

Back to Top

Learn Oracle - Multiplexing Control Files, Online Redo Logs, and Archived Redo Logs

Control files, online redo logs, and archived redo logs are crucial files for backup and recovery operations. The loss of any of these files can cause Oracle DBA to lose data irrevocably. You should maintain:

  • At least two copies of the control file on different disks mounted under different disk controllers. You should use Oracle to multiplex the copies and your operating system to mirror each copy.
  • Two or more copies of your online redo log on different disks. The online redo data is crucial for instance, crash, and media recovery.
  • Two or more copies of your archived redo log on different disks and, if possible, different media.

Back to Top

Learn Oracle - Performing Backups Frequently and Regularly

Frequent backups are essential for any recovery scheme. Base the frequency of backups on the rate or frequency of database changes such as:

  • Addition and deletion of tables
  • Insertions and deletions of rows in existing tables
  • Updates to data within tables
If users generate a significant amount of DML, then database backup frequency should be proportionally high. Alternatively, if a database is mainly read-only, and if updates are issued only infrequently, then you can back up the database less frequently.

You can use either RMAN or user-managed methods to create backup scripts. If you set persistent configurations using RMAN's CONFIGURE command, however, then you should not typically need to write extensive scripts. You can regularly run BACKUP DATABASE PLUS ARCHIVELOG.


Back to Top

Learn Oracle - Performing Backups Before and After You Make Structural Changes

Administrators as well as users make changes to a database. If you make any of the following structural changes, then perform a backup of the appropriate portion of your database immediately before and after completing the following changes:

  • Create or drop a tablespace.
  • Add or rename a datafile in an existing tablespace.
  • Add, rename, or drop an online redo log group or member.
The part of the database that you should back up depends on your archiving mode:

Mode Action
ARCHIVELOG Make a control file backup (using RMAN or using the ALTER DATABASE statement with the BACKUP CONTROLFILE option) before and after a structural alteration. Of course, you can back up other parts of the database as well.
NOARCHIVELOG Make a consistent whole database backup immediately before and after the modification.

Back to Top

Learn Oracle - Backing Up Often-Used Tablespaces

Many DBAs find that regular whole database backups are not in themselves sufficient for a robust backup strategy. If Oracle DBA run in ARCHIVELOG mode, then you can back up the datafiles of an individual tablespace or even a single datafile. This option is useful if a portion of a database is used more extensively than others, for example, the SYSTEM tablespace and automatic undo tablespaces.

By making more frequent backups of the extensively used datafiles of a database, you avoid a long recovery time. For example, you may make a whole database backup once every two weeks. If the database experiences heavy traffic during the week, then a media failure on Friday can force you to apply a tremendous amount of redo during recovery. If you had backed up your most frequently accessed tablespaces three times a week, then you could apply a smaller number of changes to roll the restored file forward to the time of the failure.

If you are running in automatic undo management mode, then be sure to regularly back up your undo tablespaces. If you run in manual undo management mode, then be sure to regularly back up all tablespaces containing rollback segments.
Back to Top

Learn Oracle - Performing Backups After Unrecoverable Operations

If users are creating tables or indexes using the UNRECOVERABLE option, then make backups after the objects are created. When tables and indexes are created as UNRECOVERABLE, Oracle does not log redo data, which means that you cannot recover these objects from existing backups.
Back to Top

Learn Oracle - Performing Whole Database Backups After Opening with the RESETLOGS Option

After you open a database with the RESETLOGS option, Oracle Corporation recommends that Oracle DBA immediately perform a whole database backup. If you do not, and if a disaster occurs, then it is possible to lose all changes made after opening the database.

In certain cases, you can restore a backup made prior to a RESETLOGS and recover the database, but the procedure is complicated and requires you to have a control file backup from before and after the RESETLOGS operations. A whole database backup created after a RESETLOGS protects against this situation.


Back to Top

Learn Oracle - Archiving Older Backups

You may need to store older backups for two basic reasons:

  • An older backup is necessary for performing incomplete recovery to a time before your most recent backup
  • Your most recent backup is corrupted
If you want to recover to a noncurrent time, then you need a database backup that completed before the desired time. For example, if you make backups on the 1st and 14th of February, then decide at the end of the month to recover your database to February 7th, you must use the February 1st (or earlier) backup.

For a database operating in NOARCHIVELOG mode, the backup that you use must be a consistent whole database backup. Of course, you cannot perform media recovery using this backup. For a database operating in ARCHIVELOG mode, the whole database backup:

  • Does not need to be consistent because redo is available to recover it
  • Should have completed before the intended recovery time
  • Should have all archived logs necessary to recover the datafiles to the required point-in-time
  • Should be recovered with a control file that reflects the database's structure at the point-in-time that ends the recovery
For added protection, keep two or more database backups (with associated archived redo logs) previous to the current backup. Thus, if your most recent backups are not usable, then you will not lose all of your data.


Back to Top

Learn Oracle - Knowing the Constraints for Distributed Database Backups

If the database is a member of a distributed database system, then all databases in the system should operate in the same archiving mode. Note the consequences and constraints contained in the following table

Mode Constraint Consequence
ARCHIVELOG Closed cleanly Backups at each node can be performed autonomously, that is, individually and without time coordination.
NOARCHIVELOG Closed cleanly Consistent whole database backups must be performed at the same global time to plan for global distributed database recovery. For example, if a database in New York is backed up at midnight EST, the database in San Francisco should be backed up at 9 PM PST.

Back to Top

Learn Oracle - Exporting Data for Added Protection and Flexibility

Because the Oracle Export utility can selectively export specific objects, consider exporting portions or all of a database for supplemental protection and flexibility in a database's backup strategy. This strategy is especially useful for logical backups of the RMAN recovery catalog, because Oracle DBA can quickly reimport this data into any database and rebuild the catalog if the recovery catalog database is lost.

Database exports are not a substitute for whole database backups and cannot provide the same complete recovery advantages that the built-in functionality of Oracle offers. For example, you cannot apply archived logs to logical backups in order to update lost changes. An export provides a snapshot of the logical data (tables, stored procedures, and so forth) in a database when the export was made.


Back to Top

Learn Oracle - Avoiding the Backup of Online Redo Logs

Although it may seem that you should back up online redo logs along with the datafiles and control file, this technique is dangerous. You should not back up online redo logs for the following reasons:

  • The best method for protecting the online logs against media failure is by multiplexing them, that is, having multiple log members in each group, on different disks and disk controllers.
  • If your database is in ARCHIVELOG mode, then the archiver is already archiving the filled redo logs.
  • If your database is in NOARCHIVELOG mode, then the only type of backups that you should perform are closed, consistent, whole database backups. The files in this type of backup are all consistent and do not need recovery, so the online logs are not needed.
  • You may accidentally restore backups of online redo logs while not intending to, thereby corrupting the database.

Back to Top

Learn Oracle - Keeping Records of the Hardware and Software Configuration of the Server

During the stress of a recovery situation, it is important that you have all necessary information at your disposal. This is especially true if for some reason you need to contact Oracle Support because you run into a problem that you do not understand. You should have the following documentation about the hardware configuration:

  • The name of the node that hosts the database
  • The make and model of the production machine
  • The version and patch of the operating system
  • The disk capacity of the host
  • The number of disks and disk controllers
  • The disk capacity and free space
  • The media management vendor (if you use a third-party media manager)
  • The type and number of media management devices
You should also keep the following documentation about the software configuration:
  • The name of the database instance (SID)
  • The database identifier (DBID)
  • The version and patch release of the Oracle database server
  • The version and patch release of the networking software
  • The method (RMAN or user-managed) and frequency of database backups
  • The method of restore and recovery (RMAN or user-managed)
  • The datafile mount points
Oracle DBA should keep this information both in electronic and hardcopy form. For example, if you save this information in a text file on the network or in an email message, then if the entire system goes down, you may not have this data available.


Back to Top

We learned Backup Strategies. Next, We will move to Recovery Strategies.

PREVIOUS CHAPTER  |  NEXT CHAPTER





You are just 10 steps away from becoming a Oracle DBA. Materialize your dream by following the The 10 Simple Steps .

More Tutorials on Oracle dba ...



Liked it ? Want to share it ? Social Bookmarking

Add to: Mr. Wong Add to: BoniTrust Add to: Newsider Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Jumptags Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Blinklist Add to: Technorati Add to: Newsvine Information


Source : Oracle Documentation | Return to Learn Oracle

Want to share or request Oracle Tutorial articles to become a Oracle DBA. Direct your requests to webmaster@oracleonline.info

<%=DisplayLinks(3,""," - ","","")%>