Oracle Rman Advanced Recovery Overview (i) Introduction to incomplete Oracle Recovery

Source: Internet
Author: User
Tags thread oracle database backup

Incomplete recovery is incomplete data recovery, incomplete recovery is the same in many ways as full recovery, they have the same basic set of commands, but some other commands are added without full recovery. There are many reasons for incomplete recovery, such as the loss of an online redo log or archived redo logs, or significant user errors. Incomplete recovery affects the entire database, in other words, you cannot perform incomplete recovery operations on only part of the database, because this makes a part of the database have a different SCN and point of time than the rest of the database.

To restore the database data to a different point in time from the rest of the database, you can use a tablespace-time recovery or a flash-back technique.

Incomplete recovery methods include: Based on time, SCN, log sequence or cancellation recovery.

1. Use Resetlogslogs command

During an incomplete recovery, it is often necessary to open the database using the Resetlogs command because we want to detach from the existing log stream that already exists, and we need to explain this to Oracle. The Resetlogs command represents the end of a logical lifetime of a database and the beginning of another database logical lifetime. The logical lifetime of a database is also called a counterpart (incarnation). Each time you use the Resetlogs command, a new database counterpart is created, which is important for recovery operations.

The SCN counter is not reset each time you use the Resetlogs command, but Oracle resets other counters, such as log sequence numbers, and resets the contents of the online redo log.

Oracle 10g simplifies recovery through the resetlogs command, adding a new special string (%r) to the archived redo log name, which represents the Resetlog ID number. When%r is included in the Log_archive_dest_format parameter string, the archived redo log name remains unique in each resetlogs command. This change, along with other internal Oracle database changes, makes it easy for Oracle to recover the database through a given resetlogs operation. Therefore, it is easy to back up the database immediately after the operation, however, we still believe that it is necessary to restore the backup database in any incomplete.

2, establish the recovery point

One job that needs to be done when performing an incomplete recovery operation with Rman is to resume the goal. The recovery directory is the endpoint of the recovery process, which is usually represented by a point in time, a specified SCN, or a log sequence number. There are many different ways in which we can set up recovery goals.

(1) using the SET command in the run code block with the until Time,until SCN or until sequence parameters

Run

{

Set until Time "to_date (' 2010-07-05 14:02:00 ', ' yyyy-mm-dd hh24:mi:ss ')";

Restore database;

Recover database ALTER DATABASE open resetlogs;

}

When this command is executed, RMAN looks for a backup set that is closest to the recovery target time (not the time of the recovery target, not itself, which is located between the recovery target), and restores the database from this backup set. If the database is in Noarchivelog mode, the restore operation stops at the time of the backup set, otherwise, during the execution of the recover command, Oracle applies the archived redo log (and any incremental backups that need to be applied) to the defined recovery target (not including the recovery target itself).

Note: If you attempt to recover to the completion point of a specific backup, you must revert to the CKP SCN or CKP time of the file in the backup set, which is listed in the Rman List command for the different backup sets. Sometimes it is not enough to use the CKP time of the backup, and may cause ORA-1152 errors.

(2) Use the until Time,until SCN and until sequence parameters directly in the Restore and recover commands

This approach avoids using the run code block and tends to work with this method.

Startup Mount;

Restore database until Time "to_date (' 2010-07-05 14:02:00 ', ' yyyy-mm-dd hh24:mi:ss ')";

Recover database until Time "to_date (' 2010-07-05 14:02:00 ', ' yyyy-mm-dd hh24:mi:ss ')";

Alter database open resetlogs;

3. Time-based recovery

This type of recovery allows the user to restore the database to a state that is consistent with the specified time. Of course, if there is no valid backup or archive redo log that restores the database to the user's requested time, Oracle will report RMAN-03002 and RMAN-20207 errors.

You must have a database backup that was generated prior to our specified recovery time, in addition to all archived redo logs.

4, based on the SCN recovery

Oracle allows the user to restore the database to the specified SCN, which is not, in fact, a common method of recovery. Examples are as follows:

Startup Mount;

Restore database until SCN 1000;

Recover database until SCN 1000;

Alter database open resetlogs;

Note: This example restores the database to SCN 1000, but does not contain the SCN.

5, based on the log sequence recovery

RMAN allows the user to restore the database to the archive redo log of the specified serial number. This recovery method is handy if there is a gap in the archived redo log. The gap usually means that we can only restore the database to the start point of the gap.

Startup Mount;

Restore database until sequence thread 1;

Recover database until sequence thread 1;

Alter database open resetlogs;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.