Restoring a database from backups

Figure 12-3 illustrates the process of restoring a database that is created at 4:30 p.m. on Monday and dumped immediately afterward. Full database dumps are made every night at 5:00 p.m. Transaction log dumps are made at 10:00 a.m., 12:00 p.m., 2:00 p.m., and 4:00 p.m. every day:

Figure 12-3: Restoring a database, a scenario

Graphic showing the steps performed for routine dumps during a typical day and the steps for restoring the database from a dump.

If the disk that stores the data fails on Tuesday at 6:00 p.m., follow these steps to restore the database:

  1. Use dump transaction with no_truncate to get a current transaction log dump.

  2. Use load database to load the most recent database dump, Tape 6. load database sets the database status to “offline.”

  3. Use load transaction to apply the most recent transaction log dump, Tape 7.

  4. Use online database to set the database status to “online.”

Figure 12-4 illustrates how to restore the database when the data device fails at 4:59 p.m. on Tuesday—just before the operator is scheduled to make the nightly database dump:

Figure 12-4: Restoring a database, a second scenario

Graphic shows the order of dumps over a day and how a crash disrupts the work flow. After the crash, there is a dump transaction and a load database then a series of load database commands and the final online database.

To restore the database:

  1. Use dump transaction with no_truncate to get a current transaction log dump on Tape 6 (the tape you would have used for the routine database dump).

  2. Use load database to load the most recent database dump, Tape 1. load database sets the database status to “offline.”

  3. Use load transaction to load Tapes 2, 3, 4, and 5 and the most recent transaction log dump, Tape 6.

  4. Use online database to set the database status to “online.”