ResetLogs介绍(译)

目录

1 概述
2 运用场合
3 作用
4在RMAN中OPEN RESETLOGS与SQLPLUS中OPEN RESETLOGS的区别
5在重建控制文件的时候使用ResetLog


1 概述

      The primary function of resetlogs is to discard the redo that was not applied during incomplete recovery, ensuring that the skipped redo can never be accidentally applied by a subsequent recovery. To accomplish this, resetlogs effectively invalidates all existing redo in all online and archived redo logfiles. This has the side effect of making any existing datafile backups unusable for future recovery operations.Resetlogs also reinitializes the controlfile information about online logs and redo threads, clears the contents of any existing online redo log files, creates the online redo log files if they do not currently exist, and resets the log sequence number in all threads to one.
  resetlogs的主要功能是在不完全恢复过程中忽略不可用的重做日志,确保略过的日志不影响接下来的恢复。resetlogs把所有存在于在线或归档的日志文件中的重做信息都置为不可用。这带来一个副作用,使得已存在的数据文件备份对将来的数据恢复不再是安全可用的了。resetlogs同时还会:重新初使化控件文件中的在线日志信息及重做日志线程、清除已存在的重做日志文件、若重做日志不存在则创建日志文件、重置所有线程中的日志序号为1。

2 运用场合

以下条件需要使用resetlog
1)在不完全恢复(介质恢复)
2)使用备份控制文件(backup的控制文件一般从日志文件和数据库的信息以及SCN的信息,相比目前的状态都已经过期了)

3 ResetLog的作用

(1)将重做日志的序列号设为1
(2)一般以该子句打开数据库后,要立即备份数据库,因为这个子句会使数据库以前的备份不能用.
(3)在重做日志当前日志组出现错误时,要以该子句打开数据库.该子句会重新设置重做日志文件的状态.
(4)让数据库系统归档初始化,重新生成归档文件.

4在RMAN中OPEN RESETLOGS与SQLPLUS中OPEN RESETLOGS的区别

1) If you run the RMAN command (not the SQL statement) ALTER DATABASE OPEN RESETLOGS, then RMAN automatically creates a new database incarnation record in the recovery catalog. RMAN implicitly and automatically issues a RESET DATABASE command, which specifies that this new incarnation of the database is the current incarnation. RMAN associates all subsequent backups and log archiving done by the target database with the new database incarnation.

2) If you issue the SQL statement (not the RMAN command) ALTER DATABASE OPEN RESETLOGS, then RMAN does not automatically run a RESET DATABASE command. Hence, RMAN cannot access the recovery catalog because it cannot distinguish between a RESETLOGS command and an accidental restore of an old control file. To solve this problem, you must manually run the RESET DATABASE command in RMAN after executing the SQL statement ALTER DATABASE OPEN RESETLOGS.

The RESET DATABASE command updates the repository to indicate that the target database has been opened with the RESETLOGS option. In the rare situation in which you wish to restore backups of a prior incarnation of the database, use the RESET DATABASE TO INCARNATION key command to change the current incarnation to an older incarnation. For example, if you accidentally drop a table immediately after the most recent RESETLOGS, then you may want to
recover the database to just before the time of the most recent RESETLOGS and then open it with the RESETLOGS option, thereby creating a new incarnation.

5在重建控制文件的时候使用ResetLogs

create controlfile resetlogs/noresetlogs
  1)用noresetlogs重建控制文件时,控制文件中datafile Checkpoint SCN来自online logs中的Current log头

  2)用resetlogs重建控制文件时,控制文件中datafile Checkpoint SCN来自各数据文件头(Start SCN)。

你可能感兴趣的:(sql,Access)