OPEN THE DATABASE WITH RESETLOGS

4. Open the database with resetlogs.

At Step 2, only restore the controlfile if the current physical structure of the

database does not correspond to the physical structure at the time from which the

restore is made. If the physical structure is still the same (that is, no tablespaces have

created or dropped), then do not restore the controlfile; using the current controlfile,

which is aware of all recent log switches and archives, will make recovery simpler. Do

not under any circumstances restore the online redo log files: data from the current

online log files will be needed if the recovery is to be up to a very recent time.

At Step 3, you have three options: stop the recovery at a certain time, at a certain

SCN (system change number), or at a certain log switch sequence number. The time

option is most commonly used. The SCN option would usually only be used for

instantiating a copy of a database to an exact point for some reason, such as establishing

a streamed (replicated) database. The last option would usually be used only if an

archive log file is missing or damaged, making it impossible to recover further.

Examples of the commands are

recover database until time '2008-12-21:13:50:00' ;recover database until change 93228650 ;recover database until cancel;

Points to note are, first, that there is no permitted variation in the date format. It

must be yyyy-mm-dd:hh24:mi:ss no matter what your SQL*Plus session has its NLS_

DATE_FORMAT set to. Second, the syntax for recovery up to a certain archive log file

does not allow you to specify which log file: you must stop the recovery interactively,

when prompted for the log file that you do not wish to (or cannot) apply. Third, in

all cases the recovery will be to the change vector immediately before that requested

stopping point: the nominated SCN will not be applied. Finally, if the recovery

includes applying changes for transactions that had not been committed at the

point at which recovery ceases, these changes will be rolled back.

EXAM TIP A RECOVER DATABASE UNTIL . . . will stop immediately before

applying the change vector of the nominated time or SCN, not immediately

after.

If RMAN has been configured, then a user-managed incomplete recovery must

be terminated with a fifth step: updating the RMAN repository with details of the

RESETLOGS operation. The problem is that without this, RMAN will observe that the

log switch sequence number recorded in the controlfile has dropped to 1, and will

not know if this is because you deliberately reset it (in which case RMAN should do

nothing) or because you have restored an old controlfile (in which case RMAN should

recover it). From an RMAN prompt, the command to do this is RESET DATABASE.