ALTER DATABASE open Resetlogs

Source: Internet
Author: User

With the Resetlogs option, the current log sequence number (log sequence numbers) is reset to 1 and all log information is discarded. The Resetlogs option is required when the following conditions are used:

In the incomplete recovery (media recovery);

Use a backup control file.

After you open a database with Resetlogs, be sure to make a full database backup.

Do you have to do it only once for incomplete recovery?

With the default settings of Rman, backup database is backed up, some operations are done, and then the boot to Mount state is directly shut down.

Rman> run{

2> set until Time "to_date (' 2010-10-16 23:14:42 ', ' yyyy-mm-dd hh24:mi:ss ')";

3> Restore Database;

4> Recover database;

5>}

Executing command:set until clause

Starting restore at 17-oct-10

Allocated Channel:ora_disk_1

Channel ora_disk_1:sid=156 Devtype=disk

Channel ora_disk_1:starting datafile backupset restore

Channel ora_disk_1:specifying DataFile (s) to the restore from backup set

restoring DataFile 00001 to/oracle/oradata/denver/system01.dbf

restoring DataFile 00002 to/oracle/oradata/denver/undotbs01.dbf

restoring DataFile 00003 to/oracle/oradata/denver/sysaux01.dbf

restoring datafile 00004 to/oracle/oradata/denver/users01.dbf

restoring DataFile 00005 to/oracle/oradata/denver/example01.dbf

Channel ora_disk_1:reading from backup piece/oracle/flash_recovery_area/denver/backupset/2010_10_16/o1_mf_nnndf_ Tag20101016t230845_6cmhzz8t_.bkp

Channel ora_disk_1:restored backup Piece 1

Piece Handle=/oracle/flash_recovery_area/denver/backupset/2010_10_16/o1_mf_nnndf_tag20101016t230845_6cmhzz8t_. BKP tag=tag20101016t230845

Channel Ora_disk_1:restore complete, elapsed time:00:01:26

Finished restore at 17-oct-10

Starting recover at 17-oct-10

Using channel Ora_disk_1

Starting Media recovery

Archive log thread 1 sequence already on disk as FILE/ORACLE/ARCHIVELOG/1_10_732510268.DBF

Archive Log filename=/oracle/archivelog/1_10_732510268.dbf thread=1 sequence=10

Media recovery complete, elapsed time:00:00:01

Finished recover at 17-oct-10

rman> ALTER DATABASE open resetlogs;

Database opened

Found that the time just recovered 23:14:42 a little early, and then want to restore time point for 23:17:26, and then shut down the database, Mount state, but the error

Rman> Run {

2> set until Time "to_date (' 2010-10-16 23:17:26 ', ' yyyy-mm-dd hh24:mi:ss ')";

3> Restore Database;

4> Recover database;

5>}

Executing command:set until clause

Using target database control file instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE, STACK follows ===============

RMAN-00571: ===========================================================

Rman-03002:failure of SET command at 10/17/2010 00:45:40

Rman-20207:until time or RECOVERY WINDOW is before resetlogs time

Time to restore the previous point is not:

Rman> Run {

2> set until Time "to_date (' 2010-10-16 23:14:40 ', ' yyyy-mm-dd hh24:mi:ss ')";

3> Restore Database;

4> Recover database;

5>}

Executing command:set until clause

Using target database control file instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE, STACK follows ===============

RMAN-00571: ===========================================================

Rman-03002:failure of SET command at 10/17/2010 01:17:03

Rman-20207:until time or RECOVERY WINDOW is before resetlogs time

Why is this? Those archives are still there, after my rman did not fully recover, it can not be completely restored, and have not changed the backup control files have a relationship? What did it do in there?

rman> list incarnation;

Using target database control file instead of recovery catalog

List of Database incarnations

DB Key Inc key DB Name db ID STATUS reset SCN Reset Time

------- ------- -------- ---------------- --- ---------- ----------

1 1 DENVER 4021391415 PARENT 1 22-oct-05

2 2 DENVER 4021391415 PARENT 525876 16-oct-10

3 3 DENVER 4021391415 current 620239 17-oct-10

Problem solving:

First to understand what the ALTER DATABASE open resetlogs mean, why use Resetlogs to open the database, this command issued after the Oracle has done?

The ALTER DATABASE open Resetlogs is to reset the redo log when the data is being opened, and the sequence of the redo log is about to reset to zero, why reset the redo log?

After incomplete recovery, the original online redo log contains data that was not pre-recovered, and the data is no longer valid for the restored database, so the database will require the sequence of the online redo log to be zeroed before open.

The Resetlogs command represents the end of a logical lifetime of a database and the beginning of another logical lifetime of a database, and the SCN is not reset each time the Resetlogs command is used, but Oracle resets the log sequence number and resets the online redo log content.

Oracle calls this database logical lifetime incarnation

Each time you use Resetlogs to open the database, you will make incarnation + 1, that is, to generate a new incarnation;

If you want to revert to the previous incarnation Scn/time, you need to revert to the previous incarnation;

For the above case, the specific is to first

Reset database to incarnation 2;

Try again not to fully recover

--This article references: 9.6.1 use the ALTER DATABASE open resetlogs occasion, ALTER DATABASE open Resetlogs

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.