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/NORESETLOGSARCHIVELOG
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 会继续使用已经存在,且有效的log files。
2.2 MOS 上对这个RESETLOGS和NORESETLOGS的说明:
Physical Backup and Recovery: An Insider'sPerspective [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。