日期:2014-05-16  浏览次数:20513 次

Oracle RESETLOGS 和 NORESETLOGS 区别说明

 

一.创建控制文件时:ResetlogsNoresetlogs

当我们将控制文件备份到trace 文件时,可以看到里面包含了2部分的重建语句,一个是使用resetlogs,另一个是使用noresetlogs。

 

备份控制文件的SQL 如下:

SQL>alterdatabase backup controlfile to trace

 

有关控制文件的详细说明,参考:

Oracle 控制文件

http://blog.csdn.net/tianlesoftware/article/details/4974440

 

 

Set #1. NORESETLOGS case

The followingcommands will create a new control file and use it to open the database. Dataused by Recovery Manager will be lost.

Additional logsmay be required for media recovery of offline.

Use this only ifthe current versions of all online logs are available.

--使用noresetlogs仅是当前所有的online logs可用时。

     

 Set #2. RESETLOGS case

The followingcommands will create a new control file and use it to open the database. Dataused by Recovery Manager will be lost.

The contents ofonline logs will be lost and all backups will be invalidated. Use this only ifonline logs are damaged.

--使用resetlogs,将导致online logs里的内容丢失,并且所有的备份失效,仅当online logs 随坏的情况下,才使用resetlos模式。

 

 

CREATE CONTROLFILE REUSE DATABASE"DAVE" RESETLOGS/NORESETLOGS  ARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 2

    MAXDATAFILES 30

    MAXINSTANCES 1

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1'/u01/app/oracle/oradata/dave/redo01.log'  SIZE 50M,

  GROUP 2'/u01/app/oracle/oradata/dave/redo02.log'  SIZE 50M,

  GROUP 3'/u01/app/oracle/oradata/dave/redo03.log'  SIZE 50M

-- STANDBY LOGFILE

DATAFILE

  '/u01/app/oracle/oradata/dave/system01.dbf',

  '/u01/app/oracle/oradata/dave/undotbs01.dbf',

  '/u01/app/oracle/oradata/dave/sysaux01.dbf',

  '/u01/app/oracle/oradata/dave/users01.dbf'

CHARACTER SET ZHS16GBK

;

 

二.打开数据库时:Resetlogs Noresetlogs

 

2.1 说明

Use RESETLOGSafter incomplete recovery (when the entire redo stream wasn't applied).RESETLOGS will initialize the logs, reset your log sequence number, and start anew "incarnation" of the database.
       --RESETLOGS会初始化logs,重置log sequence号,创建一个新的incarnation

 

Use NORESETLOGSwhen doing complete recovery (when the entire redo stream was applied). Oraclewill continue using the existing (valid) log files.

--NORESETLOGS 会继续使