Previous | Table of Contents | Next

Page 612

Before continuing, double-check that you have all of the archived logs since the last backup was started. They should all be in the archived log directory. Now you're ready to roll forward the old data files to the last commit:

  1. Start Server Manager.

  2. Start up the database just as you normally would.

  3. When the database tries to open, Oracle will discover that one or more of the data files have an outdated sequence number. Oracle will stop and wait for you to recover the database. You should now type in the following:
    RECOVER AUTOMATIC DATABASE;
    
  4. Once the recovery is complete, the outdated data files will have been rolled forward.

  5. Shut down the database normally. If you lost a control file, you can replace it by just making a copy of a current control file. All the control files are listed in the init.ora file for your instance. If you lost a redo log file, you can replace it with a copy of a redo log file from the same group number. By querying V$LOG, you can determine what files are in the same redo log group.

  6. Make a cold backup of the database.

  7. Start up the database normally.

Windows EnvironmentsThis procedure describes the same recovery procedure as described above for the Windows NT operating system. Although you can recover a Windows NT Oracle database using the same command-line utilities described above, it is much easier and more straightforward to use Oracle's GUI tools.

You need to identify which files were lost. Keeping a list of all data files on the database is helpful when you're completely recovering a database with Recovery Manager. Whenever you add a data file to the database, Recovery Manager should be started and then closed. Recovery Manager builds a list of data files, control files, and redo logs every time it is started and the database is running. By doing this, you can browse through Recovery Manager's list of data files to determine which files are lost or damaged. You should still keep a paper copy of the data files in your Windows NT-based Oracle instances.

In the Windows environment, Oracle's Recovery Manager takes care of almost everything related to a complete recovery. Before starting, you should double-check that you have all of the archived logs since the beginning of the last backup. These files should all be in the archived log directory specified in the init<instance>.ora or config<instance>.ora file. If you backed up your database to disk, you need to make sure the backup files are online. Otherwise, you'll need to have the backup tape handy.

Follow these steps to recover your Windows NT Oracle database:

  1. Try to start up Oracle normally through Server Manager. It will fail, but this is to be expected because of the missing/damaged files.

  2. Start Oracle Recovery Manager.

  3. Choose the Restore data file, and then do recovery option.

Page 613

  1. Click the Files button. A dialog box similar to Figure 24.5 should appear.

  2. Click the Control Files radio button.

  3. Remove any control files listed by clicking each control filename and then the Remove button.

  4. Click the Log Files radio button.

  5. Remove any redo log files listed by clicking the filename of each redo log file and then the Remove button.

  6. Click the Data Files radio button.

  7. Remove any data files listed that do not need recovery. The only files listed should be those that are missing or damaged.

  8. Click OK.

  9. Click Recover.

  10. Select where your database backup can be found. Choose either Restore from tape or Restore from disk. If you choose a disk location, be sure that the directory shown in the Directory field is where your backup files are and that <latest backup> is shown in the Backup: field.

  11. Click OK.

  12. Recovery Manager may issue some warnings about shutting down the database while another session is open. Just click OK on any that pop up.

  13. Start up the database normally.

FIG. 24.5
Selecting database files
to recover with
Recovery Manager.

Recovery Manager will automatically roll forward the data files from the last backup using the redo and archived logs. If you need to recover any missing redo log files, complete the following steps:

  1. Shut down the database.

  2. Replace the missing redo log file by copying a file from the same group number.

  3. Restart the database.

Page 614

If you need to recover any missing control files, complete the following steps:

  1. Shut down the database.

  2. Replace the missing control log file with a copy of one of the current control files.

  3. Restart the database.

Incomplete Recovery

When you completely recover a database, your intention is to avoid losing any committed transactions. To do this, you must have all of the archived logs since the beginning of the last backup, as well as current redo logs. If you do not have all of these files, you must perform an incomplete recovery—you must bring the database up with some transactions lost.

Generally, this type of recovery is something to be avoided. However, there are instances when you need to restore a database as it was at some point in the past. Suppose a bank is being investigated by auditors for covering up money laundering. The auditors would probably like to look at the bank's databases as they were during the money laundering but before the cover-up. A DBA can, with the right set of hot or cold backups and archived logs in place, take the database back in time, so to speak. The auditors could then examine the database as it was during the laundering operation and expose the crime.

Command-Line EnvironmentsIf an archived log file is missing, Oracle will stop the recovery process and prompt you to place the missing file in the archived log directory. Because you do not have this log file available for whatever reason, you need to tell Oracle to open the database with what it has recovered so far. Oracle cannot skip an archived log and continue restoring with subsequent logs. Listing 24.3 shows an example of trying a complete recovery of a database with a lost data file. The example system is missing an archived log file, log #200.

Listing 24.3 Oracle Server Manager Release 2.1.3.0.0—Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.

Oracle7 Server Release 7.1.6.2.0 - Production Release
With the distributed, replication and Parallel Server options
PL/SQL Release 2.1.6.2.0 - Production

SVRMGR> connect internal;
Connected to an idle instance.
SVRMGR> startup;
ORACLE instance started.
Total System Global Area       4383424 bytes
Fixed Size                       49104 bytes
Variable Size                  3916528 bytes
Database Buffers                409600 bytes
Redo Buffers                      8192 bytes
Database mounted.

Previous | Table of Contents | Next