Recovering from media failure on the data
 Recover from media failure on the database file

This procedure describes the steps for recovering from media failure if the only file that you lost is the database.

  1. Make an extra backup copy of the current transaction log. Since the database file is unavailable, the transaction log contains the only record of the changes that have been made since the last backup.

  2. Create a recovery directory to hold the files you use during recovery.

  3. Copy the database file from the last full backup to the recovery directory.

  4. Apply the transactions held in the backed up transaction logs to the recovery database. Use one of the following methods.

    To apply each transaction log manually, for each log file, chronologically, do the following:

    1. Copy the log file into the recovery directory.

    2. Start the database server with the apply transaction log (-a) option, to apply the transaction log:

      dbeng12 database-name.db -a log-name.log

      The database server shuts down automatically once the transactions are applied.

    3. Once you have applied all the backed up transaction logs, copy the online transaction log into the recovery directory.

      Apply the transactions from the online transaction log to the recovery database.

      dbeng12 database-name.db -a log-name.log

    If you want the database server to determine the correct order of the transaction logs and apply them automatically, do the following:

    1. Copy the offline and online transaction log files into the recovery directory.

    2. Start the database server with the -ad option, to specify the location of the transaction logs. The database server determines the correct order in which to apply the transaction logs based on the log offsets:

      dbeng12 database-name.db -ad log-directory

      The database server shuts down automatically once the transactions are applied.

  5. Perform validity checks on the recovery database.

  6. Make a backup.

  7. Move the database file to the production directory.

  8. Notify users that they can access the production database.

 See also