Database Reference
In-Depth Information
of dependencies that occur between transactions. For example, if you have a parent and
child table, you want to make sure that during recovery all INSERT s into the parent table
occur before INSERT is into the child table. This is because of the foreign key constraint that
exists between the two tables to ensure the integrity of that parent/child relationship. The
SCN helps Oracle to track the temporal flow of those changes, and thus the parent table
INSERT will have a lower SCN than the child table INSERT . As a result, in the end, all is
right with the world.
SCNs are loosely coupled with time. Thus, 12:30 p.m. local time would be associated with
a specific SCN in a given individual database. The thing to remember is that 12:30 p.m. local
time will most likely be associated with a different SCN in each database, so the coupling
is very loose. The concept of the SCN is very important because there may be times when
you will want to restore your database to a specific SCN. This is supported during recovery
operations. Also, Oracle's Flashback features support the use of the SCN when flashing back
the database. See Chapter 8 “Understanding Flashback Technology,” for more information
on the vast number of features available with Oracle Flashback Database.
When you issue the RECOVER DATABASE command from the SQL prompt, you have a
number of options. You can recover the entire database with RECOVER DATABASE , you can
recover a specific tablespace with RECOVER TABLESPACE , and you can recover a data file with
RECOVER DATAFILE . As you progress through this chapter, you will see several examples
of the use of the RECOVER DATABASE command, including the use of the database SCN to
recover your database.
After you have issued the RECOVER DATABASE command, you will be prompted for the
archived redo log it thinks it needs to apply. You can simply press the Enter key and Oracle
will apply the redo in that archived redo log. Once the redo has been applied, the RECOVER
DATABASE command will prompt you for the next redo log in the sequence, and you press
Enter again.
As you can imagine, this can get a little long-winded if you have to apply a number of
archived redo logs. Another thing you can do at the prompt is type in AUTO . This will cause
the RECOVER DATABASE command to automatically start applying archived redo-log files
without prompting you for the name or location of those files. This is much easier!
Recovering the Database after the Loss of All Data Files
You can use the RECOVER DATABASE command to recover the entire database all at once.
Having restored all the database data files from the backup media, you would follow
these steps:
1. Log into the database as SYS using the SYSDBA privilege.
2. Mount the database with the STARTUP MOUNT command.
3. Issue the RECOVER DATABASE command from the SQL prompt.
The RECOVER DATABASE command will recommend to you the correct archived redo
log to apply.
Search WWH ::




Custom Search