Catalog Maintenance   «Prev  Next»

Lesson 4 Use RMAN to reset a database
Objective Discuss the use of the reset command.

Use RMAN to Reset a Database

This lesson discusses why you might need to issue the reset database command and the syntax to do so.
Let us say your database failed and was recovered at some point in time. As a result, you may have performed an incomplete recovery of your database and would have issued an alter database open resetlogs command. In this case, Recovery Manager cannot distinguish between your resetlogs[1] command and an inadvertent recovery of an old control file. In both cases, Recovery Manager knows that something is not right with your database. Thus, the reset database command will create a new incarnation record of your target database. The syntax for this is:

RMAN>reset database

Incarnation number

Question: How is the incarnation number used in combination with the reset command to perform basic maintenance in Oracle?
Oracle Database uses incarnations to keep track of database backups. An incarnation of the database is created whenever you open the database with the RESETLOGS option. In other words, each time you perform a RESETLOGS operation, you start a new incarnation of the database. This is an important concept to understand when managing database backups and performing point-in-time recovery operations.
Oracle assigns an incarnation number to each database incarnation to distinguish it from all other incarnations of the same database. The incarnation number is a numeric value that increases each time a new incarnation is created. RMAN uses the current incarnation to determine the default backup and restore behavior.
Here is how you can manage incarnations in RMAN:

Viewing the Database Incarnation History

Before using the RESET DATABASE command, it's crucial to understand the current and parent incarnations of your database. You can do this with the LIST INCARNATION command:
RMAN> LIST INCARNATION;
The LIST INCARNATION command will display a list of all incarnations of the database. The output includes the database name, database ID, incarnation, and resetlogs time and SCN.

Resetting the Database to a Prior Incarnation

If you need to perform a point-in-time recovery to a time in a prior incarnation, you need to reset the database to that incarnation. Use the RESET DATABASE TO INCARNATION command:
RMAN> RESET DATABASE TO INCARNATION number;

Replace "number" with the incarnation number to which you want to reset the database. The incarnation number is listed in the output of the LIST INCARNATION command. After issuing this command, RMAN considers the specified incarnation as the current incarnation and interprets subsequent RESTORE and RECOVER commands in the context of this incarnation.

Resetting the Database to the Current Incarnation

After the restore and recovery operations, you may need to reset the database back to the current incarnation to continue with regular backup and restore operations. Use the RESET DATABASE command:
RMAN> RESET DATABASE;

This command resets the database to the current incarnation, as indicated by the target database control file. After issuing this command, RMAN considers the latest incarnation as the current incarnation. In summary, the incarnation number plays a critical role in managing database backups and performing point-in-time recovery operations in Oracle Database. Understanding how to manage incarnations can help you to perform these tasks more effectively. As always, ensure that you have a solid understanding of these concepts and that you have thoroughly tested your backup and recovery processes.
The incarnation number[2] is used to identify a version of the target database. This version number ensures that the correct archived and online redo log files are applied during a recovery of your target database.

Reset database to incarnation

If you issue the list incarnations command, you will get a list of all incarnation records for your database. One incarnation will be current, the others will not. Review the table below to check if you have the following output from a list incarnation of databasecommand:

DB KEY INC KEY DBNAME DBID CURR
1 10 ORACLE 1234567890 NO
1 100 ORACLE 1234567890 NO
1 1000 ORACLE 1234567890 YES

If it turns out that you have received any of the outputs indicated in the table, you can perform a reset command to restore the database back to version 10 by issuing the following command:

RMAN>reset database to incarnation 10

You will subsequently need to issue the appropriate restore and recover RMAN commands to recover the correct database files from incarnation 10.
The following graphic demonstrates the output from resetting your client's database, (orc2), to incarnation 1119, which is also the current incarnation.

Reset database to incarnation 1119
Reset database to incarnation 1119;

Reset Oracle Database

Click the link below to read about resetting a database to a specific incarnation.
Reset Oracle Database
In the next lesson, you will learn how to use RMAN to resynchronize your target database.

[1] resetlogs: Used to reapply the archive log files to your database.
[2] Incarnation number: Unique number that is used to identify a version of the database.