Oracle RESETLOGS 和 NORESETLOGS 差异阐明ITeye - 威尼斯人

Oracle RESETLOGS 和 NORESETLOGS 差异阐明ITeye

2019年03月24日12时14分53秒 | 作者: 雨欣 | 标签: 康复,文件,操控 | 浏览: 2216

在网上看的,感觉挺好,保藏啦。呵呵

一.创立操控文件时:Resetlogs和Noresetlogs
当咱们将操控文件备份到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 wasnt 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 会持续运用现已存在,且有用的log files。



能够运用RMAN指令检查incarnation的信息:

RMAN list incarnation;



更多内容参阅:

RMAN 系列(八) RMAN List和report指令

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



Oracle Rman跨resetlogs版别康复

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



做不彻底康复有必要运用resetlogs, resetlogs也能够做彻底康复。而noresetlogs则是有必要做彻底康复时运用。resetlogs会重置日志序列号强制清空或重建REDO,而noresetlogs则不会这么做。





2.2 MOS 上对这个RESETLOGS和NORESETLOGS的阐明:
Physical Backup and Recovery: An InsidersPerspective [ID 16530.1]:



After recoverdatabase operation, open the database with: ALTER DATABASE OPEN [NO]RESETLOGS



(1)  NORESETLOGS

The NORESETLOGSoption does not clear the redo log files during startup and the online redologs to be used for recovery. Only used in scenario where MANUAL RECOVERY isstarted, CANCEL is used, and then RECOVER DATABASE is started.

(2)RESETLOGS



CAUTION: Never use RESETLOGS unlessnecessary.



Once RESETLOGS is used then the redo logfiles cannot be used and any completed transactions in those redo logs arelost!!



Before using the RESETLOGS option take anoffline backup of the database.



The RESETLOGSoption clears all the online redo logs and modifies all the online data filesto indicate no recovery is needed. After resetting the redo logs none of theexisting log files or data file backups can be used.



In the control file, the log sequence number is modified,which is very important for recovery purposes. Therecovery will be applied only to the log files whose sequence number is greaterthan log sequence number in the control file. One has to be very cautious whenusing RESETLOGS option. It is important to remember that all datafiles must beonline otherwise they will become useless once the database is up。





2.3 几种状况的阐明


(1)  第一种状况

假定只是操控文件丢掉,而其他文件没有丢掉(主要是归档和REDO),那么康复的时分假如挑选从备份中康复操控文件。康复后,操控文件会去读数据文件头中与CHECKPOINT SCN对应的RBA信息来确认从那个序列的归档日志开端康复,一向推动康复到NEXT SCN是无穷大的那个REDOLOG,此刻康复是彻底康复的,但翻开的时分还要以resetlogs方法翻开,这样要重置归档日志的sequence,也就是说,假如你康复时运用了备份操控文件,那么翻开数据库时必定是要resetlogs的。



不彻底康复时是有必要RESETLOGS,可是彻底康复时假如运用备份操控文件来康复,那么运用RESETLOGS相同能够彻底康复。可是丢掉操控文件也能够不运用RESETLOGS方法翻开数据库,这样也就能够防止重置日志序列号带来的不变,概况请见第四种状况。



(2)  第二种状况

不彻底康复,不管是要什么样的不彻底康复,SCN,TIME,跨过REDO,都有必要运用resetlogs。




(3)  第三种状况

丢掉REDOLOG,这就更需求resetlogs了,由于resetlogs能够重建REDOLOG。假如你的REDOLOG、操控文件、数据文件丢掉的话,需求先康复操控文件,然后restore database;recover database;alter database open resetlogs;

留意,这时分做的是不彻底康复,由于REDO没有了。在recover过程中或许会报错然后主动退出RMAN,无视,alter database open resetlogs即可,



(4)  第四种状况

没有丢掉操控文件及各种日志,仅丢掉数据文件,这种问题比较常见,有或许磁盘损坏形成数据文件丢掉,等磁盘毛病扫除后,需求康复,此刻的康复就很简略了,restore database;recover database;alter database open;就全部OK,也就是说,在不运用备份操控文件康复的状况下,是能够运用noresetlog方法翻开数据库的。

条件有一,不能丢掉日志文件。假若丢掉了操控文件和数据文件但仍是想以noresetlog翻开的话,就有必要手动以noresetlogs方法重建操控文件,并且REDOLOG的状况都有必要正常,否则是无法运用noresetlogs方法翻开。



几种状况的剖析转自一下Blog:

http://space.itpub.net/16628454/viewspace-524593

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表威尼斯人立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章