您的位置:首页 > 数据库 > Oracle

关于resetlogs

2015-07-05 11:21 561 查看
RESETLOGS | NORESETLOGS This clause determines whether Oracle Database resets the current log sequence number to 1, archives any unarchived logs (including the current log),
and discards any redo information that was not applied during recovery, ensuring that it will never be applied. Oracle Database uses 
NORESETLOGS
 automatically
except in the following specific situations, which require a setting for this clause:

You must specify 
RESETLOGS
:


After performing incomplete media recovery or media recovery using a backup control file

After a previous 
OPEN
 
RESETLOGS
 operation
that did not complete

After a 
FLASHBACK
 
DATABASE
 operation

If a created control file is mounted, then you must specify 
RESETLOGS
 if
the online logs are lost, or you must specify 
NORESETLOGS
 if they are not
lost.

When you open the database with the 
RESETLOGS
 option, the database
performs the following actions:


Archives the current online redo logs (if they are accessible) and then erases the contents of the online redo logs and resets the log sequence number to 1.

For example, if the current online redo logs are sequence 1000 and 1001 when you open 
RESETLOGS
,
then the database archives logs 1000 and 1001 and then resets the online redo logs to sequence 1 and 2.

Creates the online redo log files if they do not currently exist.

Initializes redo thread records and online redo log records in the control file to the beginning of the new database incarnation.

More specifically, the database sets the redo thread status to closed, sets the current thread sequence in the redo thread records to 1, sets the thread checkpoint of each redo thread to the beginning of log sequence 1, chooses one redo log from each thread
and initialize its sequence to 1, and so on.

Updates all current datafiles and online redo logs and all subsequent archived redo logs with a new 
RESETLOGS
 
SCN
 and
time stamp.

Because the database does not apply an archived redo log to a data file unless the 
RESETLOGS
 
SCN
 and
time stamps match, the 
RESETLOGS
 requirement prevents you from
corrupting data files with archived logs that are not from direct parent incarnations of the current incarnation. The relationship among incarnations is explained more fully in the following section.

In previous releases, it was recommended that you back up the database immediately after the 
OPEN
RESETLOGS
. Because you can now easily recover a pre-
RESETLOGS
 backup
like any other backup, making a new database backup is optional. To perform recovery through 
RESETLOGS
 you
must have all archived logs generated after the most recent backup and at least one control file (current, backup, or created).

参考:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_1004.htm#SQLRF00802 http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmrvcon.htm#BRADV1171
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle