Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » Database maintenance » Backup and data recovery » Database recovery » Media failure recovery

 

Recovering from media failure on the database file

Recover a database when the only file you lost during media failure was the database file.

Prerequisites

You must have the BACKUP DATABASE and VALIDATE ANY OBJECT system privileges.

 Task
  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:

    Option Action
    Manually apply each transaction log in chronological order
    1. Copy the transaction log file into the recovery directory.

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

      dbeng16 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.

      dbeng16 database-name.db -a log-name.log
    Have the database server determine the correct order of the transaction logs and apply them automatically
    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:

      dbeng16 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.

Results

The database is recovered.

 See also