Oracle8i Backup and Recovery Guide
Release 2 (8.1.6)

Part Number A76993-01





Go to previous page Go to next page

Developing a Backup and Recovery Strategy

This chapter offers guidelines and considerations for developing an effective backup and recovery strategy. It includes the following topics:

Developing a Backup Strategy

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, you 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. No matter which backup strategy you implement, however, follow these guidelines whenever possible:

Obeying the Golden Rule of Backup 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 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 main database files.

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

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

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:

Once you have answered these questions and have determined which mode to use, follow the guidelines for either:

Backing Up a NOARCHIVELOG Database

If you operate your 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:

Backing Up an ARCHIVELOG Database

If you run your database in ARCHIVELOG mode, ARCn 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 non-current time). Following are common backup strategies for a database operating in ARCHIVELOG mode:

Multiplexing Control Files, Online Redo Logs, and Archived Redo Logs

The control file, online redo log, and archived redo log are crucial files for backup and recovery operations. The loss of any of these files can cause you to lose data irrevocably. You should maintain:

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:

If users generate a significant amount of DML, database backup frequency should be proportionally high. Alternatively, if a database is mainly read-only, and updates are issued only infrequently, you can back up the database less frequently.

Use either Recovery Manager or operating system methods to create backup scripts. RMAN scripts, which are stored in the recovery catalog, are an especially efficient method for performing routine, repetitive backup operations.

See Also:

Oracle8i Recovery Manager User's Guide and Reference to learn how to create, delete, replace, and print stored scripts. 

Performing Backups When 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 alteration:

The part of the database that you should back up depends on your archiving mode:

Mode  Action 


Make a control file backup (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. 


Make a consistent whole database backup immediately before and after the modification. 

Backing Up Often-Used Tablespaces

Many administrators find that regular whole database backups are not in themselves sufficient for a robust backup strategy. If you 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 tablespaces that contain rollback segments.

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 a week on Sunday. If your database experiences heavy traffic during the week, a media failure on Friday can force you to apply a tremendous amount of redo data during recovery. If you had backed up your most frequently accessed tablespaces three times a week, you can apply a smaller number of changes to roll the restored file forward to the time of the failure.

Performing Backups After Unrecoverable/Unlogged Operations

If users are creating tables or indexes using the UNRECOVERABLE option, 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.


If using RMAN, then you can make an incremental backup. 

See Also:

Oracle8i SQL Reference for information about the UNRECOVERABLE option of the CREATE TABLE ... AS SELECT and CREATE INDEX statements. 

Performing Whole Database Backups After Opening with the RESETLOGS Option

After you have opened a database with the RESETLOGS option, Oracle recommends that you immediately perform a whole database backup. If you do not, and a disaster occurs, then you lose all changes made after opening the database.

See Also:

"What Is a RESETLOGS Operation?" for more information about RESETLOGS operations, and "Recovering a Pre-RESETLOGS Backup" to learn the special circumstances that allow you to recover a pre-RESETLOGS backup. 

Archiving Older Backups

You should store older backups for two basic reasons:

If you want to recover to a non-current 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 backup.

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

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, you will not lose all of your data.


After you open the database with the RESETLOGS option, you cannot use existing backups for subsequent recovery beyond the time when the logs were reset. You should therefore shut down the database and make a consistent whole database backup. Doing so will enable recovery of database changes after using the RESETLOGS option. 

Knowing the Constraints for Distributed Database Backups

If your database is a node in a distributed database, all databases in the distributed database system should operate in the same archiving mode. Note the following consequences and constraints:

Mode  Constraint  Consequence 


Closed cleanly. 

Backups at each node can be performed autonomously, that is, individually and without time coordination. 


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. 

See Also:

"Opening the Database After Media Recovery" to learn about performing media recovery in distributed systems, and Oracle8i Distributed Database Systems for concepts and administration relating to distributed systems. 

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 recovery catalog backups when using RMAN.

Note that 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.

See Also:

Oracle8i Utilities for a complete account of the Export utility. 

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 danger in backing up online redo logs is that you may accidentally restore them while not intending to. A number of situations are possible in which restoring the online logs cause significant problems to the database. Following are two scenarios that illustrate how restoring backed up online logs severely compromises recovery.

Scenario 1: Unintentionally Restoring Online Redo Logs

When a crisis occurs, it is easy to make a simple mistake. DBAs and system administrators frequently encounter dangers during a database restore. When restoring the whole database, you can accidentally restore the online redo logs, thus overwriting the current logs with the older, useless backups. This action forces you to perform an incomplete recovery instead of the intended complete recovery, thereby losing the ability to recover valuable transactions contained in the overwritten redo logs.

Scenario 2: Erroneously Creating Multiple Parallel Redo Log Timelines

You can unintentionally create multiple parallel redo log timelines for a single instance database. You can avoid this mistake, however, by making it so that the online logs cannot be restored. You must open the database with the RESETLOGS option, which effectively creates the new redo logs, and also a new database incarnation.

If you face a problem where the best course of action is to restore the database from a consistent backup and not perform any recovery, then you may think it is safe to restore the online logs and thereby avoid opening the database with the RESETLOGS option. The problem is that the database eventually generates a log sequence number that was already generated by the database during the previous timeline.

If you then face another disaster and need to restore from this backup and roll forward, you will find it difficult to identify which log sequence number is the correct one. If you had reset the logs, then you would have created a new incarnation of the database. You could only apply archived redo logs created by this new incarnation to this incarnation.

For example, say that the most recent archived log for database PROD has a log sequence number of 100. Assume that you restore a backup of the database along with backed up online redo logs and then do not open with the RESETLOGS option. Assume also that the restored online log is at log sequence 50. Eventually, the database archives a log with the log sequence number of 100--so you now have two copies of log 100 with completely different contents. If you are forced to recover this database, then you may inadvertently restore the wrong series of archived logs, thereby corrupting the database.


Recovery Manager and EBU do not back up online redo logs. 

Developing a Recovery Strategy

Oracle provides a variety of procedures and tools to assist you with recovery. To develop an effective recovery strategy, do the following:

Testing Backup and Recovery Strategies

Practice backup and recovery techniques in a test environment before and after you move to a production system. In this way, you can measure the thoroughness of your strategies and minimize problems before they occur in a real situation. Performing test recoveries regularly ensures that your archiving, backup, and recovery procedures work. It also helps you stay familiar with recovery procedures, so that you are less likely to make a mistake in a crisis.

If you use Recovery Manager, use the duplicate command to create a test database using backups of your production database. To learn how to duplicate a database, see Oracle8i Recovery Manager User's Guide and Reference.

Planning Your Response to Non-Media Failures

Although media recovery is your primary concern when developing your recovery strategy, you should understand the basic types of non-media failures as well as the causes and solutions for each:

Statement Failure

A statement failure is a logical failure in the handling of a statement in an Oracle program. The Oracle database server or the operating system usually returns an error code and a message when a statement failure occurs. Table 3-1 shows typical causes and resolutions for statement failures.

Table 3-1 Typical Causes and Resolutions for Statement Failures
Problem  Solution 

A logical error occurred in an application. 

Fix the program that generated the error so that its logic flows correctly. You may need to enlist the aid of developers to solve this type of problem. 

A user attempted to enter illegal data into a table. 

Modify the illegal SQL statement and reissue it. 

A user attempted an operation with insufficient privileges, for example, attempting to insert data into a table when the user has only SELECT privileges. 

Provide the necessary database privileges for the user to complete the statement successfully. 

A user attempted to create a table but exceed the allotted quota limit. 

Issue an ALTER USER statement to change the quota limit. 

A user attempted a table INSERT or UPDATE, causing an extent to be allocated without sufficient free space in the tablespace. 

Add space to the tablespace. You can also use the RESIZE and AUTOEXTEND options for datafiles. 

User Process Failure

A user process failure is any failure in a user program accessing an Oracle database. User processes can fail for a wide variety of reasons. Some typical scenarios include:

In most cases, you do not need to act to resolve user process failures: the user process simply fails to function but does not affect Oracle and other user process. The PMON background process is usually sufficient for cleaning up after an abnormally terminated user process.

User Error

Users errors are any mistakes that users make in adding data to or deleting data from the database. Typical causes of user error are:

If you have a logical backup of a table from which data has been lost, sometimes you can simply import it back into the table. Depending on the scenario, however, you may have to perform some type of incomplete media recovery to correct such errors.

You can perform either database point-in-time recovery (DBPITR) or tablespace point-in-time recovery (TSPITR). The following table explains the difference between these types of incomplete recovery:

Type  Description  Procedure 


  1. Restore backup database.

  2. Roll forward to the time just before the error.

  3. Open RESETLOGS.


For operating system recovery, see "Performing Incomplete Media Recovery".

See Also: For RMAN recovery, see Oracle8i Recovery Manager User's Guide and Reference.  


  1. Create auxiliary instance.

  2. Recover the tablespace on the auxiliary to the time just before the error.

  3. Import data back into the primary database.


For operating system TSPITR, see Chapter 7, "Performing Operating System Tablespace Point-in-Time Recovery".

See Also: For RMAN TSPITR, see Oracle8i Recovery Manager User's Guide and Reference

See Also:

"Recovering from User Errors" for a scenario involving recovery from a user error. 

Instance Failure

Instance failure occurs when an instance abnormally terminates. An instance failure can occur because:

Fortunately, Oracle performs instance recovery automatically: all you need to do is restart the database. Oracle automatically detects that the database was not shut down cleanly, then applies committed and uncommitted redo records in the redo log to the datafiles and rolls back uncommitted data. Finally, Oracle synchronizes the datafiles and control file and opens the database.

Planning Your Response to Media Failures

Media failure is the biggest threat to your data. A media failure is a physical problem that occurs when a computer unsuccessfully attempts to read from or write to a file necessary to operate the database. Common types of media problems include:

The technique you use to recover from media failure depends heavily on the type of media failure that occurred. For example, the strategy you use to recover from a corrupted datafile is different from the strategy for recovering from the loss of your control file.

The basic steps for media recovery are:

Determine Which Files to Recover

The first step is to determine what to recover. Some types of failure are obvious: for example, the hardware crashes and you need to recover the entire database. In other cases, a single datafile becomes corrupted. Often you can use the table V$RECOVER_FILE to determine what requires recovery.

Choose a Type of Recovery

When you perform media recovery, you choose either complete recovery or incomplete recovery. Following is a list of media recovery operations:

One important and special type media recovery is tablespace point-in-time recovery (TSPITR). TSPITR enables you to recover one or more tablespaces to a point-in-time that is different from the rest of the database.

The type of recovery method you use depends on the situation. Table 3-2 displays typical scenarios and strategies.

Table 3-2 Typical Media Failures and Recovery Strategies
Lost Files  Archiving Mode  Status  Strategy 

One or more datafiles 



Restore whole database from a consistent database backup. The control file and all datafiles are restored from a consistent backup and the database is opened. All changes made after the backup are lost.

Note: The only time you can recover a database in NOARCHIVELOG is when you have not already overwritten the online log files that were current at the time of the most recent backup. 

One or more datafiles and an online redo log 



Restore whole database from consistent backup. You will lose all changes made since the last backup. 

One or more datafiles and all control files 



Restore whole database and control file from consistent backup. You will lose all changes made since the last backup. 

One or more datafiles 



Perform tablespace or datafile recovery while the database is open. The tablespaces or datafiles are taken offline, restored from backups, recovered, and placed online. No changes are lost and the database remains available during the recovery.  

One or more datafiles and an online redo log required for recovery 



Perform incomplete recovery of the database up to the point of the lost online redo log. 

One or more datafiles and an archived redo log required for recovery 



Perform TSPITR on the tablespaces containing the lost datafiles up to the point of the latest available redo log. 

One or more datafiles and/or all control files 


Not open 

Restore the lost files from backups and recover the datafiles. No changes are lost, but the database is unavailable during recovery. 

One or more datafiles and/or all control files, as well as an archived or online redo log required for recovery 


Not open 

Perform incomplete recovery of the database. You will lose all changes contained in the lost log and in all subsequent logs. 

Restore Backups of Datafiles and Necessary Archived Redo Logs

The method you use to restore backups depends on whether you use RMAN or operating system methods to back up your data. If you use operating system methods, then you need to identify which files need to be restored and manually copy the backups to their necessary location. If you use RMAN, then issue a restore command and let RMAN take over the transfer of data.

If the database is shut down and you restore one of the datafiles with a backup, either because of a media failure or because for some reason you want to recover the database to a non-current time, Oracle detects an inconsistency between the checkpoint SCN in the datafile headers and the datafile header checkpoint SCNs recorded in the control file at database open time. Oracle then selects the lowest checkpoint SCN recorded in the control file and datafile headers and asks you to begin media recovery starting from a specified log sequence number. You cannot open the database if any of the online datafiles needs media recovery.

There is only one case in which Oracle will tell you that you need to perform media recovery when you do not. If a tablespace is in hot backup mode because you issued the ALTER TABLESPACE ... BEGIN BACKUP statement and the system crashes, then on the next startup Oracle will issue a message stating that media recovery is required. Media recovery is not really required here, however, since you did not restore a backup; in this case, avoid media recovery by issuing the ALTER DATAFILE ... END BACKUP statement. Note that RMAN backups do not have this problem.

See Also:

Oracle8i Recovery Manager User's Guide and Reference to learn how to restore backups using RMAN, "Restoring Files" to learn how to restore datafiles using operating system methods. 

Begin Media Recovery

You have a choice between two basic methods for recovering physical files. You can:

Obviously, the recovery method you choose is contingent on which backup method you use. For example, if you backed up your files using:

Recovering with RMAN

RMAN is a powerful tool that can aid in backup and recovery operations. Using RMAN for recovery allows you to:

Recovering with the SQL*Plus RECOVER Statement

If you do not use RMAN, then you can use operating system methods to restore your backups and SQL*Plus statements to perform media recovery. You can use SQL*Plus statements to:

You can use three basic SQL*Plus statements for recovery:

Note that each of these is also a sub-clause of an ALTER DATABASE statement. Oracle recommends using the SQL*Plus RECOVER statement rather than the ALTER DATABASE statement with the RECOVER clause. For more information about the SQL*Plus RECOVER statement, see SQL*Plus User's Guide and Reference.

Each statement uses the same criteria to determine whether files are recoverable. If Oracle cannot get the lock for a file it is attempting to recover, it signals an error. This signal prevents two recovery sessions from recovering the same file and prevents media recovery of a file that is in use.

See Also:

"Using Media Recovery Statements" to learn about the differences between the SQL ALTER DATABASE RECOVER and SQL*Plus RECOVER statements. 

Go to previous page Go to next page
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.